[mvapich-discuss] Does mvapich2 really support dynamic process management?
马凯
makailove123 at 163.com
Sun Apr 19 10:58:12 EDT 2015
I tried the examples of parent and child in the mvapich2-2.1rc2/examples, but they didn't work.
This is my compile commands:
#mpicc -o parent parent.c
#mpicc -o child child.c
This is my run command:
#mpirun_rsh -np 4 -hostfile hf MV2_SUPPORT_DPM=1 ./parent
And the content of hf is: 192.168.2.1
This is the IP of IB port on my node.
After run the command, the parent will be stuck. Then I added some output tips, and I found the MPI_Comm_spawn would never return.
It seems that the child had been start, but the MPI_Init in child would not return.
Why this happened? Does mvapich2 really support dynamic process management or not?
Could some one give some help?
Thanks!
The parent.c is:
#include <stdio.h>
#include "mpi.h"
int main( int argc, char *argv[] )
{
char str[10];
int err=0, errcodes[256], rank, nprocs;
MPI_Comm intercomm;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
if (nprocs != 4) {
printf("Run this program with 4 processes\n");
MPI_Abort(MPI_COMM_WORLD,1);
}
fprintf(stdout, "spawn...\n");
fflush(stdout);
err = MPI_Comm_spawn("/home/run/mpitest/mpi_spawn/child", MPI_ARGV_NULL, 4,
MPI_INFO_NULL, 1, MPI_COMM_WORLD,
&intercomm, errcodes);
if (err) printf("Error in MPI_Comm_spawn\n");
printf("spawn successfully\n");
fflush(stdout);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 3) {
err = MPI_Recv(str, 3, MPI_CHAR, 3, 0, intercomm, MPI_STATUS_IGNORE);
printf("Parent received from child: %s\n", str);
fflush(stdout);
err = MPI_Send("bye", 4, MPI_CHAR, 3, 0, intercomm);
}
MPI_Finalize();
return 0;
}
The child.c is:
#include <stdio.h>
#include "mpi.h"
int main( int argc, char *argv[] )
{
MPI_Comm intercomm;
char str[10];
int err, rank;
fprintf(stdout, "starting...\n");
fflush(stdout);
MPI_Init(&argc, &argv);
fprintf(stdout, "init\n");
fflush(stdout);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_get_parent(&intercomm);
if (rank == 3){
err = MPI_Send("hi", 3, MPI_CHAR, 3, 0, intercomm);
err = MPI_Recv(str, 4, MPI_CHAR, 3, 0, intercomm, MPI_STATUS_IGNORE);
printf("Child received from parent: %s\n", str);
fflush(stdout);
}
MPI_Finalize();
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cse.ohio-state.edu/pipermail/mvapich-discuss/attachments/20150419/48a21c34/attachment-0001.html>
More information about the mvapich-discuss
mailing list