Blame src/include/mpir_topo.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_TOPO_H_INCLUDED
Packit Service c5cf8c
#define MPIR_TOPO_H_INCLUDED
Packit Service c5cf8c
Packit Service c5cf8c
/*
Packit Service c5cf8c
 * The following struture allows the device detailed control over the
Packit Service c5cf8c
 * functions that are used to implement the topology routines.  If either
Packit Service c5cf8c
 * the pointer to this structure is null or any individual entry is null,
Packit Service c5cf8c
 * the default function is used (this follows exactly the same rules as the
Packit Service c5cf8c
 * collective operations, provided in the MPIR_Collops structure).
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
typedef struct MPII_Topo_ops {
Packit Service c5cf8c
    int (*cartCreate) (const MPIR_Comm *, int, const int[], const int[], int, MPI_Comm *);
Packit Service c5cf8c
    int (*cartMap) (const MPIR_Comm *, int, const int[], const int[], int *);
Packit Service c5cf8c
    int (*graphCreate) (const MPIR_Comm *, int, const int[], const int[], int, MPI_Comm *);
Packit Service c5cf8c
    int (*graphMap) (const MPIR_Comm *, int, const int[], const int[], int *);
Packit Service c5cf8c
} MPII_Topo_ops;
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
typedef struct MPII_Graph_topology {
Packit Service c5cf8c
    int nnodes;
Packit Service c5cf8c
    int nedges;
Packit Service c5cf8c
    int *index;
Packit Service c5cf8c
    int *edges;
Packit Service c5cf8c
} MPII_Graph_topology;
Packit Service c5cf8c
Packit Service c5cf8c
typedef struct MPII_Cart_topology {
Packit Service c5cf8c
    int nnodes;                 /* Product of dims[*], gives the size of the topology */
Packit Service c5cf8c
    int ndims;
Packit Service c5cf8c
    int *dims;
Packit Service c5cf8c
    int *periodic;
Packit Service c5cf8c
    int *position;
Packit Service c5cf8c
} MPII_Cart_topology;
Packit Service c5cf8c
Packit Service c5cf8c
typedef struct MPII_Dist_graph_topology {
Packit Service c5cf8c
    int indegree;
Packit Service c5cf8c
    int *in;
Packit Service c5cf8c
    int *in_weights;
Packit Service c5cf8c
    int outdegree;
Packit Service c5cf8c
    int *out;
Packit Service c5cf8c
    int *out_weights;
Packit Service c5cf8c
    int is_weighted;
Packit Service c5cf8c
} MPII_Dist_graph_topology;
Packit Service c5cf8c
Packit Service c5cf8c
struct MPIR_Topology {
Packit Service c5cf8c
    MPIR_Topo_type kind;
Packit Service c5cf8c
    union topo {
Packit Service c5cf8c
        MPII_Graph_topology graph;
Packit Service c5cf8c
        MPII_Cart_topology cart;
Packit Service c5cf8c
        MPII_Dist_graph_topology dist_graph;
Packit Service c5cf8c
    } topo;
Packit Service c5cf8c
};
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Dims_create(int, int, int *);
Packit Service c5cf8c
Packit Service c5cf8c
MPIR_Topology *MPIR_Topology_get(MPIR_Comm *);
Packit Service c5cf8c
int MPIR_Topology_put(MPIR_Comm *, MPIR_Topology *);
Packit Service c5cf8c
Packit Service c5cf8c
/* Returns the canonicalized count of neighbors for the given topology as though
Packit Service c5cf8c
 * MPI_Dist_graph_neighbors_count were called with a distributed graph topology,
Packit Service c5cf8c
 * even if the given topology is actually Cartesian or Graph.  Useful for
Packit Service c5cf8c
 * implementing neighborhood collective operations. */
Packit Service c5cf8c
int MPIR_Topo_canon_nhb_count(MPIR_Comm * comm_ptr, int *indegree, int *outdegree, int *weighted);
Packit Service c5cf8c
Packit Service c5cf8c
/* Returns the canonicalized list of neighbors for a given topology, separated
Packit Service c5cf8c
 * into inbound and outbound edges.  Equivalent to MPI_Dist_graph_neighbors but
Packit Service c5cf8c
 * works for any topology type by canonicalizing according to the rules in
Packit Service c5cf8c
 * Section 7.6 of the MPI-3.0 standard. */
Packit Service c5cf8c
int MPIR_Topo_canon_nhb(MPIR_Comm * comm_ptr,
Packit Service c5cf8c
                        int indegree, int sources[], int inweights[],
Packit Service c5cf8c
                        int outdegree, int dests[], int outweights[]);
Packit Service c5cf8c
Packit Service c5cf8c
#define MAX_CART_DIM 16
Packit Service c5cf8c
Packit Service c5cf8c
/* topology impl functions */
Packit Service c5cf8c
int MPIR_Cart_create(MPIR_Comm *, int, const int[], const int[], int, MPI_Comm *);
Packit Service c5cf8c
int MPIR_Cart_map(const MPIR_Comm *, int, const int[], const int[], int *);
Packit Service c5cf8c
int MPIR_Cart_shift_impl(MPIR_Comm * comm_ptr, int direction, int displ, int *source, int *dest);
Packit Service c5cf8c
Packit Service c5cf8c
void MPIR_Cart_rank_impl(struct MPIR_Topology *cart_ptr, const int *coords, int *rank);
Packit Service c5cf8c
int MPIR_Cart_create_impl(MPIR_Comm * comm_ptr, int ndims, const int dims[],
Packit Service c5cf8c
                          const int periods[], int reorder, MPI_Comm * comm_cart);
Packit Service c5cf8c
int MPIR_Cart_map_impl(const MPIR_Comm * comm_ptr, int ndims, const int dims[],
Packit Service c5cf8c
                       const int periodic[], int *newrank);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Graph_create(MPIR_Comm *, int, const int[], const int[], int, MPI_Comm *);
Packit Service c5cf8c
int MPIR_Graph_map(const MPIR_Comm *, int, const int[], const int[], int *);
Packit Service c5cf8c
int MPIR_Graph_neighbors_count_impl(MPIR_Comm * comm_ptr, int rank, int *nneighbors);
Packit Service c5cf8c
int MPIR_Graph_neighbors_impl(MPIR_Comm * comm_ptr, int rank, int maxneighbors, int *neighbors);
Packit Service c5cf8c
int MPIR_Graph_map_impl(const MPIR_Comm * comm_ptr, int nnodes,
Packit Service c5cf8c
                        const int indx[], const int edges[], int *newrank);
Packit Service c5cf8c
Packit Service c5cf8c
int MPIR_Dist_graph_neighbors_count_impl(MPIR_Comm * comm_ptr, int *indegree, int *outdegree,
Packit Service c5cf8c
                                         int *weighted);
Packit Service c5cf8c
int MPIR_Dist_graph_neighbors_impl(MPIR_Comm * comm_ptr, int maxindegree, int sources[],
Packit Service c5cf8c
                                   int sourceweights[], int maxoutdegree, int destinations[],
Packit Service c5cf8c
                                   int destweights[]);
Packit Service c5cf8c
Packit Service c5cf8c
#endif /* MPIR_TOPO_H_INCLUDED */