<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi, all<br><br></div>I am confused about my code, for it could return right answer when I use 1 process, but return totally wrong answer when more than 1 process.<br>
<br>This is how I feed data to it. <br><br>I have a CSR matrix, represented by Ap(pointer),Ai(index),and temp(data).<br><br>First determine local matrix for each process. Then feed data to them.<br> <br> int temprank,localsize,line_pos;<br>
line_pos = 0;<br> if(rank == 0)<br> { <br> localsize = size/pro + ((size % pro) > rank);<br> } <br> else<br> {<br> for (temprank = 0;temprank <rank;temprank++)<br> { <br>
localsize = size/pro + ((size % pro) > temprank);<br> line_pos += localsize;<br> }<br> }<br><br> Lin_index = new int [localsize+1];<br> for(i=0;i<localsize+1;i++)<br> {<br>
Lin_index [i] = Ap[line_pos+i]-Ap[line_pos];<br> }<br> std::cerr<<"line_pos "<<line_pos<<"\n";<br></div><div> MatMPIAIJSetPreallocationCSR(A,Lin_index,Ai+line_pos,temp+line_pos);<br>
<br></div><div>I use spectral transform with MATSOLVERMUMPS to calculate eigenvalue.<br></div><br></div><div><br></div>The strange thing is, when I run it with one process, the eigenvalue is what I want, typically, <br> (8.39485e+13,5.3263) (3.93842e+13,-82.6948) first two.<br>
</div>But for 2 process:<br>eigenvalue (2.76523e+13,7.62222e+12)<br>eigenvalue (2.76523e+13,-7.62222e+12)<br><br></div>3 process:<br>eigenvalue (6.81292e+13,-3071.82)<br>eigenvalue (3.49533e+13,2.48858e+13)<br>
<br>4<br>eigenvalue (9.7562e+13,5012.4)<br>eigenvalue (7.2019e+13,8.28561e+13)<br><br></div>However, it could pass simple test like<br></div> int n = 12;<br> int nz = 12;<br> int Ap[13] = {0,1,2,3,4,5,6,7,8,9,10,11,12};<br>
int Ai[12] = { 0,1,2,3,4,5,6,7,8,9,10,11};<br> double Ax[12] = {-1,-2,-3,-4,-5,6,7,8,9,10,11};<br> double Az[12] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0,0,0,0};<br><br><br></div>Do you have any idea about it?<br><br>
</div>Thanks a lot!!<br><br></div><div><div><div><div><div><div><div><br></div></div></div></div></div></div></div></div>