# How use open mp with opefhe python

**URL:** <https://openfhe.discourse.group/t/how-use-open-mp-with-opefhe-python/1832>\
**Category:** Library Questions\
**Created:** [January 14, 2025, 10:25am UTC](https://openfhe.discourse.group/t/how-use-open-mp-with-opefhe-python/1832 "2025-01-14T10:25:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradeep508](https://avatars.discourse-cdn.com/v4/letter/p/e19adc/32.png) [@pradeep508](https://openfhe.discourse.group/u/pradeep508)\
**Post date:** [January 14, 2025, 10:25am UTC](https://openfhe.discourse.group/t/how-use-open-mp-with-opefhe-python/1832/1 "2025-01-14T10:25:38Z")

</div>

Can you please provide simple example like binary gate parallelization?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [January 14, 2025, 5:50pm UTC](https://openfhe.discourse.group/t/how-use-open-mp-with-opefhe-python/1832/2 "2025-01-14T17:50:47Z")

</div>

OpenMP is used internally within OpenFHE to parallelize low-level functionalities. This parallelization is automatically enabled if you build OpenFHE with OpenMP support, which is the default build configuration.

If you intend to write multi-threaded code in Python, you should explore Python’s multi-threading libraries such as `threading` for e.g. to parallelize your Python code.

Finally, if you decide to write multi-threaded code at the application level (your Python code), it is advisable to disable OpenMP in the `openfhe-development` build to avoid excessive thread creation and potential system resource contention.

---

<div class="post-metadata">

**Author:** ![drssdinblck](https://avatars.discourse-cdn.com/v4/letter/d/94ad74/32.png) [@drssdinblck](https://openfhe.discourse.group/u/drssdinblck)\
**Post date:** [September 30, 2026, 7:30pm UTC](https://openfhe.discourse.group/t/how-use-open-mp-with-opefhe-python/1832/3 "2026-09-30T19:30:43Z")

</div>

But can you get true parallelism on the application level in Python? As far as I know, Python has a global interpreter lock that only allows you to run one kernel-level thread per interpreter instance. Is there a way around it?
