[petsc-users] Vec I/O using different parallel layout

Barry Smith bsmith at mcs.anl.gov
Mon Oct 10 19:36:47 CDT 2011


On Oct 10, 2011, at 7:31 PM, Mohamad M. Nasr-Azadani wrote:

> Hi, 
>  
> I was wondering if it would be possible if I write a global vector (associated with a certain 3D distributed array)  to file 
> via: 
> 
>             ierr = PetscViewerBinaryOpen(PCW1, filename, FILE_MODE_WRITE, &writer);
>             ierr = VecView(vec_data, writer);
>             ierr = PetscViewerDestroy(writer);
> 
> And then load the data into a global vector which is not created using the same parallel layout? 
> A simple example for this case would be to write the runtime data (parallel vector) to file and then just load the saved vector to do some simple SERIAL post processing. 

  YES.

   The vector is saved to the file in the "natural ordering" that is starting with the logically 0,0,0 coordinate then increasing through the x axis, then the y axis then the z axis. To load back in in parallel you need to pass to VecLoad() a vector obtained with the appropriate DMCreateGlobalVector().


  Barry

> 
> Thanks in advance, 
> Best
> Mohamad
> 
> 
> 
> 



More information about the petsc-users mailing list