[vtkusers] VTK 7.0.0 + Python: GIL released?

Paul Melis paul.melis at surfsara.nl
Thu Sep 8 07:23:46 EDT 2016


Hi all,

What's the status of threading in VTK 7.0.0 under Python w.r.t the GIL,
specifically for classes derived from vtkAlgorithm?
I'm attempting to offload a computation (basically vtkStreamTracer.Update())
to a Python threading.Thread, but strongly get the impression that
the GIL is not released by Update(). 

The release notes (https://blog.kitware.com/vtk-7-0-0/) seem to suggest
there was some recent development in this area:

* multi-threaded Python codes facilitated by VTK's new and optional 
  protocol for using the Global Interpreter Lock
    
But clicking the link appears to indicate this is for VTK used inside
Paraview only. I see the mentioned cmake variable VTK_PYTHON_FULL_THREADSAFE
referenced by files under Utilities/Python, but the cmake files themselves
don't contain a reference, nor something like an option. Would hacking
the define in somewhere cause Update() to be protected by the GIL?
Commit https://github.com/Kitware/VTK/commit/8eb50dd23fd762d42fe1a6785bbaa704f2ed76c3
lists some classes and their possible protection by vtkPythonScopeGilEnsurer,
but what specifically is covered isn't entirely clear to me.

Thanks,
Paul

-- 

Paul Melis
| Visualization group leader & developer | SURFsara |
| Science Park 140 | 1098 XG Amsterdam |
| T 020 800 1312 | paul.melis at surfsara.nl | www.surfsara.nl |


More information about the vtkusers mailing list