[Paraview-developers] VTK_NO_PYTHON vs VTK_PYTHON_FULL_THREADSAFE
Mathieu Westphal
mathieu.westphal at kitware.com
Fri Sep 2 02:44:28 EDT 2016
Hello
you may have noticed, the option is not VTK_NO_PYTHON, but
VTK_NO_PYTHON_THREAD
When this option is true, all python threading is disabled, and all python
related method are executed in one and only thread, no python thread
support.
If this option is false, a new option appear, VTK_PYTHON_FULL_THREADSAFE.
VTK_NO_PYTHON_THREAD false and VTK_PYTHON_FULL_THREADSAFE false is
basically the standard way to compile VTK with python.
If you pass VTK_PYTHON_FULL_THREADSAFE to true, then each and every call to
python will be protected with GIL [1], ensuring that you can have eg. other
python interpreter in your application
and still use python wrapping in vtk. Very usefull option for specific
usage but quite an overhead for people that have no use for it and only use
python inside VTK.
on a side note, The logic in vtkPython.h is quite complicated because even
without VTK_PYTHON_FULL_THREADSAFE, we sometimes needs to protect the
python call with gil anyway, hence the "FULL" in the option name.
I hope it is more clear now.
Regards,
Mathieu Westphal
[1] : https://en.wikipedia.org/wiki/Global_interpreter_lock
Mathieu Westphal
On Thu, Sep 1, 2016 at 5:58 PM, Chris Harris <chris.harris at kitware.com>
wrote:
> Can someone clear up what these two CMake options are for? It seems the
> ParaView has VTK_PYTHON_FULL_THREADSAFE as a dependant option that can only
> be enable if VTK_NO_PYTHON is off.
>
> I am asking because I would like to know which should be used to
> selectively compile GIL locks and releases.
>
> It seems that VTK_NO_PYTHON is used here:
>
> https://github.com/Kitware/VTK/blob/master/Utilities/
> Python/vtkPython.h#L107-L112
>
> and
>
> VTK_PYTHON_FULL_THREADSAFE is used here:
>
> https://github.com/Kitware/VTK/blob/master/Utilities/
> Python/vtkPython.h#L131-L134
>
>
> It seems the VTK_PYTHON_FULL_THREADSAFE was added relatively recently.
>
> Thanks,
>
>
> Chris
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=
> Paraview-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20160902/4fc4cc0f/attachment.html>
More information about the Paraview-developers
mailing list