File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 77#include "mpi.h"
88
99
10- int main ( int argc , char * * argv )
10+ int main ( int argc , char * * argv )
1111{
1212 MPI_Comm parent ;
1313 MPI_Comm merged ;
1414 int rank ;
1515 int size ;
1616
17- MPI_Init (& argc , & argv );
17+ MPI_Init (& argc , & argv );
1818 printf ("Child: launch\n" );
19- MPI_Comm_get_parent (& parent );
19+ MPI_Comm_get_parent (& parent );
2020 MPI_Intercomm_merge (parent , 1 , & merged );
2121 MPI_Comm_rank (merged , & rank );
2222 MPI_Comm_size (merged , & size );
2323 printf ("Child merged rank = %d, size = %d\n" , rank , size );
24-
24+
25+ MPI_Comm_disconnect (& parent );
2526 MPI_Comm_free (& merged );
2627 MPI_Finalize ();
2728 printf ("Child %d: exiting\n" , (int )getpid ());
Original file line number Diff line number Diff line change 44#include <unistd.h>
55#include "mpi.h"
66#include <pthread.h>
7- #include <signal.h>
7+ #include <signal.h>
88#include <sys/time.h>
99#include <errno.h>
1010#define EXE_TEST "./loop_child"
@@ -15,10 +15,10 @@ int main(int argc, char **argv)
1515 int iter , err , rank , size ;
1616 MPI_Comm comm , merged ;
1717
18- /* MPI environnement */
18+ /* MPI environnement */
1919
2020 printf ("parent*******************************\n" );
21- printf ("parent: Launching MPI*\n" );
21+ printf ("parent %d : Launching MPI*\n" , getpid () );
2222
2323 MPI_Init ( & argc , & argv );
2424
@@ -30,8 +30,9 @@ int main(int argc, char **argv)
3030 MPI_Intercomm_merge (comm , 0 , & merged );
3131 MPI_Comm_rank (merged , & rank );
3232 MPI_Comm_size (merged , & size );
33- printf ("parent: MPI_Comm_spawn #%d rank %d, size %d\n" ,
34- iter , rank , size );
33+ printf ("parent %d: MPI_Comm_spawn #%d rank %d, size %d\n" ,
34+ getpid (), iter , rank , size );
35+ MPI_Comm_disconnect (& comm );
3536 MPI_Comm_free (& merged );
3637 }
3738
You can’t perform that action at this time.
0 commit comments