2007-04-04 17:24:39 +04:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2007-04-04 19:38:23 +04:00
|
|
|
#include <unistd.h>
|
2007-04-04 17:24:39 +04:00
|
|
|
#include <pthread.h>
|
|
|
|
#include <semaphore.h>
|
|
|
|
#include "mpi.h"
|
|
|
|
|
2007-04-04 19:38:23 +04:00
|
|
|
|
|
|
|
int main( int argc, char **argv )
|
|
|
|
{
|
|
|
|
MPI_Comm parent;
|
|
|
|
MPI_Comm merged;
|
|
|
|
int rank;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
MPI_Init(&argc, &argv);
|
|
|
|
printf("Child: launch\n");
|
|
|
|
MPI_Comm_get_parent(&parent);
|
|
|
|
MPI_Intercomm_merge(parent, 1, &merged);
|
|
|
|
MPI_Comm_rank(merged, &rank);
|
|
|
|
MPI_Comm_size(merged, &size);
|
|
|
|
printf("Child merged rank = %d, size = %d\n", rank, size);
|
2007-04-04 17:24:39 +04:00
|
|
|
|
2007-04-04 19:38:23 +04:00
|
|
|
MPI_Comm_free(&merged);
|
2014-06-01 21:57:36 +04:00
|
|
|
MPI_Comm_disconnect(&parent);
|
2007-04-04 19:38:23 +04:00
|
|
|
MPI_Finalize();
|
2009-03-01 18:32:32 +03:00
|
|
|
printf("Child %d: exiting\n", (int)getpid());
|
2007-04-04 17:24:39 +04:00
|
|
|
return 0;
|
|
|
|
}
|