[SciPy-user] dual core scipy in windows (signal.lsim2)
kxroberto at googlemail.com
Mon Nov 27 13:27:46 CST 2006
A. M. Archibald wrote:
> On 25/11/06, Ryan Krauss <ryanlists at gmail.com> wrote:
>> I am running a python script that is taking 10-15 seconds to run a
>> signal.lsim2 command (the number of steps I am asking for is fairly
>> high). I am fairly certain that lsim2 is mainly using ode routines in
>> FORTRAN. I am running this script on windows right now and noticed
>> that when I look at the task manager performance indicator, python is
>> using only 50% of my cpu. I think this is because it is using only
>> one core of my dual core processor. Is there an easy way to take
>> better advantage of dual core processors with scipy in Windows? Is
>> the situation much different in Linux (Ubuntu)?
> On most hardware that offers parallel processing (such as dual-core
> machines), programs need to be explicitly written to take advantage of
> multiple processors. Normally if you write a program as a series of
> instructions to be executed one after the other (that is, the normal
> way) they will happen one after the other on one of the processors.
> Essentially, you need to tell the machine "it's okay to do these two
> things at once".
> There are various techniques for taking advantage of multiple
> processors, including running several programs at once, using python's
> threads to do several tasks at once, or using MPI to spread the
> computing work over several machines. But all of them require some
> special programming on your part to take advantage of the second core
> your machine has.
> If the only slow operation in your program is a single call to lsim2,
> you probably can't. But if, for example, you wanted to call it a
> hundred times with a hundred different inputs, you could quite happily
> use python's threads to run two (or more) at once.
Only few numpy/scipy funcs release the GIL (a thread state switch is expensive). Does lsim2 really do so ?
More information about the SciPy-user