LoadState in parallel

Hello,
I am looking to parallelize a script that loads multiple state files with different simulation results: Replace a variable when LoadState()

What is the correct approach to open multiple sessions in pvpython? I was looking into servermanager.Connect() and servermanager.LoadState(), but the ladder lacks arguments provided by paraview.simple.LoadState() which are statefile and data_directory.

Thank you.

Hi @madmoonman

The best way is to use pvbatch

https://docs.paraview.org/en/latest/Tutorials/ClassroomTutorials/pythonAndBatchPvpythonAndPvbatch.html

1 Like

Just wanted to report back here. Thanks for suggesting pvbatch, Mathieu.

I went on another path, building a main function that triggers subprocesses via the python multiprocessing package and then within each subprocess I run a function that imports paraview.simple on its own. This gives me parallel execution without changing any of my code. Sorry, I was a bit too lazy to look into pvbatch :slight_smile: