<div dir="ltr">Hi, <div><br></div><div>I know how to define groups and communicators in MPI.</div><div><br clear="all"><div>1.   My question is how can I define matices on small communicators (not MPI_COMM_WORLD)?</div><div>I tried something like this but does not work:</div><div><br></div><div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">    for (int i=0; i<6; i++) {</font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">          MatCreate(comm1,&general_detM[i]);</font></span></div><div><span style="color:rgb(0,0,255)">          MatSetSizes(general_detM[i],PETSC_DECIDE,PETSC_DECIDE, General_Dofs, General_Dofs);</span><br></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">          MatSetFromOptions(general_detM[i]);</font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">          MatMPIAIJSetPreallocation(general_detM[i],300,NULL,300,NULL);</font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">          MatSeqAIJSetPreallocation(general_detM[i],600,NULL);</font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">          MatSetOption(general_detM[i], MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);   //to extend the preallocatted memory for more values</font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff">    }</font></span></div></div><div><span style="background-color:rgb(255,255,255)"><font color="#0000ff"><br></font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#000000">If I change </font></span><span style="color:rgb(0,0,255)">MatCreate(comm1,&general_detM[i]) </span><font color="#000000">to</font><span style="color:rgb(0,0,255)"> </span><span style="color:rgb(0,0,255)">MatCreate(MPI_COMM_WORLD,&general_detM[i]), </span><font color="#000000">the code works.</font></div><div><font color="#000000"><br></font></div><div><br></div><div><font color="#000000">2. Also, there is one more question, how can I use MatSetValues to insert values to a matrix not based on MPI_COMM_WORLD?</font></div><div><font color="#000000"><br></font></div><div><span style="color:rgb(0,0,0)">Can anyone help me on this? Thank you very much!</span><br></div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><font size="1" color="#9900ff">Fangbo Wang, PhD student</font></div><div><font size="1" color="#9900ff">Stochastic Geomechanics Research Group</font></div><div><span style="color:rgb(153,0,255);font-size:x-small">Department of Civil, Structural and Environmental Engineering</span></div><div><font size="1" color="#9900ff">University at Buffalo</font></div><div><font size="1" color="#9900ff">Email: <u><a href="mailto:fangbowa@buffalo.edu" target="_blank">fangbowa@buffalo.edu</a></u></font></div></div></div></div></div>
</div></div>