[vtkusers] writing parallel files from a serial process

Jean Favre jfavre at cscs.ch
Fri Nov 21 04:48:11 EST 2008


John Vines (CISD/HPCD) wrote:
> All,
>    I have a large amount of data, a single file is approximately 10GB.
> The files were written in a serial format and I need to convert them
> to a parallel format, how could I do this in VTK?
you're not saying what type of data you have... I see two solutions:

1) if it is structured, all the vtkXMLP*Writer will do that on a serial
pipe.

for example:

int N = 4;
vtkXMLPImageDataWriter piw = vtkXMLPImageDataWriter::New();
piw->SetInputConnection(reader->GetOutputPort());
piw->SetFileName("/pathtofilename/file.pvti");
piw->SetNumberOfPieces(N);
piw->SetStartPiece(0);
piw->SetEndPiece(N-1);
piw->WriteSummaryFileOn();
piw->Write()

2) if is is unstructured, you need D3 to cut the data, and D3 needs a
parallel controller. I do not think you can do it with a serial process.

running pvpython with a parallel pvserver and executing the following
should do the job:

from paraview import servermanager as sm
sm.Connect("name") # with the name of your host running pvserver
reader = sm.sources.XMLUnstructuredGridReader(FileName="mesh.vtu")
d3 = sm.filters.D3()
d3.Input = reader
d3.BoundaryMode = 0 #Assign cells uniquely
writer = sm.writers.XMLPUnstructuredGridWriter(FileName="/tmp/umesh.pvtu")
writer.NumberOfPieces = 4
writer.Input = d3
writer.UpdatePipeline()

Jean --
Swiss National Supercomputing Center



More information about the vtkusers mailing list