Blame src/include/mpir_group.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_GROUP_H_INCLUDED
Packit Service c5cf8c
#define MPIR_GROUP_H_INCLUDED
Packit Service c5cf8c
Packit Service c5cf8c
/*---------------------------------------------------------------------------
Packit Service c5cf8c
 * Groups are *not* a major data structure in MPICH-2.  They are provided
Packit Service c5cf8c
 * only because they are required for the group operations (e.g.,
Packit Service c5cf8c
 * MPI_Group_intersection) and for the scalable RMA synchronization
Packit Service c5cf8c
 *---------------------------------------------------------------------------*/
Packit Service c5cf8c
/* This structure is used to implement the group operations such as
Packit Service c5cf8c
   MPI_Group_translate_ranks */
Packit Service c5cf8c
typedef struct MPII_Group_pmap_t {
Packit Service c5cf8c
    int lpid;                   /* local process id, from VCONN */
Packit Service c5cf8c
    int next_lpid;              /* Index of next lpid (in lpid order) */
Packit Service c5cf8c
    int flag;                   /* marker, used to implement group operations */
Packit Service c5cf8c
} MPII_Group_pmap_t;
Packit Service c5cf8c
Packit Service c5cf8c
/* Any changes in the MPIR_Group structure must be made to the
Packit Service c5cf8c
   predefined value in MPIR_Group_builtin for MPI_GROUP_EMPTY in
Packit Service c5cf8c
   src/mpi/group/grouputil.c */
Packit Service c5cf8c
/*S
Packit Service c5cf8c
 MPIR_Group - Description of the Group data structure
Packit Service c5cf8c
Packit Service c5cf8c
 The processes in the group of 'MPI_COMM_WORLD' have lpid values 0 to 'size'-1,
Packit Service c5cf8c
 where 'size' is the size of 'MPI_COMM_WORLD'.  Processes created by
Packit Service c5cf8c
 'MPI_Comm_spawn' or 'MPI_Comm_spawn_multiple' or added by 'MPI_Comm_attach'
Packit Service c5cf8c
 or
Packit Service c5cf8c
 'MPI_Comm_connect'
Packit Service c5cf8c
 are numbered greater than 'size - 1' (on the calling process). See the
Packit Service c5cf8c
 discussion of LocalPID values.
Packit Service c5cf8c
Packit Service c5cf8c
 Note that when dynamic process creation is used, the pids are `not` unique
Packit Service c5cf8c
 across the universe of connected MPI processes.  This is ok, as long as
Packit Service c5cf8c
 pids are interpreted `only` on the process that owns them.
Packit Service c5cf8c
Packit Service c5cf8c
 Only for MPI-1 are the lpid''s equal to the `global` pids.  The local pids
Packit Service c5cf8c
 can be thought of as a reference not to the remote process itself, but
Packit Service c5cf8c
 how the remote process can be reached from this process.  We may want to
Packit Service c5cf8c
 have a structure 'MPID_Lpid_t' that contains information on the remote
Packit Service c5cf8c
 process, such as (for TCP) the hostname, ip address (it may be different if
Packit Service c5cf8c
 multiple interfaces are supported; we may even want plural ip addresses for
Packit Service c5cf8c
 stripping communication), and port (or ports).  For shared memory connected
Packit Service c5cf8c
 processes, it might have the address of a remote queue.  The lpid number
Packit Service c5cf8c
 is an index into a table of 'MPID_Lpid_t'''s that contain this (device- and
Packit Service c5cf8c
 method-specific) information.
Packit Service c5cf8c
Packit Service c5cf8c
 Module:
Packit Service c5cf8c
 Group-DS
Packit Service c5cf8c
Packit Service c5cf8c
 S*/
Packit Service c5cf8c
struct MPIR_Group {
Packit Service c5cf8c
    MPIR_OBJECT_HEADER;         /* adds handle and ref_count fields */
Packit Service c5cf8c
    int size;                   /* Size of a group */
Packit Service c5cf8c
    int rank;                   /* rank of this process relative to this
Packit Service c5cf8c
                                 * group */
Packit Service c5cf8c
    int idx_of_first_lpid;
Packit Service c5cf8c
    MPII_Group_pmap_t *lrank_to_lpid;   /* Array mapping a local rank to local
Packit Service c5cf8c
                                         * process number */
Packit Service c5cf8c
    int is_local_dense_monotonic;       /* see NOTE-G1 */
Packit Service c5cf8c
Packit Service c5cf8c
    /* We may want some additional data for the RMA syncrhonization calls */
Packit Service c5cf8c
    /* Other, device-specific information */
Packit Service c5cf8c
#ifdef MPID_DEV_GROUP_DECL
Packit Service c5cf8c
     MPID_DEV_GROUP_DECL
Packit Service c5cf8c
#endif
Packit Service c5cf8c
};
Packit Service c5cf8c
Packit Service c5cf8c
/* NOTE-G1: is_local_dense_monotonic will be true iff the group meets the
Packit Service c5cf8c
 * following criteria:
Packit Service c5cf8c
 * 1) the lpids are all in the range [0,size-1], i.e. a subset of comm world
Packit Service c5cf8c
 * 2) the pids are sequentially numbered in increasing order, without any gaps,
Packit Service c5cf8c
 *    stride, or repetitions
Packit Service c5cf8c
 *
Packit Service c5cf8c
 * This additional information allows us to handle the common case (insofar as
Packit Service c5cf8c
 * group ops are common) for MPI_Group_translate_ranks where group2 is
Packit Service c5cf8c
 * group_of(MPI_COMM_WORLD), or some simple subset.  This is an important use
Packit Service c5cf8c
 * case for many MPI tool libraries, such as Scalasca.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
extern MPIR_Object_alloc_t MPIR_Group_mem;
Packit Service c5cf8c
/* Preallocated group objects */
Packit Service c5cf8c
#define MPIR_GROUP_N_BUILTIN 1
Packit Service c5cf8c
extern MPIR_Group MPIR_Group_builtin[MPIR_GROUP_N_BUILTIN];
Packit Service c5cf8c
extern MPIR_Group MPIR_Group_direct[];
Packit Service c5cf8c
Packit Service c5cf8c
/* Object for empty group */
Packit Service c5cf8c
extern MPIR_Group *const MPIR_Group_empty;
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_Group_add_ref(_group) \
Packit Service c5cf8c
    do { MPIR_Object_add_ref(_group); } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
#define MPIR_Group_release_ref(_group, _inuse) \
Packit Service c5cf8c
     do { MPIR_Object_release_ref(_group, _inuse); } while (0)
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Group_create(int, MPIR_Group **);
Packit Service c5cf8c
int MPIR_Group_release(MPIR_Group * group_ptr);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Group_compare_impl(MPIR_Group * group_ptr1, MPIR_Group * group_ptr2, int *result);
Packit Service c5cf8c
int MPIR_Group_difference_impl(MPIR_Group * group_ptr1, MPIR_Group * group_ptr2,
Packit Service c5cf8c
                               MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_excl_impl(MPIR_Group * group_ptr, int n, const int *ranks,
Packit Service c5cf8c
                         MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_free_impl(MPIR_Group * group_ptr);
Packit Service c5cf8c
int MPIR_Group_incl_impl(MPIR_Group * group_ptr, int n, const int *ranks,
Packit Service c5cf8c
                         MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_intersection_impl(MPIR_Group * group_ptr1, MPIR_Group * group_ptr2,
Packit Service c5cf8c
                                 MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_range_excl_impl(MPIR_Group * group_ptr, int n, int ranges[][3],
Packit Service c5cf8c
                               MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_range_incl_impl(MPIR_Group * group_ptr, int n, int ranges[][3],
Packit Service c5cf8c
                               MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_translate_ranks_impl(MPIR_Group * group_ptr1, int n, const int *ranks1,
Packit Service c5cf8c
                                    MPIR_Group * group_ptr2, int *ranks2);
Packit Service c5cf8c
int MPIR_Group_union_impl(MPIR_Group * group_ptr1, MPIR_Group * group_ptr2,
Packit Service c5cf8c
                          MPIR_Group ** new_group_ptr);
Packit Service c5cf8c
int MPIR_Group_check_subset(MPIR_Group * group_ptr, MPIR_Comm * comm_ptr);
Packit Service c5cf8c
int MPIR_Group_init(void);
Packit Service c5cf8c
Packit Service c5cf8c
/* internal functions */
Packit Service c5cf8c
void MPII_Group_setup_lpid_list(MPIR_Group *);
Packit Service c5cf8c
Packit Service c5cf8c
#endif /* MPIR_GROUP_H_INCLUDED */