<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 4, 2008, at 11:22 AM, Yujie wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dear Barry:<br><br>That is, if one wants to generate different sub-matrices at different nodes of the cluster from the same matrix, only MatGetSubMatrices() is available?</blockquote><div><br class="webkit-block-placeholder"></div> Yes<br><blockquote type="cite"><br><br>If I use MatDistribute_MPIAIJ to convert a sequential matrix to parallel one, how to control which nodes of the cluster the submatrix of the parallel matrix is distributed into? For example, in a cluster, there are 10 nodes, I only want to use the specified 5 nodes for <br> distributing the matrix. thanks a lot.</blockquote><div><br class="webkit-block-placeholder"></div> That is the comm argument to the function. In PETSc all objects are laid out on an MPI_Comm, thus </div><div>using subsets of nodes for various objects is very easy, just create the appropriate MPI_Comm and use </div><div>it to create the object.</div><div><br class="webkit-block-placeholder"></div><div> Barry</div><div><br><blockquote type="cite"><br><br>Regards,<br>Yujie<br><br><br> <span class="gmail_quote">On 3/4/08, <b class="gmail_sendername">Barry Smith</b> <<a href="mailto:bsmith@mcs.anl.gov" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">bsmith@mcs.anl.gov</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex"> <br> On Mar 4, 2008, at 1:47 AM, Yujie wrote:<br><br> > Hi, everyone<br> ><br> > #include "petscmat.h"<br> > PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrix(Mat mat,IS<br> > isrow,IS iscol,PetscInt csize,MatReuse cll,Mat *newmat)<br> > #include "petscmat.h"<br> > PetscErrorCode PETSCMAT_DLLEXPORT MatGetSubMatrices(Mat mat,PetscInt<br> > n,const IS irow[],const IS icol[],MatReuse scall,Mat *submat[])<br> ><br> > To my knowledge, I can't get different matrices at different nodes<br> > by setting different isrows and iscol with MatGetSubMatrix().<br> > Because isrow is rows current processor should obtain and the iscol<br> > argument must be the same on each processor.<br> > Furthermore, I can't get different parallel matrices at different<br> > nodes by setting different irow[] and icolp[] with<br> > MatGetSubMatrices() assuming I only want to get a matrix at each node.<br> > Because this function only gets different sequential matrices at<br> > different nodes. Is it right?<br> ><br><br> MatGetSubMatrices() gets one or more sequential matrix on each<br> process.<br> MatGetSubMatrix() gets ONE parallel matrix that lives on the same<br> communicator has the original matrix<br><br><br> > Another equestion is how to partition the matrix when calling<br> > MatConvert() to convert a sequential matrix to a parallel one?<br><br><br> MatConvert() is not for converting sequential matrix to parallel;<br> the communicator of a the new matrix from MatConvert()<br> is always the same as the old one.<br> <br> In petsc-dev there is a utility for AIJ matrices that takes a<br> given sequential AIJ matrix and makes it parallel, called<br><br> /*<br> Distributes a SeqAIJ matrix across a set of processes. Code<br> stolen from<br> MatLoad_MPIAIJ(). Horrible lack of reuse. Should be a routine for<br> each matrix type.<br><br> Only for square matrices<br> */<br> PetscErrorCode MatDistribute_MPIAIJ(MPI_Comm comm,Mat gmat,PetscInt<br> m,MatReuse reuse,Mat *inmat)<br> <br><br><br> Barry<br><br><br><br> ><br> ><br> > Thanks a lot.<br> ><br> > Regards,<br> > Yujie<br><br></blockquote><br></blockquote></div><br></body></html>