I'm trying to parallelise processing of large datasets in VTK using its Python interface. For that, I want to use joblib since I have a (large) number of independent snapshots that I want to process and gather in a large numpy matrix, i.e. something like:
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
for i,snap in enumerate(snapshot_list):
myVtkFilter.SetInputData(snap)
result = myVtkFilter.GetOutput()
output[i, :] = dsa.WrapDataObject(result).CellData['myArray']
However, I'm facing some issues:
I'm using Python 3.7.3 with VTK 8.1.2. Any suggestions?
There was some issue with the GIL in VTK 8.2.0, they have been fixed here: https://gitlab.kitware.com/paraview/paraview/-/issues/14169 and the fix is present in VTK 9.0.1.
Update to VTK 9.0.1 and use the VTK_PYTHON_FULL_THREADSAFE=ON CMake option to fix your problem.