Commit 7c91135e authored by iker_martin's avatar iker_martin
Browse files

Added Disconnects functions

parent f612e0f0
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <mpi.h> #include <mpi.h>
#define FIRST 0 #define FIRST 0
...@@ -14,11 +15,12 @@ int main(int argc, char* argv[]) { ...@@ -14,11 +15,12 @@ int main(int argc, char* argv[]) {
int num_c = atoi(argv[1]); int num_c = atoi(argv[1]);
MPI_Comm_spawn(argv[0], MPI_ARGV_NULL, num_c, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &spawn, MPI_ERRCODES_IGNORE); MPI_Comm_spawn(argv[0], MPI_ARGV_NULL, num_c, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &spawn, MPI_ERRCODES_IGNORE);
MPI_Intercomm_merge(spawn, FIRST, &new_comm); MPI_Intercomm_merge(spawn, FIRST, &new_comm);
} else { } else {
MPI_Intercomm_merge(spawn, SECOND, &new_comm); MPI_Intercomm_merge(spawn, SECOND, &new_comm);
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
} }
MPI_Comm_disconnect(&spawn);
MPI_Comm_disconnect(&new_comm);
MPI_Finalize(); MPI_Finalize();
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment