Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

TBB in Cython

velvia
Beginner
1,263 Views

Hi,

In order to write efficient code, we use a lot of Cython for our library. To make things parallel, one can use prange that under the hoods use OpenMP. I would like to know if any access to TBB from within Cython is planned in the Intel Python distribution?

Best regards,

Francois

0 Kudos
2 Replies
Preethi_V_Intel
Employee
1,263 Views

There is no TBB module to call from inside of Cython as of yet, Alternatively, you can override OpenMP by calling TBB in the command line when running the Python script that uses the complied code.

python -m TBB run.py

See here for more details on available options and flags on TBB.

0 Kudos
Anton_M_Intel
Employee
1,263 Views

Please note that `python -m tbb` helps only to switch MKL (Numpy) and Python threads on top of the TBB task scheduler. However, it does not help in the case of Cython's parallel module. This feature was always on my radar but I did not find enough justification since the packages we shipped did not use any parallelism from Cython. If there are enough users for this feature, we can start working on bringing TBB and composable threading in general to Cython. If you think Cython on top of TBB makes sense to you and you can describe the use case and possibly measure the potential gain, please write to me or to scripting at intel.com with this feature request.

Thanks!
Anton

0 Kudos
Reply