# Enabling Python thread support by default

**URL:** https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61
**Category:** Development
**Tags:** python
**Created:** [June 1, 2018, 4:27pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61 "2018-06-01T16:27:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [June 1, 2018, 4:27pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/1 "2018-06-01T16:27:04Z")

</div>

Folks,

We have two CMake variables, **VTK\_NO\_PYTHON\_THREADS** and **VTK\_PYTHON\_FULL\_THREADSAFE**. These are defaulted so that we don’t use GIL locking in ParaView builds by default. I am wondering if we should indeed enable Python thread support so that programmable filters can be written that use `threading` and other thread-based async features in Python.

Can anyone think of reasons why we shouldn’t?

---

<div class="post-metadata">

### Author: ![shawn.waldon](https://discourse.paraview.org/user_avatar/discourse.paraview.org/shawn.waldon/32/12_2.png) [@shawn.waldon](https://discourse.paraview.org/u/shawn.waldon)
#### Post date: [June 1, 2018, 5:12pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/2 "2018-06-01T17:12:49Z")

</div>

Tomviz uses these options to force GIL locking in ParaView. A while ago I tried to set up a ParaView dashboard with these enabled, but there were some test failures I didn’t have time to solve at the time.

+1 from me for making these default

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [June 1, 2018, 5:16pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/3 "2018-06-01T17:16:09Z")

</div>

good to know. thanks!

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [June 1, 2018, 6:04pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/4 "2018-06-01T18:04:14Z")

</div>

+1

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 4, 2018, 8:52am UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/5 "2018-06-04T08:52:35Z")

</div>

Well, using the GIL does have a small overhead for each python call, and that is why I did not enable it by default when I added the option.

Maybe a small performance check would be needed before putting this into the release.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [June 4, 2018, 2:04pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/6 "2018-06-04T14:04:03Z")

</div>

> a small overhead for each python call

We should not be making too many C+±2-Python calls in tight data processing loops, so that’s not a major concern. C+±2-Python path if often only for “plumbing”, setting up the pipeline, etc.

There is a separate issue where pvpython doesn’t seem to exit gracefully. I’ll track that down in time.

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave_demarle/32/27_2.png) [@Dave\_DeMarle](https://discourse.paraview.org/u/Dave_DeMarle)
#### Post date: [August 12, 2018, 6:23pm UTC](https://discourse.paraview.org/t/enabling-python-thread-support-by-default/61/7 "2018-08-12T18:23:29Z")

</div>

I thought we turned GIL off at the PV 5.0 transition because GIL was incompatible with some high profile python libraries? If my recollection is correct and that is still the case we still don’t want it on by default.
