Grok the GIL (opensource.com)
Grok the GIL (opensource.com)
Posted Apr 21, 2017 11:20 UTC (Fri) by kigurai (guest, #85475)In reply to: Grok the GIL (opensource.com) by quietbritishjim
Parent article: Grok the GIL (opensource.com)
Sometimes you have a library function that does the computations in C (fast) but you need to run it on a shitload of data, and the library itself is not built for that.
Today you solve that by e.g. multiprocessing.Pool() but if the data you are operating on is large, or not picklable, then you either can't, or at least have to write quite complicated boilerplate code to share the data somehow.
Thus I would really love to instead be able to use a pool of threads that can all freely share the data I have already loaded, which is of course impossible as long as the GIL remains.
Posted Apr 21, 2017 15:46 UTC (Fri)
by khim (subscriber, #9252)
[Link] (2 responses)
Posted Apr 21, 2017 15:51 UTC (Fri)
by Sesse (subscriber, #53779)
[Link] (1 responses)
Posted Apr 22, 2017 18:45 UTC (Sat)
by khim (subscriber, #9252)
[Link]
Yup. Think TensorFlow. Highly-optimized C++ code with threading pools and everything, 99% of CPU time is spent there. 1% is spent in linear (because if GIL) python “driver”. Now think about “monster desktop” with two Monster Xeons. 96 threads, add Amdahl's law and... vila: almost half of wall-clock time is spent in python! Still think GIL is “not a big deal if core of your toolboox is in C++”?
Grok the GIL (opensource.com)
Grok the GIL (opensource.com)
Grok the GIL (opensource.com)