Dear open-mpi users:
I come across a little problem when running a MPI C program compiled with Open MPI 1.4.3. A part of codes as follows:
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
MPI_Get_processor_name(processor_name, &namelen);
if (myid == 0) {
printf("Please give N= ");
//fflush(stdout);
scanf("%d", &n);
startwtime = MPI_Wtime();
}
If comment out the sentence of "fflush(stdout);", it doesn't print out the message till I input an integer n. And if I add the fflush function between them, it works as expected, though comsumming time obviously.
However, when I compiled it with Mpich2-1.3.2p1, without fflush function in the code, it works correctly.
Can anyone know what the matter is.
Thanks!
--
Meilin Bai