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);
}