[英]Multithreading with vtkSMPTools
I want to use vtkSMPTools
to run my backend parallel (Python).我想使用vtkSMPTools
并行运行我的后端 (Python)。 Sample code is as follows:示例代码如下:
import vtk
# Create an instance of vtkSMPTools
smpTools = vtk.vtkSMPTools()
# Use the For method to iterate over a range of indices in parallel
def func(i):
# Code to execute in parallel goes here
print(i)
smpTools.For(0, 100, func)
However, I am getting an error as follows: vtkmodules.vtkCommonCore.vtkSMPTools' object has no attribute 'For'
.但是,我收到如下错误: vtkmodules.vtkCommonCore.vtkSMPTools' object has no attribute 'For'
。
I have checked the vtk documentation and can see For
method is defined for vtkSMPTools.我检查了 vtk 文档,可以看到为 vtkSMPTools 定义了For
方法。
I am unable to figure out what is the issue.我无法弄清楚是什么问题。 Please help me with this.请帮我解决一下这个。
I am able to import vtk.vtkSMPTools()
.我能够导入vtk.vtkSMPTools()
。 However, error comes when I am trying to use the For
method.但是,当我尝试使用For
方法时出现错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.