Will VTK ever be thread-safe for parallel use ?

(Arvin) #1

I’m looking for ways to parallelize VTK and there’s static data in VTK (the Executives classes in particular) that manage static data that can’t be called in parallel without corrupting the heap.

Also, I’ve noticed that the CPU usage goes from 70%-80% to single CPU - 12.5% once the VTK pipeline starts updating.

What is a good strategy to parallelize VTK? Does VTK use OpenMP to parallelize?

(Andras Lasso) #2

Filters within a pipeline don’t run in parallel but you can make each filter multi-threaded using vtkMultiThreader, various SMP backends (OpenMP or Intel TBB), or VTK-m). You can find several examples for all of them in the VTK source code.

Are you trying to update multiple pipelines in different threads? Are the pipelines completely independent or they share some inputs or outputs? What static members did you find to cause trouble?

(Arvin) #3

We have multiple independent pipelines, so if that could be multi-threaded, that would be great.

Calling Renderer::AddActor(), Update(), and SetInputConnection() must be protected by named OpenMP critical sections or it will crash. I believe that it’s because Update() uses the static vtkExecutive methods and data, which aren’t thread-safe.