<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hello,<div><br></div><div> I have a matrix generated from matrix matrix multiplication. I want that matrix to convert to 1 dimensional array. my code is as below<div><br></div><div>#####################################################</div><div><div><span class="Apple-tab-span" style="white-space:pre">      </span><font color="#4f7a28">//Multiplication A * B (A is MPIAIJ & B is MPIDENSE)</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">    </span>MatMatMult(A, B,  MAT_INITIAL_MATRIX,  PETSC_DEFAULT, &C);</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">  </span>MatView(C,PETSC_VIEWER_STDOUT_WORLD);</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font color="#4f7a28">     </font></span></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">  </span>//Convert Matrix C to 1D vector h_C</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">       </span>for(i = 0; i < m; i++)</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre"> </span>{</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">         </span>for(j = 0; j < k; j++)</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">         </span>{</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">                 </span>ierr = MatGetValues(C, 1, &i, 1, &j, &h_C[IDX2C(i,j,end1)]);CHKERRQ(ierr);</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre">            </span>}</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre"> </span>}</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre"> </span>//printArray(h_B, m, k, "h_B");</font></div><div><font color="#4f7a28"><span class="Apple-tab-span" style="white-space:pre"> </span>printArray(h_C, m, k, "A * X0");</font></div></div><div>#####################################################</div><div>when I tried the routine MatGetValues() it shows some error as below</div><div><br></div><div>#####################################################</div><div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">--------------------- Error Message ------------------------------------</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: No support for this operation for this object type!</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: Only local values currently supported!</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: ------------------------------------------------------------------------</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: Petsc Release Version 3.3.0, Patch 0, Tue Jun  5 14:20:42 CDT 2012 </font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: See docs/changes/index.html for recent updates.</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: See docs/index.html for manual pages.</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: ------------------------------------------------------------------------</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: ./blockCG_1 on a arch-linu named <a href="http://hpcd.cs.odu.edu">hpcd.cs.odu.edu</a> by ppatel Tue Aug 19 12:29:41 2014</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: Libraries linked from /export/software/petsc-3.3/lib</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: Configure run at Wed Jun  6 16:29:21 2012</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: Configure options --prefix=/export/software/petsc-3.3 --download-f-blas-lapack=1</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: ------------------------------------------------------------------------</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: MatGetValues_MPIDense() line 180 in src/mat/impls/dense/mpi/mpidense.c</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: MatGetValues() line 1602 in src/mat/interface/matrix.c</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">[1]PETSC ERROR: main() line 343 in blockCG_1.c</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">--------------------------------------------------------------------------</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD </font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">with errorcode 56.</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo; min-height: 21px;"><font color="#4f7a28"><br></font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">You may or may not see output from other processes, depending on</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">exactly when Open MPI kills them.</font></div><div style="margin: 0px; font-size: 18px; font-family: Menlo;"><font color="#4f7a28">--------------------------------------------------------------------------</font></div></div><div><br></div><div>#####################################################</div><div><br></div><div>what is the efficient way to create a 1-D array from the PETSC matrix?</div></div></body></html>