changing the MCA framework glue functions after a chat with jeff.
This commit was SVN r835.
Этот коммит содержится в:
родитель
db0cc3ca9f
Коммит
ccfa6499fe
@ -171,7 +171,11 @@ int mca_topo_base_select (mca_topo_t *selected,
|
||||
* function pointers. This is yet to be done
|
||||
*/
|
||||
if (NULL != om->om_actions->init) {
|
||||
/*
|
||||
* commenting this out for now since I m
|
||||
* not sure of the calling conventions
|
||||
(void)om->om_actions->init();
|
||||
*/
|
||||
}
|
||||
mca_topo_base_selected_module = *best_module;
|
||||
mca_topo = *(om->om_actions);
|
||||
|
@ -51,8 +51,8 @@
|
||||
*/
|
||||
typedef const struct mca_topo_1_0_0_t *
|
||||
(*mca_topo_base_comm_query_1_0_0_fn_t)(int *priority,
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
|
||||
typedef int (*mca_topo_base_comm_finalize_1_0_0_fn_t) (void);
|
||||
/*
|
||||
@ -83,7 +83,9 @@ typedef mca_topo_base_module_1_0_0_t mca_topo_base_module_t;
|
||||
* ***********************************************************************
|
||||
*/
|
||||
|
||||
typedef int (*mca_topo_base_init_1_0_0_fn_t)(void);
|
||||
typedef int (*mca_topo_base_init_1_0_0_fn_t)
|
||||
(lam_commmunicator_t *comm,
|
||||
mca_topo_1_0_0_t **new_topo);
|
||||
|
||||
typedef int (*mca_topo_base_cart_coords_fn_t)
|
||||
(lam_communicator_t* comm,
|
||||
|
@ -6,69 +6,15 @@
|
||||
#include "mca/mpi/topo/base/base.h"
|
||||
|
||||
|
||||
static const mca_topo_t unity {
|
||||
|
||||
/*
|
||||
* Per-communicator initialization and finalization functions
|
||||
*/
|
||||
mca_topo_unity_init,
|
||||
mca_topo_unity_finalize,
|
||||
|
||||
NULL, /* topo_cart_coords */
|
||||
NULL, /* topo_cart_create */
|
||||
NULL, /* topo_cart_get */
|
||||
NULL, /* topo_cartdim_get */
|
||||
mca_topo_unity_cart_map,
|
||||
NULL, /* topo_cart_rank */
|
||||
NULL, /* topo_cart_shift */
|
||||
NULL, /* topo_cart_sub */
|
||||
NULL, /* topo_graph_create */
|
||||
NULL, /* topo_graph_get */
|
||||
mca_topo_unity_graph_map,
|
||||
NULL, /* topo_graph_neighbors */
|
||||
NULL, /* topo_graph_neighbors_count */
|
||||
};
|
||||
|
||||
/*
|
||||
* Initial query function that is invoked during MPI_INIT, allowing
|
||||
* this module to indicate what level of thread support it provides
|
||||
*/
|
||||
int mca_topo_unity_init_query (int *thread_min, int *thread_max) {
|
||||
|
||||
*thread_min = MPI_THREAD_SINGLE;
|
||||
*thread_max = MPI_THREAD_MULTIPLE;
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init on the communicator
|
||||
* Init on the communicator. This function is called once the
|
||||
* module has been selected for a particular communicator. As
|
||||
* of now, do nothing
|
||||
*/
|
||||
int mca_topo_unity_init (lam_communicator_t *comm,
|
||||
const mca_topo_1_0_0_t **new_topo) {
|
||||
const mca_topo_t **new_topo) {
|
||||
/*
|
||||
* Nothing to init on the communicator
|
||||
*/
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init on the communicator
|
||||
*/
|
||||
int mca_topo_unity_finalize (lam_communicator_t *comm) {
|
||||
|
||||
/*
|
||||
* Nothing to finalize on the communicator
|
||||
*/
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
int mca_topo_1_0_0_t *mca_topo_unity_comm_query (lam_communicator_t *comm,
|
||||
int *priority) {
|
||||
|
||||
/*
|
||||
* This is the unity module and hence the priority is 0
|
||||
*/
|
||||
*priority = 0;
|
||||
return &unity;
|
||||
}
|
||||
|
@ -0,0 +1,98 @@
|
||||
/** @file
|
||||
*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_TOPO_UNTIY_H
|
||||
#define MCA_TOPO_UNTIY_H
|
||||
|
||||
#include "lam/threads/condition.h"
|
||||
#include "lam/mem/free_list.h"
|
||||
#include "lam/util/cmd_line.h"
|
||||
#include "mpi/request/request.h"
|
||||
#include "mca/mpi/topo/topo.h"
|
||||
|
||||
/*
|
||||
* This structure is the interface to the MCA world. It contains the
|
||||
* version information and the four functions (see below) which
|
||||
* are needed for this module to function with the MCA framework
|
||||
*/
|
||||
extern struct mca_topo_base_module_1_0_0_t mca_topo_unity_module;
|
||||
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ******** functions which provide MCA interface comppliance *******
|
||||
* ******************************************************************
|
||||
* These functions are:
|
||||
* - mca_topo_unity_module_open
|
||||
* - mca_topo_unity_module_close
|
||||
* - mca_topo_unity_module_query
|
||||
* - mca_topo_unity_module_finalize
|
||||
* These functions are always found on the mca_topo_unity_module
|
||||
* structure. They are the "meta" functions to ensure smooth op.
|
||||
* ******************************************************************
|
||||
*/
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_topo_unity_module_open (void);
|
||||
|
||||
int mca_topo_unity_module_close(void);
|
||||
|
||||
mca_topo_t*
|
||||
mca_topo_unity_module_query (int *priority,
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
|
||||
int mca_topo_unity_module_finalize (void);
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ********************* meta functions end *************************
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ********* functions which are implemented in this module *********
|
||||
* ******************************************************************
|
||||
* This module defines just 2 functions:
|
||||
* - graph_map
|
||||
* - cart_map
|
||||
* rest of the functions are filled in from the "base" module. Authors
|
||||
* of other such topology modules are required to define only these 2
|
||||
* functions. They are ofcourse free to implement all of them too :-)
|
||||
* ******************************************************************
|
||||
*/
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_topo_unity_init (lam_communicator_t *comm,
|
||||
mca_topo_t **new_topo);
|
||||
|
||||
int mca_topo_unity_cart_map (lam_communicator_t *comm,
|
||||
int ndims,
|
||||
int *dims,
|
||||
int *periods,
|
||||
int *newrank);
|
||||
|
||||
int mca_topo_unity_graph_map (lam_communicator_t *comm,
|
||||
int nnodes,
|
||||
int *index,
|
||||
int *edges,
|
||||
int *newrank);
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* ******************************************************************
|
||||
* ************ functions implemented in this module end ************
|
||||
* ******************************************************************
|
||||
*/
|
||||
|
||||
#endif /* MCA_TOPO_UNITY_H */
|
@ -21,34 +21,95 @@ const char *mca_topo_unity_module_version_string =
|
||||
"LAM/MPI unity topology MCA module version" MCA_TOPO_UNITY_VERSION;
|
||||
|
||||
/*
|
||||
* Instntiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
* *******************************************************************
|
||||
* ****** this is the structure that defines the module **************
|
||||
* *******************************************************************
|
||||
* this structure contains the module version information along with
|
||||
* some meta data and function pointers which allow a module to
|
||||
* interact with the MCA framework. module open() and close() are
|
||||
* called during MPI_INIT and MPI_FINALIZE respectively and query()
|
||||
* and finalize() are called during creation/destruction of a comm
|
||||
* *******************************************************************
|
||||
*/
|
||||
const mca_topo_base_module_1_0_0_t mca_topo_unity_module = {
|
||||
{
|
||||
MCA_TOPO_UNITY_VERSION_1_0_0, /* version number */
|
||||
"unity", /* module name */
|
||||
MCA_TOPO_UNITY_MAJOR_VERSION, /* major version */
|
||||
MCA_TOPO_UNITY_MINOR_VERSION, /* minor version */
|
||||
MCA_TOPO_UNITY_RELEASE_VERSION, /* release version */
|
||||
mca_topo_unity_module_open, /* fp to open the module */
|
||||
mca_topo_unity_module_close /* fp to close the module */
|
||||
},
|
||||
{
|
||||
false /* whether checkpoint/restart is enabled */
|
||||
},
|
||||
mca_topo_unity_comm_query, /* get priority and actions */
|
||||
mca_topo_unity_comm_finalize /* undo actions of query */
|
||||
};
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ******************** structure definition ends ********************
|
||||
* *******************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************ actions structure ************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
static const mca_topo_t unity {
|
||||
mca_topo_unity_init, /* initalise after being selected */
|
||||
NULL, /* topo_cart_coords */
|
||||
NULL, /* topo_cart_create */
|
||||
NULL, /* topo_cart_get */
|
||||
NULL, /* topo_cartdim_get */
|
||||
mca_topo_unity_cart_map,
|
||||
NULL, /* topo_cart_rank */
|
||||
NULL, /* topo_cart_shift */
|
||||
NULL, /* topo_cart_sub */
|
||||
NULL, /* topo_graph_create */
|
||||
NULL, /* topo_graph_get */
|
||||
mca_topo_unity_graph_map,
|
||||
NULL, /* topo_graph_neighbors */
|
||||
NULL, /* topo_graph_neighbors_count */
|
||||
};
|
||||
/*
|
||||
* *******************************************************************
|
||||
* ************************* structure ends **************************
|
||||
* *******************************************************************
|
||||
*/
|
||||
|
||||
const mca_topo_base_module_1_0_0_t mca_topo_unity_module = {
|
||||
int mca_topo_unity_module_open (void) {
|
||||
/*
|
||||
* First, the mca_modult_t struct containing meta information
|
||||
* about the module itself
|
||||
* As of now do nothing
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* Indicate that we are a topo v1.0.0 module (which also
|
||||
* implies a specific MCA version)
|
||||
*/
|
||||
MCA_TOPO_UNITY_VERSION_1_0_0,
|
||||
/*
|
||||
* MOdule name and version
|
||||
*/
|
||||
"unity",
|
||||
MCA_TOPO_UNITY_MAJOR_VERSION,
|
||||
MCA_TOPO_UNITY_MINOR_VERSION,
|
||||
MCA_TOPO_UNITY_RELEASE_VERSION,
|
||||
/*
|
||||
* Module open and cose functions
|
||||
*/
|
||||
NULL,
|
||||
NULL
|
||||
},
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
int mca_topo_unity_module_close (void) {
|
||||
/*
|
||||
* Next the MCA
|
||||
* As of now do nothing
|
||||
*/
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
mca_topo_t* mca_topo_unity_module_query(int* priority,
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads)
|
||||
{
|
||||
*priority = 0;
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_threads = false;
|
||||
/*
|
||||
* return the structure of function pointers
|
||||
*/
|
||||
return &unity;
|
||||
}
|
||||
|
||||
int mca_topo_unity_module_finalize (void) {
|
||||
/*
|
||||
* do nothing as of now
|
||||
*/
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user