Probe() uses 100% CPU

102 views
Skip to first unread message

Thomas Robitaille

unread,
Oct 22, 2009, 2:32:47 PM10/22/09
to mpi4py
Hi,

I have a call to Probe in my python script:

comm.Probe(source=MPI.ANY_SOURCE, tag=MPI.ANY_TAG,
status=status)

But this takes up 100% of the CPU power while waiting for a message.
Is this normal? If so, are there alternatives that take up less CPU?

Thanks,

Thomas

Steve McMillan

unread,
Oct 22, 2009, 3:26:51 PM10/22/09
to mpi...@googlegroups.com
If I am concerned about CPU usage in a situation like this, I usually
use iprobe and wrap it in a loop that waits for a few microseconds
before retrying. The optimal wait time depends on the application, but
this drops the CPU overhead virtually to zero.

Steve McMillan
--
Stephen L. W. McMillan, Professor of Physics, Drexel University
+1 215-895-2723, FAX +1 215-895-1549, st...@physics.drexel.edu

Lisandro Dalcin

unread,
Oct 22, 2009, 3:37:24 PM10/22/09
to mpi...@googlegroups.com
On Thu, Oct 22, 2009 at 5:26 PM, Steve McMillan
<st...@physics.drexel.edu> wrote:
>
> If I am concerned about CPU usage in a situation like this, I usually
> use iprobe and wrap it in a loop that waits for a few microseconds
> before retrying.  The optimal wait time depends on the application, but
> this drops the CPU overhead virtually to zero.
>

That would be the way to go, yes... So basically this strategy adds
latency but frees CPU load...


> Steve McMillan
>
>
> Thomas Robitaille wrote:
>> Hi,
>>
>> I have a call to Probe in my python script:
>>
>>         comm.Probe(source=MPI.ANY_SOURCE, tag=MPI.ANY_TAG,
>> status=status)
>>
>> But this takes up 100% of the CPU power while waiting for a message.
>> Is this normal? If so, are there alternatives that take up less CPU?
>>

This depends entirely on the MPI implementation, and even in its
underlying communication channels.

For example, If you build MPICH2 with ch3:sock channel (the default in
MPICH2 1.0.x and older), then a Probe() will make your process sleep
until something arrives. However, if you build MPICH2 with ch3:nemesis
channel (now the default in MPICH 1.1.x and later), the process will
take 100% CPU until the message arrives. Regarding Open MPI, AFAIK it
will always take 100% CPU...

--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

Reply all
Reply to author
Forward
0 new messages