<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">It is a 1D matrix in PETSc. I just passed it as a 2D matrix in ScaLAPACK. It is still a 1D matrix when get back into PETSc.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Jinquan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> petsc-users-bounces@mcs.anl.gov [mailto:petsc-users-bounces@mcs.anl.gov]
<b>On Behalf Of </b>Jed Brown<br>
<b>Sent:</b> Wednesday, August 08, 2012 2:27 PM<br>
<b>To:</b> PETSc users list<br>
<b>Subject:</b> Re: [petsc-users] Customizeing MatSetValuesBlocked(...)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">PETSc does NOT use a 2D partition. You need to get that concept out of your head.<o:p></o:p></p>
<div>
<p class="MsoNormal">On Wed, Aug 8, 2012 at 3:09 PM, Jinquan Zhong <<a href="mailto:jzhong@scsolutions.com" target="_blank">jzhong@scsolutions.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Satish,<br>
<br>
I looked at<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex5s.c.html" target="_blank">
http://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex5s.c.html</a><br>
where<br>
MatCreateAIJ(PETSC_COMM_WORLD,rend-rstart,rend-rstart,N,N,5,0,0,0,&J);<br>
<br>
was used to create J (N,N) with local J dimensioned as (rend-rstart,rend-rstart).<br>
<br>
For my application, I have LDA=LDB=3 and N=9 in the following<br>
<br>
ierr = MatCreateAIJ(PETSC_COMM_WORLD,LDA,LDB,N,N,LDA,0,0,0,&A); CHKERRQ(ierr);<br>
<br>
I got the following error message:<br>
<br>
[0]PETSC ERROR: --------------------- Error Message ------------------------------------<br>
[0]PETSC ERROR: Nonconforming object sizes!<br>
[0]PETSC ERROR: Sum of local lengths 27 does not equal global length 9, my local length 3<br>
likely a call to VecSetSizes() or MatSetSizes() is wrong.<br>
<br>
<br>
It does NOT appear PETSc had the 9x9 matrix. It tried to build 27*27 since I am using 9 procs. Is there a way to resolve this local size and global size issue?<br>
<br>
Thanks,<br>
<br>
Jinquan<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:petsc-users-bounces@mcs.anl.gov">petsc-users-bounces@mcs.anl.gov</a> [mailto:<a href="mailto:petsc-users-bounces@mcs.anl.gov">petsc-users-bounces@mcs.anl.gov</a>] On Behalf Of Satish Balay<br>
Sent: Wednesday, August 08, 2012 1:45 PM<br>
To: PETSc users list<br>
Subject: Re: [petsc-users] Customizeing MatSetValuesBlocked(...)<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">On Wed, 8 Aug 2012, Jed Brown wrote:<br>
<br>
> On Wed, Aug 8, 2012 at 2:25 PM, Jinquan Zhong <<a href="mailto:jzhong@scsolutions.com">jzhong@scsolutions.com</a>>wrote:<br>
><br>
> > If I understand you correctly, ScaLAPACK blocks don't have anything<br>
> > to do with the sparse matrix structure.****<br>
> ><br>
> > ** **<br>
> ><br>
> ><br>
> > ********************************************************************<br>
> > ********************************************************************<br>
> > **<br>
> > ****<br>
> ><br>
> > ** **<br>
> ><br>
> > You are correct. What I meant was how to define the diagonal and<br>
> > off-diagonal parts of each submatrix matrix A (LDA, LDB). For<br>
> > example, in the following matrix,****<br>
> ><br>
> > ** **<br>
> ><br>
> > *Proc0* *Proc1* *Proc2*****<br>
> ><br>
> > 1 2 0 | 0 3 0 | 0 4****<br>
> ><br>
> > *Proc0* 0 5 6 | 7 0 0 | 8 0****<br>
> ><br>
> > 9 0 10 | 11 0 0 | 12 0****<br>
> ><br>
> > -------------------------------------****<br>
> ><br>
> > 13 0 14 | 15 16 17 | 0 0****<br>
> ><br>
> > *Proc3* 0 18 0 | 19 20 21 | 0 0 <=== owned by Proc 5****<br>
> ><br>
> > 0 0 0 | 22 23 0 | 24 0****<br>
> ><br>
> > -------------------------------------****<br>
> ><br>
> > *Proc6* 25 26 27 | 0 0 28 | 29 0****<br>
> ><br>
> > 30 0 0 | 31 32 33 | 0 34****<br>
> ><br>
> > ** **<br>
> ><br>
> > I am not sure how to fill out the values for d_nz, d_nnz,o_nz, o_nnz<br>
> > peoperly for the subblock (0 0 ;0 0; 24 0) owned by Proc 5 since it<br>
> > was based on diagonal and off-diagonal parts.<br>
> ><br>
><br>
> Throw your 2D block cyclic nonsense out the window. These are sparse<br>
> matrices and that layout would be terrible. Logically permute your<br>
> matrices all you want, then define a global ordering and chunk it into<br>
> contiguous blocks of rows (no partition of columns). Work this out<br>
> with a pencil and paper. You should have a function that translates<br>
> row/column pairs from your ordering to our ordering. Now compute the<br>
> sparsity pattern in the new ordering. (Usually you can figure this out<br>
> on paper as well.) Then preallocate and call MatSetValues() with the new (row,column) locations.<br>
><br>
<br>
also check the 'example usage' at:<br>
<br>
<a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateAIJ.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateAIJ.html</a><br>
<br>
Satish<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>