Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Laurent.POREZ_at_[hidden]
Date: 2006-06-06 05:48:37


Hi,

I'm using Open-MPI 1.0.2 on a debian system.

I'm testing the MPI_recv function with a small C program (source code at the end of the message). And I see that when I'm waiting a message, calling MPI_recv, the CPU is used at 100 %.

Is that normal ?
Is there other ways to use a recv function (irecv, etc) that is not using the CPU ?

        Laurent.

Source code :

#include <mpi.h>
#include <stdio.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
        int rc;
        int numtasks, rank;
        int myint = 0;
        
        rc = MPI_Init(&argc, &argv);
        if(rc != 0) {
                printf("open error\n");
                MPI_Abort(MPI_COMM_WORLD, rc);
        }
        
        MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
        MPI_Comm_rank(MPI_COMM_WORLD, &rank);
        
        printf("from cpu_test : number of tasks : %d. My rank :%d\n", numtasks, rank);
        
                
        MPI_Recv(&myint, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, NULL);
        
        printf("message received\n");
        
        MPI_Finalize();
        
        exit(0);
}