MPI_Comm_create
MPI_Comm_create creates a new communicator to include specified processes from an existing communicator.
Fortran Syntax
Subroutine MPI_Comm_create(old_comm, new_group, new_comm, ierr)
C Syntax
int MPI_Cart_create(MPI_Comm old_comm, MPI_Group *new_group, MPI_Comm *new_comm)
Example in Fortran
|
Example in C
|
In the above example, first we identify the MPI_COMM_WORLD communicator’s group handle. Then we create a new group, group_worker, consisting of all but process 0 of MPI_COMM_WORLD as members by way of MPI_Group_excl. Finally, MPI_Comm_create is used to create a new communicator whose member processes are those of the new group just created. With this new communicator, message passing can now proceed among its member processes.
Upon completion of task, the created communicator may be released by calling MPI_Comm_free
.