<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div>Hello,<br><br>I have successfully installed a <span id="misspell-0"><span>sequential</span></span> PETSc's linear solver in a sequential program. The matrix has been created in CSR format and it was passed to  MatCreateSeqAIJWithArrays (instead of using MatSetValues). <br><br>Now I want to use a parallel PETSc solver in the same sequential program, and use the same CRS matrix mentioned above. I intend to use MatCreateMPIAIJWithArrays, since I hope to pass the array direct to PETSc, instead of using MatSetValues. There a few questions:</div><div> </div><div>1. Is there a sample code for using MatCreateMPIAIJWithArrays?</div><div>2. There seems to be a subroutine MatDistribute_MPIAIJ, but it is not in the PETSc manual. Where can I get the instruction how to use
 it? It would be nice if there is a sample code available.<br>3. Manual says the matrix will be copied by MatCreateMPIAIJWithArrays into internal format (while it is not when using MatCreateSeqAIJWithArrays), does this mean I have to call MatMPIAIJSetPreallocation first?</div><div>4. In sample code ex2.c in the manual, both MatMPIAIJSetPreallocation and MatSeqAIJSetPreallocation are called to preallocate the matrix A. Is not the first subroutine sufficient?  </div><div> </div><div>Many thanks for your help.</div><div> </div><div>Regards,</div><div>Qin</div></div></body></html>