saving parallel vectors
Satish Balay
balay at mcs.anl.gov
Thu Nov 23 22:47:11 CST 2006
To complete your query - you'll also need a Vec with the same
communicator - i.e PETSC_COMM_SELF - for your approach to work. One
way to do this is:
VecGetArray(vec,&v)
VecGetLocalSize(vec,size)
VecCreateSeqWithArray(MPI_COMM_SELF,size,v,&seqvec)
VecView(seqvec,seqviewer)
VecDestroy(seqvec)
VecRestoreArray(vec,&v)
Satish
On Thu, 23 Nov 2006, Barry Smith wrote:
>
> NEVER use ascii for large data sets. Use the binary viewer to save
> them. See PetscViewerBinaryOpen().
>
> Barry
>
>
> On Thu, 23 Nov 2006, Matteo Semplice wrote:
>
> > This is really a newbie question but I am struggling to solve out of memory
> > troubles on my first processor.
> >
> > I have a parallel global vector, say v, that I obtain with a call to
> > DAGetGlobalVector. I save it to disk opening an ASCII standard viewer on
> > PETSC_COMM_WORLD and calling VecView. As I understand from the manual, this
> > causes all processors to send their data to the first one and this one writes
> > them to disk. This works fine for small computational grids, but hangs my
> > program if the grid is bigger.
> >
> > I am thinking to get each processor to write its own file and reassemble the
> > data at the end of the program. I tried to create the viewer with the
> > communicator PETSC_COMM_SELF and issue VecView. I get as many files as
> > processors, but the first one contains all the data and the others are empty!
> >
> > Why? And, more importantly, what's the best way to achieve my goal?
> >
> > Thanks a lot.
> >
> > Matteo
> >
> >
>
>
More information about the petsc-users
mailing list