Blame src/include/mpir_comm.h

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2001 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 *
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#ifndef MPIR_COMM_H_INCLUDED
Packit Service c5cf8c
#define MPIR_COMM_H_INCLUDED
Packit Service c5cf8c
Packit Service c5cf8c
#if defined HAVE_LIBHCOLL
Packit Service c5cf8c
#include "../mpid/common/hcoll/hcollpre.h"
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
/*E
Packit Service c5cf8c
  MPIR_Comm_kind_t - Name the two types of communicators
Packit Service c5cf8c
  E*/
Packit Service c5cf8c
typedef enum MPIR_Comm_kind_t {
Packit Service c5cf8c
    MPIR_COMM_KIND__INTRACOMM = 0,
Packit Service c5cf8c
    MPIR_COMM_KIND__INTERCOMM = 1
Packit Service c5cf8c
} MPIR_Comm_kind_t;
Packit Service c5cf8c
Packit Service c5cf8c
/* ideally we could add these to MPIR_Comm_kind_t, but there's too much existing
Packit Service c5cf8c
 * code that assumes that the only valid values are INTRACOMM or INTERCOMM */
Packit Service c5cf8c
typedef enum MPIR_Comm_hierarchy_kind_t {
Packit Service c5cf8c
    MPIR_COMM_HIERARCHY_KIND__FLAT = 0, /* no hierarchy */
Packit Service c5cf8c
    MPIR_COMM_HIERARCHY_KIND__PARENT = 1,       /* has subcommunicators */
Packit Service c5cf8c
    MPIR_COMM_HIERARCHY_KIND__NODE_ROOTS = 2,   /* is the subcomm for node roots */
Packit Service c5cf8c
    MPIR_COMM_HIERARCHY_KIND__NODE = 3, /* is the subcomm for a node */
Packit Service c5cf8c
    MPIR_COMM_HIERARCHY_KIND__SIZE      /* cardinality of this enum */
Packit Service c5cf8c
} MPIR_Comm_hierarchy_kind_t;
Packit Service c5cf8c
Packit Service c5cf8c
typedef enum {
Packit Service c5cf8c
    MPIR_COMM_MAP_TYPE__DUP,
Packit Service c5cf8c
    MPIR_COMM_MAP_TYPE__IRREGULAR
Packit Service c5cf8c
} MPIR_Comm_map_type_t;
Packit Service c5cf8c
Packit Service c5cf8c
/* direction of mapping: local to local, local to remote, remote to
Packit Service c5cf8c
 * local, remote to remote */
Packit Service c5cf8c
typedef enum {
Packit Service c5cf8c
    MPIR_COMM_MAP_DIR__L2L,
Packit Service c5cf8c
    MPIR_COMM_MAP_DIR__L2R,
Packit Service c5cf8c
    MPIR_COMM_MAP_DIR__R2L,
Packit Service c5cf8c
    MPIR_COMM_MAP_DIR__R2R
Packit Service c5cf8c
} MPIR_Comm_map_dir_t;
Packit Service c5cf8c
Packit Service c5cf8c
typedef struct MPIR_Comm_map {
Packit Service c5cf8c
    MPIR_Comm_map_type_t type;
Packit Service c5cf8c
Packit Service c5cf8c
    struct MPIR_Comm *src_comm;
Packit Service c5cf8c
Packit Service c5cf8c
    /* mapping direction for intercomms, which contain local and
Packit Service c5cf8c
     * remote groups */
Packit Service c5cf8c
    MPIR_Comm_map_dir_t dir;
Packit Service c5cf8c
Packit Service c5cf8c
    /* only valid for irregular map type */
Packit Service c5cf8c
    int src_mapping_size;
Packit Service c5cf8c
    int *src_mapping;
Packit Service c5cf8c
    int free_mapping;           /* we allocated the mapping */
Packit Service c5cf8c
Packit Service c5cf8c
    struct MPIR_Comm_map *next;
Packit Service c5cf8c
} MPIR_Comm_map_t;
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_map_irregular(struct MPIR_Comm *newcomm, struct MPIR_Comm *src_comm,
Packit Service c5cf8c
                            int *src_mapping, int src_mapping_size,
Packit Service c5cf8c
                            MPIR_Comm_map_dir_t dir, MPIR_Comm_map_t ** map);
Packit Service c5cf8c
int MPIR_Comm_map_dup(struct MPIR_Comm *newcomm, struct MPIR_Comm *src_comm,
Packit Service c5cf8c
                      MPIR_Comm_map_dir_t dir);
Packit Service c5cf8c
int MPIR_Comm_map_free(struct MPIR_Comm *comm);
Packit Service c5cf8c
Packit Service c5cf8c
/*S
Packit Service c5cf8c
  MPIR_Comm - Description of the Communicator data structure
Packit Service c5cf8c
Packit Service c5cf8c
  Notes:
Packit Service c5cf8c
  Note that the size and rank duplicate data in the groups that
Packit Service c5cf8c
  make up this communicator.  These are used often enough that this
Packit Service c5cf8c
  optimization is valuable.
Packit Service c5cf8c
Packit Service c5cf8c
  This definition provides only a 16-bit integer for context id''s .
Packit Service c5cf8c
  This should be sufficient for most applications.  However, extending
Packit Service c5cf8c
  this to a 32-bit (or longer) integer should be easy.
Packit Service c5cf8c
Packit Service c5cf8c
  There are two context ids.  One is used for sending and one for
Packit Service c5cf8c
  receiving.  In the case of an Intracommunicator, they are the same
Packit Service c5cf8c
  context id.  They differ in the case of intercommunicators, where
Packit Service c5cf8c
  they may come from processes in different comm worlds (in the
Packit Service c5cf8c
  case of MPI-2 dynamic process intercomms).
Packit Service c5cf8c
Packit Service c5cf8c
  The virtual connection table is an explicit member of this structure.
Packit Service c5cf8c
  This contains the information used to contact a particular process,
Packit Service c5cf8c
  indexed by the rank relative to this communicator.
Packit Service c5cf8c
Packit Service c5cf8c
  Groups are allocated lazily.  That is, the group pointers may be
Packit Service c5cf8c
  null, created only when needed by a routine such as 'MPI_Comm_group'.
Packit Service c5cf8c
  The local process ids needed to form the group are available within
Packit Service c5cf8c
  the virtual connection table.
Packit Service c5cf8c
  For intercommunicators, we may want to always have the groups.  If not,
Packit Service c5cf8c
  we either need the 'local_group' or we need a virtual connection table
Packit Service c5cf8c
  corresponding to the 'local_group' (we may want this anyway to simplify
Packit Service c5cf8c
  the implementation of the intercommunicator collective routines).
Packit Service c5cf8c
Packit Service c5cf8c
  The pointer to the structure 'MPIR_Collops' containing pointers to the
Packit Service c5cf8c
  collective
Packit Service c5cf8c
  routines allows an implementation to replace each routine on a
Packit Service c5cf8c
  routine-by-routine basis.  By default, this pointer is null, as are the
Packit Service c5cf8c
  pointers within the structure.  If either pointer is null, the implementation
Packit Service c5cf8c
  uses the generic provided implementation.  This choice, rather than
Packit Service c5cf8c
  initializing the table with pointers to all of the collective routines,
Packit Service c5cf8c
  is made to reduce the space used in the communicators and to eliminate the
Packit Service c5cf8c
  need to include the implementation of all collective routines in all MPI
Packit Service c5cf8c
  executables, even if the routines are not used.
Packit Service c5cf8c
Packit Service c5cf8c
  Please note that the local_size and remote_size fields can be confusing.  For
Packit Service c5cf8c
  intracommunicators both fields are always equal to the size of the
Packit Service c5cf8c
  communicator.  For intercommunicators local_size is equal to the size of
Packit Service c5cf8c
  local_group while remote_size is equal to the size of remote_group.
Packit Service c5cf8c
Packit Service c5cf8c
  Module:
Packit Service c5cf8c
  Communicator-DS
Packit Service c5cf8c
Packit Service c5cf8c
  Question:
Packit Service c5cf8c
  For fault tolerance, do we want to have a standard field for communicator
Packit Service c5cf8c
  health?  For example, ok, failure detected, all (live) members of failed
Packit Service c5cf8c
  communicator have acked.
Packit Service c5cf8c
  S*/
Packit Service c5cf8c
struct MPIR_Comm {
Packit Service c5cf8c
    MPIR_OBJECT_HEADER;         /* adds handle and ref_count fields */
Packit Service c5cf8c
    MPID_Thread_mutex_t mutex;
Packit Service c5cf8c
    MPIR_Context_id_t context_id;       /* Send context id.  See notes */
Packit Service c5cf8c
    MPIR_Context_id_t recvcontext_id;   /* Send context id.  See notes */
Packit Service c5cf8c
    int remote_size;            /* Value of MPI_Comm_(remote)_size */
Packit Service c5cf8c
    int rank;                   /* Value of MPI_Comm_rank */
Packit Service c5cf8c
    MPIR_Attribute *attributes; /* List of attributes */
Packit Service c5cf8c
    int local_size;             /* Value of MPI_Comm_size for local group */
Packit Service c5cf8c
    int pof2;                   /* Nearest (smaller than or equal to) power of 2
Packit Service c5cf8c
                                 * to the number of ranks in the communicator.
Packit Service c5cf8c
                                 * To be used during collective communication */
Packit Service c5cf8c
    MPIR_Group *local_group,    /* Groups in communicator. */
Packit Service c5cf8c
    *remote_group;              /* The local and remote groups are the
Packit Service c5cf8c
                                 * same for intra communicators */
Packit Service c5cf8c
    MPIR_Comm_kind_t comm_kind; /* MPIR_COMM_KIND__INTRACOMM or MPIR_COMM_KIND__INTERCOMM */
Packit Service c5cf8c
    char name[MPI_MAX_OBJECT_NAME];     /* Required for MPI-2 */
Packit Service c5cf8c
    MPIR_Errhandler *errhandler;        /* Pointer to the error handler structure */
Packit Service c5cf8c
    struct MPIR_Comm *local_comm;       /* Defined only for intercomms, holds
Packit Service c5cf8c
                                         * an intracomm for the local group */
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_Comm_hierarchy_kind_t hierarchy_kind;  /* flat, parent, node, or node_roots */
Packit Service c5cf8c
    struct MPIR_Comm *node_comm;        /* Comm of processes in this comm that are on
Packit Service c5cf8c
                                         * the same node as this process. */
Packit Service c5cf8c
    struct MPIR_Comm *node_roots_comm;  /* Comm of root processes for other nodes. */
Packit Service c5cf8c
    int *intranode_table;       /* intranode_table[i] gives the rank in
Packit Service c5cf8c
                                 * node_comm of rank i in this comm or -1 if i
Packit Service c5cf8c
                                 * is not in this process' node_comm.
Packit Service c5cf8c
                                 * It is of size 'local_size'. */
Packit Service c5cf8c
    int *internode_table;       /* internode_table[i] gives the rank in
Packit Service c5cf8c
                                 * node_roots_comm of rank i in this comm.
Packit Service c5cf8c
                                 * It is of size 'local_size'. */
Packit Service c5cf8c
Packit Service c5cf8c
    int is_low_group;           /* For intercomms only, this boolean is
Packit Service c5cf8c
                                 * set for all members of one of the
Packit Service c5cf8c
                                 * two groups of processes and clear for
Packit Service c5cf8c
                                 * the other.  It enables certain
Packit Service c5cf8c
                                 * intercommunicator collective operations
Packit Service c5cf8c
                                 * that wish to use half-duplex operations
Packit Service c5cf8c
                                 * to implement a full-duplex operation */
Packit Service c5cf8c
Packit Service c5cf8c
    struct MPIR_Comm *comm_next;        /* Provides a chain through all active
Packit Service c5cf8c
                                         * communicators */
Packit Service c5cf8c
    struct MPII_Topo_ops *topo_fns;     /* Pointer to a table of functions
Packit Service c5cf8c
                                         * implementting the topology routines */
Packit Service c5cf8c
    int next_sched_tag;         /* used by the NBC schedule code to allocate tags */
Packit Service c5cf8c
Packit Service c5cf8c
    int revoked;                /* Flag to track whether the communicator
Packit Service c5cf8c
                                 * has been revoked */
Packit Service c5cf8c
    MPIR_Info *info;            /* Hints to the communicator */
Packit Service c5cf8c
Packit Service c5cf8c
#if defined HAVE_LIBHCOLL
Packit Service c5cf8c
    hcoll_comm_priv_t hcoll_priv;
Packit Service c5cf8c
#endif                          /* HAVE_LIBHCOLL */
Packit Service c5cf8c
Packit Service c5cf8c
    /* the mapper is temporarily filled out in order to allow the
Packit Service c5cf8c
     * device to setup its network addresses.  it will be freed after
Packit Service c5cf8c
     * the device has initialized the comm. */
Packit Service c5cf8c
    MPIR_Comm_map_t *mapper_head;
Packit Service c5cf8c
    MPIR_Comm_map_t *mapper_tail;
Packit Service c5cf8c
Packit Service c5cf8c
    /* Other, device-specific information */
Packit Service c5cf8c
#ifdef MPID_DEV_COMM_DECL
Packit Service c5cf8c
     MPID_DEV_COMM_DECL
Packit Service c5cf8c
#endif
Packit Service c5cf8c
};
Packit Service c5cf8c
extern MPIR_Object_alloc_t MPIR_Comm_mem;
Packit Service c5cf8c
Packit Service c5cf8c
/* this function should not be called by normal code! */
Packit Service c5cf8c
int MPIR_Comm_delete_internal(MPIR_Comm * comm_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_Comm_add_ref(comm_p_) \
Packit Service c5cf8c
    do { MPIR_Object_add_ref((comm_p_)); } while (0)
Packit Service c5cf8c
#define MPIR_Comm_release_ref(comm_p_, inuse_) \
Packit Service c5cf8c
    do { MPIR_Object_release_ref(comm_p_, inuse_); } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
/* Release a reference to a communicator.  If there are no pending
Packit Service c5cf8c
   references, delete the communicator and recover all storage and
Packit Service c5cf8c
   context ids.
Packit Service c5cf8c
Packit Service c5cf8c
   This routine has been inlined because keeping it as a separate routine
Packit Service c5cf8c
   results in a >5% performance hit for the SQMR benchmark.
Packit Service c5cf8c
*/
Packit Service c5cf8c
#undef FUNCNAME
Packit Service c5cf8c
#define FUNCNAME MPIR_Comm_release
Packit Service c5cf8c
#undef FCNAME
Packit Service c5cf8c
#define FCNAME MPL_QUOTE(FUNCNAME)
Packit Service c5cf8c
static inline int MPIR_Comm_release(MPIR_Comm * comm_ptr)
Packit Service c5cf8c
{
Packit Service c5cf8c
    int mpi_errno = MPI_SUCCESS;
Packit Service c5cf8c
    int in_use;
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_Comm_release_ref(comm_ptr, &in_use);
Packit Service c5cf8c
    if (unlikely(!in_use)) {
Packit Service c5cf8c
        /* the following routine should only be called by this function and its
Packit Service c5cf8c
         * "_always" variant. */
Packit Service c5cf8c
        mpi_errno = MPIR_Comm_delete_internal(comm_ptr);
Packit Service c5cf8c
        /* not ERR_POPing here to permit simpler inlining.  Our caller will
Packit Service c5cf8c
         * still report the error from the comm_delete level. */
Packit Service c5cf8c
    }
Packit Service c5cf8c
Packit Service c5cf8c
    return mpi_errno;
Packit Service c5cf8c
}
Packit Service c5cf8c
Packit Service c5cf8c
#undef FUNCNAME
Packit Service c5cf8c
#undef FCNAME
Packit Service c5cf8c
Packit Service c5cf8c
/* MPIR_Comm_release_always is the same as MPIR_Comm_release except it uses
Packit Service c5cf8c
   MPIR_Comm_release_ref_always instead.
Packit Service c5cf8c
*/
Packit Service c5cf8c
int MPIR_Comm_release_always(MPIR_Comm * comm_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_create(MPIR_Comm **);
Packit Service c5cf8c
int MPIR_Comm_create_group(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr, int tag,
Packit Service c5cf8c
                           MPIR_Comm ** newcomm);
Packit Service c5cf8c
Packit Service c5cf8c
/* implements the logic for MPI_Comm_create for intracommunicators only */
Packit Service c5cf8c
int MPIR_Comm_create_intra(MPIR_Comm * comm_ptr, MPIR_Group * group_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_commit(MPIR_Comm *);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_is_node_aware(MPIR_Comm *);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_idup_impl(MPIR_Comm * comm_ptr, MPIR_Comm ** newcomm, MPIR_Request ** reqp);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_shrink(MPIR_Comm * comm_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_agree(MPIR_Comm * comm_ptr, int *flag);
Packit Service c5cf8c
Packit Service c5cf8c
#if defined(HAVE_ROMIO)
Packit Service c5cf8c
int MPIR_Comm_split_filesystem(MPI_Comm comm, int key, const char *dirname, MPI_Comm * newcomm);
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_Comm_rank(comm_ptr) ((comm_ptr)->rank)
Packit Service c5cf8c
#define MPIR_Comm_size(comm_ptr) ((comm_ptr)->local_size)
Packit Service c5cf8c
Packit Service c5cf8c
/* Communicator info hint functions */
Packit Service c5cf8c
typedef int (*MPIR_Comm_hint_fn_t) (MPIR_Comm *, MPIR_Info *, void *);
Packit Service c5cf8c
int MPIR_Comm_register_hint(const char *hint_key, MPIR_Comm_hint_fn_t fn, void *state);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_delete_attr_impl(MPIR_Comm * comm_ptr, MPII_Keyval * keyval_ptr);
Packit Service c5cf8c
int MPIR_Comm_create_keyval_impl(MPI_Comm_copy_attr_function * comm_copy_attr_fn,
Packit Service c5cf8c
                                 MPI_Comm_delete_attr_function * comm_delete_attr_fn,
Packit Service c5cf8c
                                 int *comm_keyval, void *extra_state);
Packit Service c5cf8c
int MPIR_Comm_accept_impl(const char *port_name, MPIR_Info * info_ptr, int root,
Packit Service c5cf8c
                          MPIR_Comm * comm_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_connect_impl(const char *port_name, MPIR_Info * info_ptr, int root,
Packit Service c5cf8c
                           MPIR_Comm * comm_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_create_errhandler_impl(MPI_Comm_errhandler_function * function,
Packit Service c5cf8c
                                     MPI_Errhandler * errhandler);
Packit Service c5cf8c
int MPIR_Comm_dup_impl(MPIR_Comm * comm_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_dup_with_info_impl(MPIR_Comm * comm_ptr, MPIR_Info * info_ptr,
Packit Service c5cf8c
                                 MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_get_info_impl(MPIR_Comm * comm_ptr, MPIR_Info ** info_ptr);
Packit Service c5cf8c
int MPIR_Comm_set_info_impl(MPIR_Comm * comm_ptr, MPIR_Info * info_ptr);
Packit Service c5cf8c
int MPIR_Comm_free_impl(MPIR_Comm * comm_ptr);
Packit Service c5cf8c
void MPIR_Comm_free_keyval_impl(int keyval);
Packit Service c5cf8c
void MPIR_Comm_get_errhandler_impl(MPIR_Comm * comm_ptr, MPIR_Errhandler ** errhandler_ptr);
Packit Service c5cf8c
void MPIR_Comm_set_errhandler_impl(MPIR_Comm * comm_ptr, MPIR_Errhandler * errhandler_ptr);
Packit Service c5cf8c
void MPIR_Comm_get_name_impl(MPIR_Comm * comm, char *comm_name, int *resultlen);
Packit Service c5cf8c
int MPIR_Intercomm_merge_impl(MPIR_Comm * comm_ptr, int high, MPIR_Comm ** new_intracomm_ptr);
Packit Service c5cf8c
int MPIR_Intercomm_create_impl(MPIR_Comm * local_comm_ptr, int local_leader,
Packit Service c5cf8c
                               MPIR_Comm * peer_comm_ptr, int remote_leader, int tag,
Packit Service c5cf8c
                               MPIR_Comm ** new_intercomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_group_impl(MPIR_Comm * comm_ptr, MPIR_Group ** group_ptr);
Packit Service c5cf8c
int MPIR_Comm_remote_group_impl(MPIR_Comm * comm_ptr, MPIR_Group ** group_ptr);
Packit Service c5cf8c
int MPIR_Comm_group_failed_impl(MPIR_Comm * comm, MPIR_Group ** failed_group_ptr);
Packit Service c5cf8c
int MPIR_Comm_remote_group_failed_impl(MPIR_Comm * comm, MPIR_Group ** failed_group_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_impl(MPIR_Comm * comm_ptr, int color, int key, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type_self(MPIR_Comm * comm_ptr, int split_type, int key,
Packit Service c5cf8c
                              MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type_node(MPIR_Comm * comm_ptr, int split_type, int key,
Packit Service c5cf8c
                              MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type_node_topo(MPIR_Comm * comm_ptr, int split_type, int key,
Packit Service c5cf8c
                                   MPIR_Info * info_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type(MPIR_Comm * comm_ptr, int split_type, int key, MPIR_Info * info_ptr,
Packit Service c5cf8c
                         MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type_impl(MPIR_Comm * comm_ptr, int split_type, int key, MPIR_Info * info_ptr,
Packit Service c5cf8c
                              MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_set_attr_impl(MPIR_Comm * comm_ptr, int comm_keyval, void *attribute_val,
Packit Service c5cf8c
                            MPIR_Attr_type attrType);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Comm_split_type_neighborhood(MPIR_Comm * comm_ptr, int split_type, int key,
Packit Service c5cf8c
                                      MPIR_Info * info_ptr, MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type_nbhd_common_dir(MPIR_Comm * user_comm_ptr, int key, const char *hintval,
Packit Service c5cf8c
                                         MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
int MPIR_Comm_split_type_network_topo(MPIR_Comm * user_comm_ptr, int key, const char *hintval,
Packit Service c5cf8c
                                      MPIR_Comm ** newcomm_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
/* Preallocated comm objects.  There are 3: comm_world, comm_self, and
Packit Service c5cf8c
   a private (non-user accessible) dup of comm world that is provided
Packit Service c5cf8c
   if needed in MPI_Finalize.  Having a separate version of comm_world
Packit Service c5cf8c
   avoids possible interference with User code */
Packit Service c5cf8c
#define MPIR_COMM_N_BUILTIN 3
Packit Service c5cf8c
extern MPIR_Comm MPIR_Comm_builtin[MPIR_COMM_N_BUILTIN];
Packit Service c5cf8c
extern MPIR_Comm MPIR_Comm_direct[];
Packit Service c5cf8c
/* This is the handle for the internal MPI_COMM_WORLD .  The "2" at the end
Packit Service c5cf8c
   of the handle is 3-1 (e.g., the index in the builtin array) */
Packit Service c5cf8c
#define MPIR_ICOMM_WORLD  ((MPI_Comm)0x44000002)
Packit Service c5cf8c
Packit Service c5cf8c
typedef struct MPIR_Commops {
Packit Service c5cf8c
    int (*split_type) (MPIR_Comm *, int, int, MPIR_Info *, MPIR_Comm **);
Packit Service c5cf8c
} MPIR_Commops;
Packit Service c5cf8c
extern struct MPIR_Commops *MPIR_Comm_fns;      /* Communicator creation functions */
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
/* internal functions */
Packit Service c5cf8c
Packit Service c5cf8c
int MPII_Comm_init(MPIR_Comm *);
Packit Service c5cf8c
Packit Service c5cf8c
int MPII_Comm_is_node_consecutive(MPIR_Comm *);
Packit Service c5cf8c
Packit Service c5cf8c
/* applies the specified info chain to the specified communicator */
Packit Service c5cf8c
int MPII_Comm_apply_hints(MPIR_Comm * comm_ptr, MPIR_Info * info_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
int MPII_Comm_copy(MPIR_Comm *, int, MPIR_Comm **);
Packit Service c5cf8c
int MPII_Comm_copy_data(MPIR_Comm * comm_ptr, MPIR_Comm ** outcomm_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
int MPII_Setup_intercomm_localcomm(MPIR_Comm *);
Packit Service c5cf8c
Packit Service c5cf8c
/* comm_create helper functions, used by both comm_create and comm_create_group */
Packit Service c5cf8c
int MPII_Comm_create_calculate_mapping(MPIR_Group * group_ptr,
Packit Service c5cf8c
                                       MPIR_Comm * comm_ptr,
Packit Service c5cf8c
                                       int **mapping_out, MPIR_Comm ** mapping_comm);
Packit Service c5cf8c
Packit Service c5cf8c
int MPII_Comm_create_map(int local_n,
Packit Service c5cf8c
                         int remote_n,
Packit Service c5cf8c
                         int *local_mapping,
Packit Service c5cf8c
                         int *remote_mapping, MPIR_Comm * mapping_comm, MPIR_Comm * newcomm);
Packit Service c5cf8c
Packit Service c5cf8c
#endif /* MPIR_COMM_H_INCLUDED */