2004-01-09 11:27:58 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-11-22 03:37:56 +03:00
|
|
|
* $HEADER$
|
2004-01-09 11:27:58 +03:00
|
|
|
*/
|
|
|
|
|
2004-01-09 11:38:06 +03:00
|
|
|
#ifndef MCA_TOPO_H
|
|
|
|
#define MCA_TOPO_H
|
2004-01-09 11:27:58 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-09 11:27:58 +03:00
|
|
|
|
2004-03-07 01:32:07 +03:00
|
|
|
#include "mpi.h"
|
|
|
|
#include "mca/mca.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mca/base/base.h"
|
2004-03-08 02:53:21 +03:00
|
|
|
|
2004-03-07 01:32:07 +03:00
|
|
|
/*
|
2004-03-08 02:53:21 +03:00
|
|
|
* ******************************************************************
|
2004-08-02 04:24:22 +04:00
|
|
|
* ********** Use in components that are of type topo v1.0.0 ********
|
2004-03-08 02:53:21 +03:00
|
|
|
* ******************************************************************
|
2004-03-07 01:32:07 +03:00
|
|
|
*/
|
2004-03-08 02:53:21 +03:00
|
|
|
#define MCA_TOPO_BASE_VERSION_1_0_0 \
|
|
|
|
/* topo v1.0 is chained to MCA v1.0 */ \
|
|
|
|
MCA_BASE_VERSION_1_0_0, \
|
|
|
|
/* topo v1.0 */ \
|
|
|
|
"topo", 1, 0, 0
|
2004-03-07 01:32:07 +03:00
|
|
|
/*
|
2004-03-08 02:53:21 +03:00
|
|
|
* ******************************************************************
|
|
|
|
* **************************** Macro ends **************************
|
|
|
|
* ******************************************************************
|
2004-03-07 01:32:07 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2004-08-02 04:24:22 +04:00
|
|
|
* These are the component function prototypes. These function pointers
|
|
|
|
* go into the component structure. These functions (query() and finalize()
|
|
|
|
* are called during topo_base_select(). Each component is query() ied
|
|
|
|
* and subsequently, all the unselected components are finalize() 'ed
|
2004-03-08 02:53:21 +03:00
|
|
|
* so that any *stuff* they did during query() can be undone. By
|
2004-08-02 04:24:22 +04:00
|
|
|
* similar logic, finalize() is also called on the component which
|
2004-03-08 02:53:21 +03:00
|
|
|
* was selected when the communicator is being destroyed.
|
|
|
|
*
|
2004-08-02 04:24:22 +04:00
|
|
|
* So, to sum it up, every component carries 4 functions:
|
2004-03-08 02:53:21 +03:00
|
|
|
* 1. open() - called during MPI_INIT
|
|
|
|
* 2. close() - called during MPI_FINALIZE
|
2004-08-02 04:24:22 +04:00
|
|
|
* 3. query() - called to select a particular component
|
2004-03-08 02:53:21 +03:00
|
|
|
* 4. finalize() - called when actions taken during query have
|
|
|
|
* to be undone
|
2004-03-07 01:32:07 +03:00
|
|
|
*/
|
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
2004-08-02 04:24:22 +04:00
|
|
|
* **************** component struct *******************************
|
|
|
|
* *********** These functions go in the component struct **********
|
|
|
|
* **************** component struct *******************************
|
2004-03-08 02:53:21 +03:00
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_component_init_query_1_0_0_fn_t)
|
2005-03-27 17:05:23 +04:00
|
|
|
(bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads);
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct mca_topo_base_module_1_0_0_t*
|
|
|
|
(*mca_topo_base_component_comm_query_1_0_0_fn_t) (int *priority);
|
2004-07-21 02:35:54 +04:00
|
|
|
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_component_comm_unquery_1_0_0_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm);
|
2004-07-21 02:35:54 +04:00
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
2004-08-02 04:24:22 +04:00
|
|
|
* ****************** component struct ******************************
|
|
|
|
* Structure for topo v1.0.0 components.This is chained to MCA v1.0.0
|
|
|
|
* ****************** component struct ******************************
|
2004-03-08 02:53:21 +03:00
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_topo_base_component_1_0_0_t {
|
|
|
|
mca_base_component_t topom_version;
|
|
|
|
mca_base_component_data_1_0_0_t topom_data;
|
|
|
|
|
|
|
|
mca_topo_base_component_init_query_1_0_0_fn_t topom_init_query;
|
|
|
|
mca_topo_base_component_comm_query_1_0_0_fn_t topom_comm_query;
|
|
|
|
mca_topo_base_component_comm_unquery_1_0_0_fn_t topom_comm_unquery;
|
2004-03-08 02:53:21 +03:00
|
|
|
};
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct mca_topo_base_component_1_0_0_t mca_topo_base_component_1_0_0_t;
|
|
|
|
typedef mca_topo_base_component_1_0_0_t mca_topo_base_component_t;
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
|
|
|
* ******************************************************************
|
2004-08-02 04:24:22 +04:00
|
|
|
* *********************** component struct ends here ***************
|
2004-03-08 02:53:21 +03:00
|
|
|
* ******************************************************************
|
|
|
|
*/
|
2004-04-17 00:54:48 +04:00
|
|
|
/*
|
|
|
|
* ******************************************************************
|
2004-08-02 04:24:22 +04:00
|
|
|
* *********************** information structure *******************
|
|
|
|
* Note for component authors:
|
2004-07-21 02:35:54 +04:00
|
|
|
* If you find that this is not the most convinient form of representing
|
|
|
|
* your topology, then please feel free to define your own structure in
|
|
|
|
* which this structure is the first element. That way, type casting can
|
2004-08-02 04:24:22 +04:00
|
|
|
* used to communicate between 2 different topo components. Note that this
|
2004-07-21 02:35:54 +04:00
|
|
|
* representation must be filled up no matter what the actual topo
|
|
|
|
* structure might be
|
2004-04-17 00:54:48 +04:00
|
|
|
* ******************************************************************
|
|
|
|
*/
|
2004-07-21 02:35:54 +04:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_topo_base_comm_1_0_0_t {
|
2004-07-21 02:35:54 +04:00
|
|
|
|
|
|
|
/* The first section represents data which is passed on to the
|
|
|
|
* structure by the user when creating the topology. This info
|
2004-08-02 04:24:22 +04:00
|
|
|
* is cached on so that if required another component can create the
|
|
|
|
* topology again when comm_dup fails to pick the same component */
|
2004-07-21 02:35:54 +04:00
|
|
|
|
|
|
|
int mtc_ndims_or_nnodes; /**< Number of cart dimensions */
|
|
|
|
int *mtc_dims_or_index; /**< Cart dimensions */
|
|
|
|
int *mtc_periods_or_edges; /**< whether this was a periodic cart */
|
|
|
|
bool mtc_reorder; /**< Whether the re-ordering is allowed */
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* The second section is used by the unity component since it does not
|
|
|
|
* hang its own structure off the communicator. Any component which wishes
|
2004-07-21 02:35:54 +04:00
|
|
|
* to use the base/topo_base* functions to fill in their unimplemented
|
|
|
|
* functions should and must fill this portion up */
|
|
|
|
|
|
|
|
int *mtc_coords; /**< Cart coordinates */
|
2004-04-17 00:54:48 +04:00
|
|
|
};
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct mca_topo_base_comm_1_0_0_t mca_topo_base_comm_1_0_0_t;
|
|
|
|
typedef mca_topo_base_comm_1_0_0_t mca_topo_base_comm_t;
|
2004-04-17 00:54:48 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ******************************************************************
|
|
|
|
* *********************** information structure ******************
|
|
|
|
* ******************************************************************
|
|
|
|
*/
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2005-09-13 00:22:59 +04:00
|
|
|
struct ompi_proc_t;
|
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
|
|
|
* ***********************************************************************
|
|
|
|
* ************************ Interface function definitions **************
|
|
|
|
* These are the typedefs for the function pointers to various topology
|
2004-08-02 04:24:22 +04:00
|
|
|
* backend functions which will be used by the various topology components
|
2004-03-08 02:53:21 +03:00
|
|
|
* ***********************************************************************
|
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_init_1_0_0_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm);
|
2004-07-21 02:35:54 +04:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_finalize_1_0_0_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm);
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_coords_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int rank,
|
|
|
|
int maxdims,
|
|
|
|
int *coords);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_create_fn_t)
|
|
|
|
(mca_topo_base_comm_t *topo_data,
|
2004-07-21 02:35:54 +04:00
|
|
|
int *proc_count,
|
2005-09-13 00:22:59 +04:00
|
|
|
struct ompi_proc_t **proc_pointers,
|
2004-07-21 02:35:54 +04:00
|
|
|
int *new_rank,
|
2004-03-08 02:53:21 +03:00
|
|
|
int ndims,
|
|
|
|
int *dims,
|
|
|
|
int *periods,
|
2004-07-21 02:35:54 +04:00
|
|
|
bool redorder);
|
2004-03-08 02:53:21 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_get_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int maxdims,
|
|
|
|
int *dims,
|
|
|
|
int *periods,
|
|
|
|
int *coords);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cartdim_get_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int *ndims);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_map_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int ndims,
|
|
|
|
int *dims,
|
|
|
|
int *periods,
|
|
|
|
int *newrank);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_rank_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int *coords,
|
|
|
|
int *rank);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_shift_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int direction,
|
|
|
|
int disp,
|
|
|
|
int *rank_source,
|
|
|
|
int *rank_dest);
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_cart_sub_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int *remain_dims,
|
2004-08-02 04:24:22 +04:00
|
|
|
struct ompi_communicator_t ** new_comm);
|
2004-03-08 02:53:21 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_graph_create_fn_t)
|
|
|
|
(mca_topo_base_comm_t *topo_data,
|
2004-07-21 02:35:54 +04:00
|
|
|
int *proc_count,
|
2005-09-13 00:22:59 +04:00
|
|
|
struct ompi_proc_t **proc_pointers,
|
2004-07-21 02:35:54 +04:00
|
|
|
int *new_rank,
|
2004-03-08 02:53:21 +03:00
|
|
|
int nnodes,
|
|
|
|
int *index,
|
|
|
|
int *edges,
|
2004-07-21 02:35:54 +04:00
|
|
|
bool reorder);
|
2004-03-08 02:53:21 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_graph_get_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int maxindex,
|
|
|
|
int maxedges,
|
|
|
|
int *index,
|
|
|
|
int *edges);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_graph_map_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int nnodes,
|
|
|
|
int *index,
|
|
|
|
int *edges,
|
|
|
|
int *newrank);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_graphdims_get_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-04-22 00:55:54 +04:00
|
|
|
int *nnodes,
|
|
|
|
int *nnedges);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_graph_neighbors_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int rank,
|
|
|
|
int maxneighbors,
|
|
|
|
int *neighbors);
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef int (*mca_topo_base_module_graph_neighbors_count_fn_t)
|
|
|
|
(struct ompi_communicator_t *comm,
|
2004-03-08 02:53:21 +03:00
|
|
|
int rank,
|
|
|
|
int *nneighbors);
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
|
|
|
* ***********************************************************************
|
|
|
|
* ******************** Interface function definitions end **************
|
|
|
|
* ***********************************************************************
|
|
|
|
*/
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
|
|
|
* ***********************************************************************
|
2004-08-02 04:24:22 +04:00
|
|
|
* *************************** module structure *************************
|
2004-03-08 02:53:21 +03:00
|
|
|
* ***********************************************************************
|
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
struct mca_topo_base_module_1_0_0_t {
|
2004-03-08 02:53:21 +03:00
|
|
|
/*
|
|
|
|
* Per-communicator initialization function. This is called only
|
|
|
|
* on the module which is selected. The finalize corresponding to
|
2004-08-02 04:24:22 +04:00
|
|
|
* this function is present on the component struct above
|
2004-03-08 02:53:21 +03:00
|
|
|
*/
|
2004-07-21 02:35:54 +04:00
|
|
|
mca_topo_base_module_init_1_0_0_fn_t topo_module_init;
|
|
|
|
mca_topo_base_module_finalize_1_0_0_fn_t topo_module_finalize;
|
2004-03-07 01:32:07 +03:00
|
|
|
|
|
|
|
/* Graph related functions */
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_topo_base_module_cart_coords_fn_t topo_cart_coords;
|
|
|
|
mca_topo_base_module_cart_create_fn_t topo_cart_create;
|
|
|
|
mca_topo_base_module_cart_get_fn_t topo_cart_get;
|
|
|
|
mca_topo_base_module_cartdim_get_fn_t topo_cartdim_get;
|
|
|
|
mca_topo_base_module_cart_map_fn_t topo_cart_map;
|
|
|
|
mca_topo_base_module_cart_rank_fn_t topo_cart_rank;
|
|
|
|
mca_topo_base_module_cart_shift_fn_t topo_cart_shift;
|
|
|
|
mca_topo_base_module_cart_sub_fn_t topo_cart_sub;
|
|
|
|
mca_topo_base_module_graph_create_fn_t topo_graph_create;
|
|
|
|
mca_topo_base_module_graph_get_fn_t topo_graph_get;
|
|
|
|
mca_topo_base_module_graph_map_fn_t topo_graph_map;
|
|
|
|
mca_topo_base_module_graphdims_get_fn_t topo_graphdims_get;
|
|
|
|
mca_topo_base_module_graph_neighbors_fn_t topo_graph_neighbors;
|
|
|
|
mca_topo_base_module_graph_neighbors_count_fn_t topo_graph_neighbors_count;
|
2004-03-07 01:32:07 +03:00
|
|
|
};
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct mca_topo_base_module_1_0_0_t mca_topo_base_module_1_0_0_t;
|
|
|
|
typedef mca_topo_base_module_1_0_0_t mca_topo_base_module_t;
|
2004-03-07 01:32:07 +03:00
|
|
|
/*
|
2004-03-08 02:53:21 +03:00
|
|
|
* ***********************************************************************
|
2004-08-02 04:24:22 +04:00
|
|
|
* ******************* component actions structure ends *****************
|
2004-03-08 02:53:21 +03:00
|
|
|
* ***********************************************************************
|
|
|
|
*/
|
2004-03-07 01:32:07 +03:00
|
|
|
|
2004-03-08 02:53:21 +03:00
|
|
|
|
2004-01-09 11:38:06 +03:00
|
|
|
#endif /* MCA_TOPO_H */
|