can multi-core improve single funciton?

Aahz aahz at pythoncraft.com
Sat Feb 21 12:45:25 EST 2009


In article <hfWdnTzVR8UNnwLUnZ2dnUVZ_uOWnZ2d at posted.visi>,
Grant Edwards  <invalid at invalid> wrote:
>On 2009-02-20, Aahz <aahz at pythoncraft.com> wrote:
>> Steven D'Aprano  <steven at REMOVE.THIS.cybersource.com.au> wrote:
>>>
>>> As I understand it, there's very little benefit to multi-cores in
>>> Python due to the GIL.
>>
>> As phrased, your statement is completely wrong.  Here's a more
>> correct phrasing: "For threaded compute-bound applications written
>> in pure Python, there's very little benefit to multiple cores." But
>> threaded I/O-bound applications do receive some benefit from multiple
>> cores, and using multiple processes certainly leverages multiple
>> cores.  If boosting the performance of a threaded compute-bound
>> application is important, one can always write the critical parts in
>> C/C++.
>
>Do the crunchy bits of scipy/numpy, scientific python, vtk and other
>compute-intensive libraries tend to release the GIL while they're busy
>"computing"?
>
>[Perhaps using them doesn't count as "pure Python", but...]

They definitely do not count as pure Python -- but I probably should have
mentioned that there are pre-existing libraries that can be used.  It's
just that I/O is about the only area where there is a concerted effort to
ensure that GIL gets released.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-list mailing list