Most efficient way to transfer a vector to a single processor
I'm interested in moving a vector to a single processor (so I can output it in some custom way), but I can't find a simple way to do that. Is the easiest way to output the parallel vector to a file and then read it in to a single processor vector? Also, an unrelated question: If I have a vector that I'm using as the result of a matrix vector product, but it is initially empty, do I need to initialize it in any way? or can I just create it and run with it: … create x and A ... VecCreate(world, &b); MatGetVecs(A,&x,&b); … do stuff with x and A ... MatMult(A,x,b); Thanks for the help, -Andrew
On Wed, Apr 4, 2012 at 4:47 PM, Andrew Spott <[email protected]> wrote:
I'm interested in moving a vector to a single processor (so I can output it in some custom way), but I can't find a simple way to do that.
Is the easiest way to output the parallel vector to a file and then read it in to a single processor vector?
http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/VecScatterCreate...
Also, an unrelated question: If I have a vector that I'm using as the result of a matrix vector product, but it is initially empty, do I need to initialize it in any way? or can I just create it and run with it:
… create x and A ... VecCreate(world, &b);
This create is wrong, that Vec will be overwritten.
MatGetVecs(A,&x,&b);
You can jsut use these vectors. Matt
… do stuff with x and A ...
MatMult(A,x,b);
Thanks for the help,
-Andrew
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
participants (2)
-
Andrew Spott -
Matthew Knepley