I need to write a MPI program which has to just start few processes on different cluster nodes. This is my sample code.
#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[]) {
int rank, size, nodenamesize;
char nodename[100];
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Get_processor_name(nodename, &nodenamesize);
printf("Hello world! I am %d of %d running on %s\n", rank, size, nodename);
if (rank == 0) {
system("./Longwait&");
} else if (rank == 1) {
system("./AnotherLongWait&");
}
MPI_Finalize();
return 0;
}
It successfully start the processes but MPI application doesn't terminate itself. It waits even after the MPI_Finalize() is called;.
what is the wrong with this code? What do I need to do to have the MPI program has to just start some other applications but shouldn't wait for anything.
Thank you, Regards, Robo.
fork,execveandwaitpidsystem calls (hence avoiding thesystemlibrary function), and communicate with your*LongWaitprocesses using e.g.pipe-s perhaps withpoll? - Basile StarynkevitchLongWaitis running. You cannot callMPI_Finalizebefore. - Basile Starynkevitch