Using SaveData multiple times, in parallel with pvbatch

Hello everyone,

I try to use pvbatch to optimize my post-processing. To be short, I have a dataset that contains the coordinates of many points. I have created many “subdomains” i.e. blocks, for example here 125 blocks, by using “extractCellsByRegion” filter, and I count the number of points existing in each “extractCellsByRegion”.

To store the data in each timestep, I want to use “SaveData” for each “extractCellsByRegion”, in which any MPI rank takes the responsibility of writing the data for each block. I realized that only one rank performs the “SaveData” job, and the rest of the ranks do nothing for their SaveData.

How can I say to pvbatch to run in parallel and get output from other ranks?

Many thanks in advance for your help.
Regards,
Mohammad


Pseudo code: is written in the simplest form for only two ranks:

from paraview.simple import *
import os, sys
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

if rank == 0:
SaveData(’/home/user/Desktop/prj_1/c’+str(i+1)+’.csv’, proxy=extractCellsByRegion1, WriteTimeSteps=100,
Filenamesuffix=’%d’,
ChooseArraysToWrite=1,
PointDataArrays=[],
CellDataArrays=[],
FieldDataArrays=[],
VertexDataArrays=[],
EdgeDataArrays=[],
RowDataArrays=[],
Precision=5,
UseScientificNotation=0,
FieldAssociation=‘Point Data’,
AddMetaData=1,
AddTime=0)
elif rank == 1:
SaveData(’/home/user/Desktop/prj_1/d’+str(i+1)+’.csv’, proxy=extractCellsByRegion2, WriteTimeSteps=100,
Filenamesuffix=’
%d’,

elif rank …

P.S. I included the following piece of code in the python script and it outputs correctly.
if rank == 0:
print(“First rank”)
elif rank == 1:
print (“Second rank”)
elif rank == 2:
print (“Third rank”)