[英]Python, VTK and GIL release
I'm trying to parallelise processing of large datasets in VTK using its Python interface.我正在尝试使用其 Python 接口并行处理 VTK 中的大型数据集。 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, ie something like:为此,我想使用 joblib,因为我有(大量)独立快照,我想在一个大型 numpy 矩阵中处理和收集这些快照,例如:
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.我正在使用 Python 3.7.3 和 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. VTK 8.2.0 中的 GIL 存在一些问题,它们已在此处修复: https://gitlab.kitware.com/paraview/paraview/-/issues/14169并且修复程序存在于 VTK 9.0.1 中。
Update to VTK 9.0.1 and use the VTK_PYTHON_FULL_THREADSAFE=ON CMake option to fix your problem.更新到 VTK 9.0.1 并使用 VTK_PYTHON_FULL_THREADSAFE=ON CMake 选项来解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.