<div dir="ltr"><div><div><div><div>Hi<br><br></div>All python calls are protected by gil if the VTK_PYTHON_FULL_THREADSAFE option is on.<br></div>The mechanism take place in vtkPython.h, where the vtkPythonScopeGilEnsurer is configured by the cmake option.<br></div>the vtkPythonScopeGilEnsurer is then ( suposed to be ) used before every pthon call.<br><br></div>Regards,<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mathieu Westphal<br></div></div></div>
<br><div class="gmail_quote">On Thu, Sep 8, 2016 at 1:23 PM, Paul Melis <span dir="ltr"><<a href="mailto:paul.melis@surfsara.nl" target="_blank">paul.melis@surfsara.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
What's the status of threading in VTK 7.0.0 under Python w.r.t the GIL,<br>
specifically for classes derived from vtkAlgorithm?<br>
I'm attempting to offload a computation (basically vtkStreamTracer.Update())<br>
to a Python threading.Thread, but strongly get the impression that<br>
the GIL is not released by Update().<br>
<br>
The release notes (<a href="https://blog.kitware.com/vtk-7-0-0/" rel="noreferrer" target="_blank">https://blog.kitware.com/vtk-<wbr>7-0-0/</a>) seem to suggest<br>
there was some recent development in this area:<br>
<br>
* multi-threaded Python codes facilitated by VTK's new and optional<br>
protocol for using the Global Interpreter Lock<br>
<br>
But clicking the link appears to indicate this is for VTK used inside<br>
Paraview only. I see the mentioned cmake variable VTK_PYTHON_FULL_THREADSAFE<br>
referenced by files under Utilities/Python, but the cmake files themselves<br>
don't contain a reference, nor something like an option. Would hacking<br>
the define in somewhere cause Update() to be protected by the GIL?<br>
Commit <a href="https://github.com/Kitware/VTK/commit/8eb50dd23fd762d42fe1a6785bbaa704f2ed76c3" rel="noreferrer" target="_blank">https://github.com/Kitware/<wbr>VTK/commit/<wbr>8eb50dd23fd762d42fe1a6785bbaa7<wbr>04f2ed76c3</a><br>
lists some classes and their possible protection by vtkPythonScopeGilEnsurer,<br>
but what specifically is covered isn't entirely clear to me.<br>
<br>
Thanks,<br>
Paul<br>
<br>
--<br>
<br>
Paul Melis<br>
| Visualization group leader & developer | SURFsara |<br>
| Science Park 140 | 1098 XG Amsterdam |<br>
| T 020 800 1312 | <a href="mailto:paul.melis@surfsara.nl">paul.melis@surfsara.nl</a> | <a href="http://www.surfsara.nl" rel="noreferrer" target="_blank">www.surfsara.nl</a> |<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>