From c53ee4db92a0358233a79cea45e48b6076d77699 Mon Sep 17 00:00:00 2001 From: Prabhanjan Kambadur Date: Sat, 6 Mar 2004 22:40:26 +0000 Subject: [PATCH] The 'base' functions for topology. Topology module authors need not bother to write these fucntions in their modules. They can leave the function pointers as NULL. This commit was SVN r823. --- src/mca/mpi/topo/base/base.h | 78 +++++++++++++++++++ src/mca/mpi/topo/base/topo_base_cart_coords.c | 5 ++ src/mca/mpi/topo/base/topo_base_cart_create.c | 6 ++ src/mca/mpi/topo/base/topo_base_cart_get.c | 6 ++ src/mca/mpi/topo/base/topo_base_cart_rank.c | 6 ++ src/mca/mpi/topo/base/topo_base_cart_shift.c | 6 ++ src/mca/mpi/topo/base/topo_base_cart_sub.c | 6 ++ src/mca/mpi/topo/base/topo_base_cartdim_get.c | 6 ++ src/mca/mpi/topo/base/topo_base_close.c | 27 +++++++ .../mpi/topo/base/topo_base_graph_create.c | 6 ++ .../mpi/topo/base/topo_base_graph_dims_get.c | 6 ++ src/mca/mpi/topo/base/topo_base_graph_get.c | 6 ++ .../mpi/topo/base/topo_base_graph_neighbor.c | 6 ++ .../base/topo_base_graph_neighbors_count.c | 6 ++ src/mca/mpi/topo/base/topo_base_open.c | 40 ++++++++++ src/mca/mpi/topo/base/topo_base_select.c | 22 ++++++ 16 files changed, 238 insertions(+) create mode 100644 src/mca/mpi/topo/base/base.h create mode 100644 src/mca/mpi/topo/base/topo_base_cart_coords.c create mode 100644 src/mca/mpi/topo/base/topo_base_cart_create.c create mode 100644 src/mca/mpi/topo/base/topo_base_cart_get.c create mode 100644 src/mca/mpi/topo/base/topo_base_cart_rank.c create mode 100644 src/mca/mpi/topo/base/topo_base_cart_shift.c create mode 100644 src/mca/mpi/topo/base/topo_base_cart_sub.c create mode 100644 src/mca/mpi/topo/base/topo_base_cartdim_get.c create mode 100644 src/mca/mpi/topo/base/topo_base_close.c create mode 100644 src/mca/mpi/topo/base/topo_base_graph_create.c create mode 100644 src/mca/mpi/topo/base/topo_base_graph_dims_get.c create mode 100644 src/mca/mpi/topo/base/topo_base_graph_get.c create mode 100644 src/mca/mpi/topo/base/topo_base_graph_neighbor.c create mode 100644 src/mca/mpi/topo/base/topo_base_graph_neighbors_count.c create mode 100644 src/mca/mpi/topo/base/topo_base_open.c create mode 100644 src/mca/mpi/topo/base/topo_base_select.c diff --git a/src/mca/mpi/topo/base/base.h b/src/mca/mpi/topo/base/base.h new file mode 100644 index 0000000000..b7d7f10d55 --- /dev/null +++ b/src/mca/mpi/topo/base/base.h @@ -0,0 +1,78 @@ +/* + * $HEADER$ + */ + +#ifndef MCA_TOPO_BASE_H +#define MCA_TOPO_BASE_H + +#include "lam_config.h" +#include "mpi.h" + +/* + * All stuff goes in here + */ +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + int mca_topo_base_open(void); + int mca_topo_base_select(lam_list_t *selected, + bool *allow_multi_user_threads, + bool *have_hidden_threads); + + const mca_topo_1_0_0_t * + mca_topo_unity_query(lam_comm_t *comm, int priority); + int mca_topo_base_close(void); + + int mca_topo_base_init_comm (lam_comm_t *comm); + int mca_topo_base_get_param (lam_comm_t *comm, int keyval); + + /* + * All the glue functions which we will provide to the users + * by default. The users need to only write back-end functions + * for graph_map() and cart_map() for their topology modules. + * But they can implement these glue functions if they want. + */ + int topo_base_cart_coords (lam_comm_t *comm, int rank, int maxdims, + int *coords); + + int topo_base_cart_create (lam_comm_t *old_comm, int ndims, int *dims, + int *peroids, int reorder, + lam_comm_t *comm_cart); + + int topo_base_cartdim_get (lam_comm_t *comm, int *ndims); + + int topo_base_cart_get (lam_comm_t *comm, int maxdims, int *dims, + int *periods, int *coords); + + int topo_base_cart_rank (lam_comm_t *comm, int *coords, int *rank); + + int topo_base_cart_shift (lam_comm_t *comm, int direction, int disp, + int *rank_source, int *rank_dest); + + int topo_base_cart_sub (lam_comm_t *comm, int *remain_dims, + lam_comm_t **new_comm); + + int topo_base_graph_create (lam_comm_t *comm_old, int nnodes, + int *index, int reorder, + lam_comm_t **comm_graph); + + int topo_base_graph_dims_get (lam_comm_t *comm, int *nodes, + int *nedges); + + int topo_base_graph_get (lam_comm_t *comm, int maxindex, + int maxedges, int *index, int *edges); + + int topo_base_graph_neighbors (lam_comm_t *comm, int rank, + int maxneighbors, int *neighbors); + + int topo_base_graph_neighbors_count (lam_comm_t *comm, int rank, + int *nneighbors); + + +/* + * Globals + */ +extern int mca_topo_base_output; +extern lam_list_t mca_topo_base_modules_available; + +#endif /* MCA_BASE_TOPO_H */ diff --git a/src/mca/mpi/topo/base/topo_base_cart_coords.c b/src/mca/mpi/topo/base/topo_base_cart_coords.c new file mode 100644 index 0000000000..413f6fff39 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cart_coords.c @@ -0,0 +1,5 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" diff --git a/src/mca/mpi/topo/base/topo_base_cart_create.c b/src/mca/mpi/topo/base/topo_base_cart_create.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cart_create.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_cart_get.c b/src/mca/mpi/topo/base/topo_base_cart_get.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cart_get.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_cart_rank.c b/src/mca/mpi/topo/base/topo_base_cart_rank.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cart_rank.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_cart_shift.c b/src/mca/mpi/topo/base/topo_base_cart_shift.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cart_shift.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_cart_sub.c b/src/mca/mpi/topo/base/topo_base_cart_sub.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cart_sub.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_cartdim_get.c b/src/mca/mpi/topo/base/topo_base_cartdim_get.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_cartdim_get.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_close.c b/src/mca/mpi/topo/base/topo_base_close.c new file mode 100644 index 0000000000..14321dbce1 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_close.c @@ -0,0 +1,27 @@ +/* + * $HEADER$ + */ +#include "lam_config.h" + +#include + +#include "lam/constants.h" +#include "mca/mca.h" +#include "mca/lam/base/base.h" +#include "mca/mpi/coll/coll.h" +#include "mca/mpi/coll/base/base.h" + +int mca_topo_base_close(void) { + extern lam_list_t mca_topo_base_modules_available; + + /* + * Close all the available modules + */ + mca_base_modules_close (mca_topo_base_output, + &mca_topo_base_modules_available, NULL); + + /* + * All done + */ + return LAM_SUCCESS; +} diff --git a/src/mca/mpi/topo/base/topo_base_graph_create.c b/src/mca/mpi/topo/base/topo_base_graph_create.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_graph_create.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_graph_dims_get.c b/src/mca/mpi/topo/base/topo_base_graph_dims_get.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_graph_dims_get.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_graph_get.c b/src/mca/mpi/topo/base/topo_base_graph_get.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_graph_get.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_graph_neighbor.c b/src/mca/mpi/topo/base/topo_base_graph_neighbor.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_graph_neighbor.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_graph_neighbors_count.c b/src/mca/mpi/topo/base/topo_base_graph_neighbors_count.c new file mode 100644 index 0000000000..d072bea033 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_graph_neighbors_count.c @@ -0,0 +1,6 @@ +/* + * $HEADER$ + */ + +#include "mca/topo/base/base.h" + diff --git a/src/mca/mpi/topo/base/topo_base_open.c b/src/mca/mpi/topo/base/topo_base_open.c new file mode 100644 index 0000000000..7b50ce6c96 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_open.c @@ -0,0 +1,40 @@ +/* + * $HEADER$ + */ +#include "lam_config.h" + +#include + +#include "mca/mca.h" +#include "mca/lam/base/base.h" +#include "mca/mpi/topo/base/base.h" + +/* + * The static-module.h is generated by the configure script. It contains + * statements and the definition of an array of pointers to each module's + * public mca_base_module_t struct. + */ +#include "mca/mpi/topo/base/static-modules.h" + +/* + * Global variables + */ +int mca_topo_base_output = -1; +lam_list_t mca_topo_base_modules_available; + +/** + * Functions for finding and opening either all the MCA topo modules, or + * the one that specifically requested via a MCA parameter. + */ +int mca_topo_base_open(void) { + /* + * Open up all available modules + */ + if (LAM_SUCCESS != + mca_base_modules_open("topo", 0, mca_topo_base_static_modules, + &mca_topo_base_modules_available)) { + return LAM_ERROR; + } + + return LAM_SUCCESS; +} diff --git a/src/mca/mpi/topo/base/topo_base_select.c b/src/mca/mpi/topo/base/topo_base_select.c new file mode 100644 index 0000000000..162ffa7541 --- /dev/null +++ b/src/mca/mpi/topo/base/topo_base_select.c @@ -0,0 +1,22 @@ +/* + * $HEADER$ + */ + +#include "lam_config.h" +#include "mca/mca.h" +#include "mca/mpi/topo/topo.h" +#include "mca/mpi/topo/base/base.h" + +int mca_topo_base_select (lam_list_t *selected, + bool *allow_multi_user_thread, + bool *have_hidden_threads) { + + /* + * Nothing to be done as of now + */ + *allow_multi_user_threads = true; + *have_hidden_threads = false; + + return LAM_SUCCESS; +} +