<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><div>Hi,&nbsp;</div><div>I am trying to load a vector that I saved as PetscBinary file.&nbsp;</div><div>On a single processor, I have to put an initial PetscBinaryRead command &amp; put the subsequent reads in the loop. Then I get the correct answer. I don't understand why an initial PetscBinaryRead is required. Anyway, with this, the code works fine on single processor.</div><div><br></div><div>However, on multiple processors, the input file and the vector after reading are not in the same order. I think that somehow I have to pass the information to each processor as to which part of the binary file to read. Please tell me how to do this.</div><div><br></div><div>Thanks.</div><div><br></div><div>Khalid</div><div><br></div><div><br></div><div>Here is the
 code:</div><div><br></div><div><div>PetscViewerBinaryOpen(appctx-&gt;comm,"Pxbin_10.out",FILE_MODE_READ,&amp;viewer);</div><div>PetscViewerBinaryGetDescriptor(viewer,&amp;fd);</div><div>PetscBinaryRead(fd,header,1,PETSC_SCALAR);</div><div><br></div></div><div>&nbsp;for (k=zs; k&lt;zs+zm; k++) {</div><div>&nbsp;&nbsp;for (j=ys; j&lt;ys+ym; j++) {</div><div>&nbsp;&nbsp;for (i=xs; i&lt;xs+xm; i++) {</div><div>PetscBinaryRead(fd,header,1,PETSC_SCALAR);<br></div><div>&nbsp;&nbsp; &nbsp;u_localptr[k][j][i] = header[0];<br></div><div>&nbsp;&nbsp;}<br></div><div>&nbsp;&nbsp;}</div><div>&nbsp;&nbsp;}</div><div><br></div></div></div></body></html>