Community
cancel
Showing results for 
Search instead for 
Did you mean: 
David_S_22
Beginner
68 Views

Python's GIL, non-numerical function performance, mixed packages?

Hi, I recently heard a great talk about the Intel Python distribution. I was wondering more about how Intel modifies the open source distribution of Python.

1) What is the relationship between Python's GIL and the Intel distribution?

It appears that the GIL is left alone, and that, where possible, Intel libraries are substituted? I read that for the ThreadPool class. But, I'm not sure overall :).  https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/623435 

2) Are there any issues or design considerations when mixing Intel-optimized packages?

I started reading about some concerns here: https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/631381

Like how would multi-threading work if someone called Intel optimized scipy and numpy packages using the ThreadPool class since the Intel-optimized packages will be using TBB with MKL anyways?

3) Will I see performance gains in Intel's Python distribution without using numerical packages? For example, related to #1 and my overall curiousity to how the OSS version of Python is modified, is IPP implemented in the standalone distribution?

Thank you for your time and consideration!

David

0 Kudos
1 Reply
Anton_M_Intel
Employee
68 Views

Hi David,

Regarding 1, GIL works as usual in Python. Numpy and other libraries release GIL before calling into compute-intensive code - this is how parallelism works in Python - only when there is no Python code running. But this is pretty much enough to achieve good speedups with compute-intensive applications.

The ThreadPool class is substituted only when you specify so by calling python with -m TBB key or working with TBB module directly. But in any way, it is not very related to the issue of GIL. TBB solves different problem of over-subscription with nested parallelism. It happens when e.g. you use Dask.Array library which creates parallel tasks using ThreadPool and each task calls Numpy inside. Numpy also works in parallel thanks to Intel MKL implementation. Thus, two levels of parallelism might interfere badly - this is solved by TBB.