MPI_Comm_dup function

Duplicates an existing communicator with associated key values. For each key value, the respective copy callback function determines the attribute value that is associated with this key in the new communicator. The copy callback can, for example, delete the attribute from the new communicator.

Syntax

int MPIAPI MPI_Comm_dup(
        MPI_Comm comm,
  _Out_ MPI_Comm *newcomm
);

Parameters

  • comm
    The communicator to duplicate.

  • newcomm [out]
    On return, contains a handle to a new communicator. The new communicator has the same group or groups and any copied cached information from the source, but it contains new context information.

Return value

Returns MPI_SUCCESS on success. Otherwise, the return value is an error code.

In Fortran, the return value is stored in the IERROR parameter.

Fortran

    MPI_COMM_DUP(COMM,NEWCOMM,IERROR)
        INTEGER COMM, NEWCOMM, IERROR

Remarks

This function creates a duplicate communication space that has the same properties as the original communicator. This includes any attributes and topologies. This function is valid even if there are pending point-to-point communications that involve the source communicator.

A user can call the MPI_Comm_dup function at the beginning of the parallel process and later free the duplicate communicator by using the MPI_Comm_free function. Other models of communicator management are also possible.

This function applies to both intracommunicators and intercommunicators.

Requirements

Product

HPC Pack 2012 MS-MPI Redistributable Package, HPC Pack 2008 R2 MS-MPI Redistributable Package, HPC Pack 2008 MS-MPI Redistributable Package or HPC Pack 2008 Client Utilities

Header

Mpi.h; Mpif.h

Library

Msmpi.lib

DLL

Msmpi.dll

See also

MPI Communicator Functions