This page imported from: /afs/bu.edu/cwis/webuser/web/s/c/scv/documentation/tutorials/MPI/more/MPI_Comm_create.html

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,group,new_comm,ierr)

C syntax

int MPI_Comm_create(old_comm,group,new_comm)

<!–

MPI_Comm_create

Creates a new communicator which include specific processes.

Fortran syntax

Subroutine MPI_Comm_create(old_comm,group,new_comm,ierr)

C syntax

int MPI_Comm_create(old_comm,group,new_comm)

Argument Description Data Type Scalar or Array State
old_comm Communicator from which the new communicator is created MPI_Comm/integer scalar input
group The group for which a new communicator is created MPI_Group/integer scalar input
new_comm the new communicator for the group MPI_Comm/integer scalar output
ierr Error flag int/integer scalar output

–>

Example in Fortran


      include "mpif.h"
      integer comm_world, group_world, new_comm, ierr

      comm_world = MPI_COMM_WORLD
      call MPI_Comm_group(old_comm, group_world, ierr)
      
      call MPI_Comm_create(comm_world, group_world, new_comm, ierr)


Example in C


#include "mpi.h";
MPI_Comm  comm_world, new_comm;
MPI_Group group_world;
int ierr;

comm_world = MPI_COMM_WORLD;
ierr = MPI_Comm_group(comm_world, group_world);
      
ierr =  MPI_Comm_create(comm_world, group_world, new_comm);


This routine is often used in conjunction with: