<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1487414548429_58716"><span id="yui_3_16_0_ym19_1_1487414548429_62144">Hello,</span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716"><span><br></span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716"><span id="yui_3_16_0_ym19_1_1487414548429_62108">Some newbie questions I have wrt matrix creation, thank you for any help:</span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716"><span><br></span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><span id="yui_3_16_0_ym19_1_1487414548429_60401">1. Is it correct to say that a sequential matrix is created in one process (for example, the root process), and then distributed to all processes with MatAssemblyBegin and MatAssemblyEnd ? Or sequential matrix only works with running with 1 MPI process only?</span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1487414548429_69226"><br></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><span id="yui_3_16_0_ym19_1_1487414548429_62134">2. For a parallel matrix creation, each process will set its values, so I need to provide the data for each process on all the machine ?</span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><span><br></span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><span>3. </span><span style="font-family: "Courier New"; white-space: pre-wrap;" id="yui_3_16_0_ym19_1_1487414548429_62202">MatSetValues(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],const PetscScalar v[],InsertMode addv)</span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><span style="font-family: "Courier New"; white-space: pre-wrap;" id="yui_3_16_0_ym19_1_1487414548429_62249">  According to the manual page #59 : </span>This routine inserts or adds a logically dense subblock of dimension m*n into the matrix ...</div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">    I am not sure if extracting the non zero elements and forming a 'dense block' of data from a large sparse matrix is efficient. My original matrix data is column major. I am thinking of creating and loading the matrix in a column by column way, with n = 1 and using MAT_ROW_ORIENTED = FALSE. Is it efficient ?</div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">    I think I need to pre-allocate memory, but the API for parallel matrix <span style="font-family: "Courier New"; white-space: pre-wrap;" id="yui_3_16_0_ym19_1_1487414548429_69134">MatMPIAIJSetPreallocation () requires to have the none zero info for <span style="font-family: "Times New Roman"; font-size: medium; white-space: normal;" id="yui_3_16_0_ym19_1_1487414548429_69177">DIAGONAL portion and NON-DIAGONAL portion separately. </span> This seems to add more work when converting my sparse matrix to PETSc format...</span></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"> </div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">4. Ideally, I would like to load the matrix data in the main process only, then distribute to all other processes. What is the best way to do this ?</div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">    </div><div dir="ltr" id="yui_3_16_0_ym19_1_1487414548429_69244"><br id="yui_3_16_0_ym19_1_1487414548429_69245"></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">5. MatView and MatLoad</div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">    MatView seems to create one file with data for all processes (I only tested with one machine) :</div><div dir="ltr" id="yui_3_16_0_ym19_1_1487414548429_67320"></div>        Vec Object: 4 MPI processes<div id="yui_3_16_0_ym19_1_1487414548429_67354">        type: mpi</div><div id="yui_3_16_0_ym19_1_1487414548429_67355">        Process [0]</div><div id="yui_3_16_0_ym19_1_1487414548429_67356">        0.</div><div id="yui_3_16_0_ym19_1_1487414548429_67357">        Process [1]</div><div id="yui_3_16_0_ym19_1_1487414548429_67358">        1.</div><div id="yui_3_16_0_ym19_1_1487414548429_67359">        Process [2]</div><div id="yui_3_16_0_ym19_1_1487414548429_67360">        2.</div><div id="yui_3_16_0_ym19_1_1487414548429_67361">        Process [3]</div><div id="yui_3_16_0_ym19_1_1487414548429_67362">        3.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1487414548429_67363"><br id="yui_3_16_0_ym19_1_1487414548429_67364"></div><div dir="ltr" id="yui_3_16_0_ym19_1_1487414548429_67330">    So do I have to manually distribute this file to all machines ?<br></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">Many thanks again !    </div><div id="yui_3_16_0_ym19_1_1487414548429_58716" dir="ltr">   </div><div></div><div id="yui_3_16_0_ym19_1_1487414548429_58715"> </div><div class="signature" id="yui_3_16_0_ym19_1_1487414548429_60372">rgds<br>lixin</div></div></body></html>