diff --git a/src/mca/.cvsignore b/src/mca/.cvsignore index 282522db03..90af8be5b0 100644 --- a/src/mca/.cvsignore +++ b/src/mca/.cvsignore @@ -1,2 +1,5 @@ Makefile Makefile.in +.libs +*.la +dynamic-* diff --git a/src/mca/Makefile.am b/src/mca/Makefile.am index f032e508f2..d563484034 100644 --- a/src/mca/Makefile.am +++ b/src/mca/Makefile.am @@ -4,12 +4,24 @@ include $(top_srcdir)/config/Makefile.options -SUBDIRS = lam mpi +SUBDIRS = lam mpi # Source code files headers = mca.h +# Library + +noinst_LTLIBRARIES = libmca_lam.la libmca_mpi.la + +libmca_mpi_la_SOURCES = +libmca_mpi_la_LIBADD = mpi/libmca_mpi_convenience.la +libmca_mpi_la_DEPENDENCIES = $(libmca_mpi_la_LIBADD) + +libmca_lam_la_SOURCES = +libmca_lam_la_LIBADD = lam/libmca_lam_convenience.la +libmca_lam_la_DEPENDENCIES = $(libmca_lam_la_LIBADD) + # Conditionally install the header files if WANT_INSTALL_HEADERS @@ -18,6 +30,3 @@ lam_HEADERS = $(headers) else lamdir = $(includedir) endif - - - diff --git a/src/mca/lam/.cvsignore b/src/mca/lam/.cvsignore index 282522db03..2a185d9fed 100644 --- a/src/mca/lam/.cvsignore +++ b/src/mca/lam/.cvsignore @@ -1,2 +1,4 @@ Makefile Makefile.in +.libs +*.la diff --git a/src/mca/lam/Makefile.am b/src/mca/lam/Makefile.am index e23261b6cb..eadac9bcc2 100644 --- a/src/mca/lam/Makefile.am +++ b/src/mca/lam/Makefile.am @@ -4,4 +4,31 @@ include $(top_srcdir)/config/Makefile.options -SUBDIRS = oob pcm registry +# base should be listed first because it should be built first +# (probably not for any technical rason, but it makes sense to build +# the base first). common_lam must be second, however, because +# modules under there may be statically linked to other modules. + +SUBDIRS = base common_lam pcm registry + +# Source code files + +#headers = lam.h + +# Library + +noinst_LTLIBRARIES = libmca_lam_convenience.la +libmca_lam_convenience_la_SOURCES = +libmca_lam_convenience_la_LIBADD = \ + base/libmca_lam_base.la +# Add base, common_lam, oob, pcm, registry as required +libmca_lam_convenience_la_DEPENDENCIES = $(libmca_lam_convenience_la_LIBADD) + +# Conditionally install the header files + +#if WANT_INSTALL_HEADERS +#lamdir = $(includedir)/lam/mca/lam +#lam_HEADERS = $(headers) +#else +#lamdir = $(includedir) +#endif diff --git a/src/mca/lam/base/.cvsignore b/src/mca/lam/base/.cvsignore new file mode 100644 index 0000000000..6e5ca7ed41 --- /dev/null +++ b/src/mca/lam/base/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.deps +.libs +*.lo +*.la diff --git a/src/mca/lam/base/Makefile.am b/src/mca/lam/base/Makefile.am new file mode 100644 index 0000000000..0caa3509fe --- /dev/null +++ b/src/mca/lam/base/Makefile.am @@ -0,0 +1,17 @@ +# +# $HEADER$ +# + +include $(top_srcdir)/config/Makefile.options + +noinst_LTLIBRARIES = libmca_lam_base.la + +# Source code files + +headers = \ + param.h + +# Library + +libmca_lam_base_la_SOURCES = \ + mca_lam_param.c diff --git a/src/mca/lam/base/mca_lam_param.c b/src/mca/lam/base/mca_lam_param.c new file mode 100644 index 0000000000..0be0037623 --- /dev/null +++ b/src/mca/lam/base/mca_lam_param.c @@ -0,0 +1,480 @@ +/* + * $HEADER$ + */ + +#include "lam_config.h" + +#include +#include +#include + +#include "lam/constants.h" +#include "lam/lfc/array.h" +#include "lam/util/malloc.h" +#include "mca/mca.h" +#include "mca/lam/base/param.h" + +/** @file **/ + +/* + * public variables + */ +/** + * @internal + */ +lam_array_t mca_base_params; + + +/* + * local variables + */ +static char *mca_prefix = "LAM_MPI_MCA_"; +static bool initialized = false; + + +/* + * local functions + */ +static int param_register(char *type_name, char *module_name, char *param_name, + char *mca_param_name, + mca_base_param_type_t type, + mca_base_param_storage_t *default_value); +static bool param_lookup(int index, mca_base_param_storage_t *storage); +static int param_compare(const void *a, const void *b); +static void param_free(mca_base_param_t *p); + + +/** + * Register an integer MCA parameter. + * + * @param type_name The MCA type (string). + * @param module_name The name of the module (string). + * @param param_name The name of the parameter being registered (string). + * @param mca_param_name If NULL, the user-visible name of the + * parameter is {type_name}_{module_name}_{param_name}. If this + * parameter is non-NULL, it is used instead of the default name. + * @param default_value The value that is used for this parameter if + * the user does not supply one. + * + * @retval LAM_ERROR Upon failure to register the parameter. + * @retval index Index value that can be used with + * mca_base_param_lookup_int() to retrieve the value of the parameter. + * + * This function registers an integer MCA parameter and associates it + * with a specific module. + * + * In most cases, mca_param_name should be NULL. Only in rare cases + * is it necessary (or advisable) to override the default name. + */ +int mca_base_param_register_int(char *type_name, char *module_name, + char *param_name, char *mca_param_name, + int default_value) +{ + mca_base_param_storage_t storage; + + storage.intval = default_value; + return param_register(type_name, module_name, param_name, mca_param_name, + MCA_BASE_PARAM_TYPE_INT, &storage); +} + + +/** + * Register a string MCA parameter. + * + * @param type_name The MCA type (string). + * @param module_name The name of the module (string). + * @param param_name The name of the parameter being registered (string). + * @param mca_param_name If NULL, the user-visible name of the + * parameter is {type_name}_{module_name}_{param_name}. If this + * parameter is non-NULL, it is used instead of the default name. + * @param default_value The value that is used for this parameter if + * the user does not supply one. + * + * @retval LAM_ERROR Upon failure to register the parameter. + * @retval index Index value that can be used with + * mca_base_param_lookup_string() to retrieve the value of the + * parameter. + * + * This function registers an string MCA parameter and associates it + * with a specific module. + * + * In most cases, mca_param_name should be NULL. Only in rare cases + * is it necessary (or advisable) to override the default name. + */ +int mca_base_param_register_string(char *type_name, char *module_name, + char *param_name, char *mca_param_name, + char *default_value) +{ + mca_base_param_storage_t storage; + + storage.stringval = default_value; + return param_register(type_name, module_name, param_name, mca_param_name, + MCA_BASE_PARAM_TYPE_STRING, &storage); +} + + +/** + * Look up an integer MCA parameter. + * + * @param index Index previous returned from + * mca_base_param_register_int(). + * @param value Pointer to int where the parameter value will be + * stored. + * + * @retvalue LAM_ERROR Upon failure. The contents of value are + * undefined. + * @retvalue LAM_SUCCESS Upon success. value will be filled with the + * parameter's current value. + * + * The value of a specific MCA parameter can be looked up using the + * return value from mca_base_param_register_int(). + */ +int mca_base_param_lookup_int(int index, int *value) +{ + mca_base_param_storage_t storage; + + if (param_lookup(index, &storage)) { + *value = storage.intval; + return LAM_SUCCESS; + } + return LAM_ERROR; +} + + +/** + * Look up a string MCA parameter. + * + * @param index Index previous returned from + * mca_base_param_register_string(). + * @param value Pointer to (char *) where the parameter value will be + * stored. + * + * @retvalue LAM_ERROR Upon failure. The contents of value are + * undefined. + * @retvalue LAM_SUCCESS Upon success. value will be filled with the + * parameter's current value. + * + * The value of a specific MCA parameter can be looked up using the + * return value from mca_base_param_register_string(). + */ +int mca_base_param_lookup_string(int index, char **value) +{ + mca_base_param_storage_t storage; + + if (param_lookup(index, &storage)) { + *value = storage.stringval; + return LAM_SUCCESS; + } + return LAM_ERROR; +} + + +/** + * Find the index for an MCA parameter based on its names. + * + * @param type_name Name of the type containing the parameter. + * @param module_name Name of the module containing the parameter. + * @param param_name Name of the parameter. + * + * @retval LAM_ERROR If the parameter was not found. + * @retval index If the parameter was found. + * + * It is not always convenient to widely propagate a parameter's index + * value, or it may be necessary to look up the parameter from a + * different module -- where it is not possible to have the return + * value from mca_base_param_register_int() or + * mca_base_param_register_string(). This function can be used to + * look up the index of any registered parameter. The returned index + * can be used with mca_base_param_lookup_int() and + * mca_base_param_lookup_string(). + */ +int mca_base_param_find(char *type_name, char *module_name, char *param_name) +{ + int i, size; + mca_base_param_t **array; + + /* Check for bozo cases */ + + if (!initialized) + return LAM_ERROR; + if (NULL == type_name || NULL == param_name) + return LAM_ERROR; + + /* Loop through looking for a parameter of a given + type/module/param */ + + array = (mca_base_param_t**) lam_arr_get_c_array(&mca_base_params, &size); + for (i = 0; i < size; ++i) { + if (0 == strcmp(type_name, array[i]->mbp_type_name) && + ((NULL == module_name && NULL == array[i]->mbp_module_name) || + (NULL != module_name && NULL != array[i]->mbp_module_name && + 0 == strcmp(module_name, array[i]->mbp_module_name))) && + 0 == strcmp(param_name, array[i]->mbp_param_name)) + return i; + } + + /* Didn't find it */ + + return LAM_ERROR; +} + + +/** + * Shut down the MCA parameter system (normally only invoked by the + * MCA framework itself). + * + * @returns LAM_SUCCESS This function never fails. + * + * This function shuts down the MCA parameter registry and frees all + * associated memory. No other mca_base_param*() functions can be + * invoked after this function. + * + * This function is normally only invoked by the MCA framework itself + * when the process is shutting down (e.g., during MPI_FINALIZE). It + * is only documented here for completeness. + */ +int mca_base_param_finalize(void) +{ + int i, size; + mca_base_param_t **array; + + if (initialized) { + array = (mca_base_param_t**) lam_arr_get_c_array(&mca_base_params, &size); + for (i = 0; i < size; ++i) + param_free(array[i]); + + lam_arr_destroy(&mca_base_params); + initialized = false; + } + + return LAM_SUCCESS; +} + + +/*************************************************************************/ + +static int +param_register(char *type_name, char *module_name, char *param_name, + char *mca_param_name, + mca_base_param_type_t type, + mca_base_param_storage_t *default_value) +{ + int i, len; + mca_base_param_t param, **array; + + /* Initialize the array if it has never been initialized */ + + if (!initialized) { + lam_arr_init(&mca_base_params); + initialized = true; + } + + /* Create a parameter entry. If a keyval is to be used, it will be + registered elsewhere. We simply assign -1 here. */ + + param.mbp_type = type; + param.mbp_keyval = -1; + + param.mbp_type_name = strdup(type_name); + if (NULL == param.mbp_type_name) + return LAM_ERROR; + if (NULL != module_name) { + param.mbp_module_name = strdup(module_name); + if (NULL == param.mbp_module_name) { + LAM_FREE(param.mbp_type_name); + return LAM_ERROR; + } + } else + param.mbp_module_name = NULL; + if (param_name != NULL) { + param.mbp_param_name = strdup(param_name); + if (NULL == param.mbp_param_name) { + LAM_FREE(param.mbp_type_name); + LAM_FREE(param.mbp_module_name); + return LAM_ERROR; + } + } else + param.mbp_param_name = NULL; + + /* The full parameter name may have been specified by the caller. + If it was, use that (only for backwards compatability). + Otherwise, derive it from the type, module, and parameter + name. */ + + param.mbp_env_var_name = NULL; + if (MCA_BASE_PARAM_INFO != mca_param_name && NULL != mca_param_name) { + param.mbp_full_name = strdup(mca_param_name); + } else { + len = 16 + strlen(type_name); + + if (NULL != module_name) + len += strlen(module_name); + if (NULL != param_name) + len += strlen(param_name); + + param.mbp_full_name = LAM_MALLOC(len); + if (NULL != param.mbp_full_name) { + LAM_FREE(param.mbp_type_name); + LAM_FREE(param.mbp_module_name); + LAM_FREE(param.mbp_param_name); + return LAM_ERROR; + } + strncpy(param.mbp_full_name, type_name, len); + + if (NULL != module_name) { + strcat(param.mbp_full_name, "_"); + strcat(param.mbp_full_name, module_name); + } + if (NULL != param_name) { + strcat(param.mbp_full_name, "_"); + strcat(param.mbp_full_name, param_name); + } + } + + /* If mca_param_name isn't MCA_BASE_PARAM_INFO, then it's a + lookup-able value. So amcagn the environment variable name as + well. */ + + if (MCA_BASE_PARAM_INFO != mca_param_name) { + len = strlen(param.mbp_full_name) + strlen(mca_prefix) + 16; + param.mbp_env_var_name = LAM_MALLOC(len); + if (NULL == param.mbp_env_var_name) { + LAM_FREE(param.mbp_full_name); + LAM_FREE(param.mbp_type_name); + LAM_FREE(param.mbp_module_name); + LAM_FREE(param.mbp_param_name); + return LAM_ERROR; + } + snprintf(param.mbp_env_var_name, len, "%s%s", mca_prefix, + param.mbp_full_name); + } + + /* Figure out the default value */ + + if (NULL != default_value) { + if (MCA_BASE_PARAM_TYPE_STRING == param.mbp_type && + NULL != default_value->stringval) + param.mbp_default_value.stringval = strdup(default_value->stringval); + else + param.mbp_default_value = *default_value; + } else + memset(¶m.mbp_default_value, 0, sizeof(param.mbp_default_value)); + + /* See if this entry is already in the Array */ + + array = (mca_base_param_t**) lam_arr_get_c_array(&mca_base_params, &len); + for (i = 0; i < len; ++i) + if (param_compare(¶m, array[i]) == 0) { + + /* Copy in the new default value to the old entry */ + + if (MCA_BASE_PARAM_TYPE_STRING == array[i]->mbp_type && + NULL != array[i]->mbp_default_value.stringval) + LAM_FREE(array[i]->mbp_default_value.stringval); + if (MCA_BASE_PARAM_TYPE_STRING == param.mbp_type && + NULL != param.mbp_default_value.stringval) + array[i]->mbp_default_value.stringval = + strdup(param.mbp_default_value.stringval); + + param_free(¶m); + return i; + } + + /* Add it to the array */ + + if (!lam_arr_append_item(&mca_base_params, (lam_object_t*) ¶m)) + return LAM_ERROR; + return lam_arr_get_size(&mca_base_params) - 1; +} + + +/* + * DO NOT MODIFY THIS FUNCTION WITHOUT ALSO MODIFYING mca_mpi_param.c! + * + * This function appears in liblam. Because of unix linker semantics, + * it's simply easier to essentially duplicate this function in libmpi + * because in libmpi, we need to lookup on a keyval before looking in + * the environment. The logic is simpler if we just duplicate/alter + * the code in mca_mpi_param.c rather than try to make this a) public, + * and b) more general (to accomodate looking up keyvals while not + * linking to MPI_Comm_get_attr() in libmpi). + */ +static bool +param_lookup(int index, mca_base_param_storage_t *storage) +{ + int size; + char *env; + mca_base_param_t *p; + + /* Lookup the index and see if it's valid */ + + if (!initialized) + return false; + if (lam_arr_get_size(&mca_base_params) < index) + return false; + p = ((mca_base_param_t*) lam_arr_get_c_array(&mca_base_params, + &size)) + index; + + /* We either don't have a keyval or didn't find it. So look in the + environment. */ + + if (NULL != p->mbp_env_var_name && + NULL != (env = getenv(p->mbp_env_var_name))) { + if (MCA_BASE_PARAM_TYPE_INT == p->mbp_type) + storage->intval = atoi(env); + else if (MCA_BASE_PARAM_TYPE_STRING == p->mbp_type) + storage->stringval = strdup(env); + else + return false; + + return true; + } + + /* Didn't find it; use the default value. */ + + switch (p->mbp_type) { + case MCA_BASE_PARAM_TYPE_INT: + storage->intval = p->mbp_default_value.intval; + break; + + case MCA_BASE_PARAM_TYPE_STRING: + storage->stringval = p->mbp_default_value.stringval; + break; + + default: + return false; + } + + /* All done */ + + return true; +} + + +static int +param_compare(const void *a, const void *b) +{ + const mca_base_param_t *aa = (const mca_base_param_t*) a; + const mca_base_param_t *bb = (const mca_base_param_t*) b; + + return strcmp(aa->mbp_full_name, bb->mbp_full_name); +} + + +static void +param_free(mca_base_param_t *p) +{ + if (NULL != p->mbp_type_name) + LAM_FREE(p->mbp_type_name); + if (NULL != p->mbp_module_name) + LAM_FREE(p->mbp_module_name); + if (NULL != p->mbp_param_name) + LAM_FREE(p->mbp_param_name); + if (NULL != p->mbp_env_var_name) + LAM_FREE(p->mbp_env_var_name); + if (NULL != p->mbp_full_name) + LAM_FREE(p->mbp_full_name); + if (MCA_BASE_PARAM_TYPE_STRING == p->mbp_type && + NULL != p->mbp_default_value.stringval) + LAM_FREE(p->mbp_default_value.stringval); +} diff --git a/src/mca/lam/common_lam/.cvsignore b/src/mca/lam/common_lam/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/src/mca/lam/common_lam/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/mca/lam/common_lam/Makefile.am b/src/mca/lam/common_lam/Makefile.am new file mode 100644 index 0000000000..e592aae646 --- /dev/null +++ b/src/mca/lam/common_lam/Makefile.am @@ -0,0 +1,6 @@ +# +# $HEADER$ +# + +include $(top_srcdir)/config/Makefile.options + diff --git a/src/mca/lam/common_lam/base/.cvsignore b/src/mca/lam/common_lam/base/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/src/mca/lam/common_lam/base/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/src/mca/lam/common_lam/base/Makefile.am b/src/mca/lam/common_lam/base/Makefile.am new file mode 100644 index 0000000000..e592aae646 --- /dev/null +++ b/src/mca/lam/common_lam/base/Makefile.am @@ -0,0 +1,6 @@ +# +# $HEADER$ +# + +include $(top_srcdir)/config/Makefile.options + diff --git a/src/mca/mca.h b/src/mca/mca.h index deb4e0e13d..88ef8d8dc6 100644 --- a/src/mca/mca.h +++ b/src/mca/mca.h @@ -12,38 +12,54 @@ * Types for each function */ -typedef int (*mca_open_module_fn_t)(lam_cmd_line_t *cmd); -typedef int (*mca_close_module_fn_t)(void); -typedef int (*mca_mpi_init_callback_fn_t)(void); -typedef int (*mca_alloc_mem_fn_t)(MPI_Aint size, MPI_Info info, void **base); -typedef int (*mca_free_mem_fn_t)(void *base); +typedef int (*mca_base_open_module_fn_t)(lam_cmd_line_t *cmd); +typedef int (*mca_base_close_module_fn_t)(void); /* - * Struct of meta data necessary in every MCA module, regardless of - * its type. + * Max length of some strings used later */ #define MCA_BASE_MAX_TYPE_NAME_LEN 32 #define MCA_BASE_MAX_MODULE_NAME_LEN 64 -struct mca_module_1_0_0_t { +/* + * The MCA guarantees that every module has three known pieces of + * information: the MCA version that it conforms to, the type name and + * version that it conforms to, and its own name and version. This + * triple will be present in *all* modules (regardless of MCA, type, + * and module version), and identifies the module as well as how it + * can be used. + * + * This information directly implies the data layout and content of + * the rest module structure. For example, MCA v1.0.0 specifies that + * after this triple will be an instance of + * mca_base_module_data_1_0_0_t, specifying module open and close + * functions and a flag indicating whether the module is + * checkpointable or not. + * + */ - /* Integer version numbers indicating which MCA API version this - module conforms to. */ +/* + * Base/super for all modules, regardless of MCA version, type + * version, or module version. + */ +struct mca_base_module_t { + + /* Version of the MCA */ int mca_major_version; int mca_minor_version; int mca_release_version; - /* Information about the type */ + /* The type's name and API version */ char mca_type_name[MCA_BASE_MAX_TYPE_NAME_LEN]; int mca_type_major_version; int mca_type_minor_version; int mca_type_release_version; - /* Information about the module itself */ + /* The module's name and version */ char mca_module_name[MCA_BASE_MAX_MODULE_NAME_LEN]; int mca_module_major_version; @@ -52,33 +68,37 @@ struct mca_module_1_0_0_t { /* Functions for opening and closing the module */ - mca_open_module_fn_t mca_open_module; - mca_close_module_fn_t mca_close_module; + mca_base_open_module_fn_t mca_open_module; + mca_base_close_module_fn_t mca_close_module; +}; +typedef struct mca_base_module_t mca_base_module_t; + +/* + * Meta data for MCA v1.0.0 modules + */ +struct mca_base_module_data_1_0_0_t { /* Does this module support checkpoint or not? */ bool mca_is_checkpointable; }; -typedef struct mca_module_1_0_0_t mca_module_1_0_0_t; +typedef struct mca_base_module_data_1_0_0_t mca_base_module_data_1_0_0_t; /* - * Set the default type to use version 1.0.0 of the MCA struct + * Macro for module author convenience */ - -typedef mca_module_1_0_0_t mca_module_t; - +#define MCA_BASE_VERSION_1_0_0 1, 0, 0 /* * Structure for making priority lists of modules */ - -struct mca_module_priority_t { +struct mca_base_module_priority_t { int lsm_priority; int lsm_thread_min, lsm_thread_max; - mca_module_t *lsm_module; + mca_base_module_t *lsm_module; }; -typedef struct mca_module_priority_t mca_module_priority_t; +typedef struct mca_base_module_priority_t mca_base_module_priority_t; /* @@ -96,10 +116,10 @@ extern "C" { int mca_base_arg_process_one(char *type, char *arg); int mca_base_module_check(char *name, char *module, int is_default); - int mca_base_module_compare(mca_module_t *a, mca_module_t *b); + int mca_base_module_compare(mca_base_module_t *a, mca_base_module_t *b); int mca_base_module_find(char *directory, char *type, - mca_module_t *static_modules[], - mca_module_t ***modules_out); + mca_base_module_t *static_modules[], + mca_base_module_t ***modules_out); #if 0 /* JMS add after the lbltdl stuff is done */ int mca_base_module_register(char *type, lt_dlhandle module_handle, @@ -111,13 +131,9 @@ extern "C" { const char *src_name, const char *depend_type, const char *depend_name); - void mca_base_module_registry_unuse(mca_module_t *module); + void mca_base_module_registry_unuse(mca_base_module_t *module); int mca_base_module_registry_use(const char *type, const char *name); - int mca_base_mpi_init_callback(mca_mpi_init_callback_fn_t func); - int mca_base_mpi_init_callbacks_invoke(void); - int mca_base_mpi_module_select(int requested); - #if 0 /* JMS Are these necessary in L8? */ struct in_addr mca_base_hostmap(struct in_addr *addr, char *keyname); diff --git a/src/mca/mpi/.cvsignore b/src/mca/mpi/.cvsignore index 282522db03..2fd0a30a46 100644 --- a/src/mca/mpi/.cvsignore +++ b/src/mca/mpi/.cvsignore @@ -1,2 +1,5 @@ Makefile Makefile.in +.deps +.libs +*.la diff --git a/src/mca/mpi/Makefile.am b/src/mca/mpi/Makefile.am index 3a36ae9cb4..4ac7a1ff24 100644 --- a/src/mca/mpi/Makefile.am +++ b/src/mca/mpi/Makefile.am @@ -4,4 +4,33 @@ include $(top_srcdir)/config/Makefile.options -SUBDIRS = coll io one pml ptl topo +# base should be listed first because it should be built first +# (probably not for any technical rason, but it makes sense to build +# the base first). common_mpi must be second, however, because +# modules under there may be statically linked to other modules. + +SUBDIRS = base common_mpi coll io one pml ptl topo + +# Source code files + +headers = mpi.h + +# Library + +noinst_LTLIBRARIES = libmca_mpi_convenience.la +libmca_mpi_convenience_la_SOURCES = +libmca_mpi_convenience_la_LIBADD = \ + base/libmca_mpi_base.la \ + coll/libmca_mpi_coll.la \ + pml/libmca_mpi_pml.la +# Add in common_mpi, io, one, pml, ptl, topo as necessary +libmca_mpi_convenience_la_DEPENDENCIES = $(libmca_mpi_convenience_la_LIBADD) + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +lamdir = $(includedir)/lam/mca/mpi +lam_HEADERS = $(headers) +else +lamdir = $(includedir) +endif diff --git a/src/mca/mpi/base/.cvsignore b/src/mca/mpi/base/.cvsignore new file mode 100644 index 0000000000..6e5ca7ed41 --- /dev/null +++ b/src/mca/mpi/base/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.deps +.libs +*.lo +*.la diff --git a/src/mca/mpi/base/Makefile.am b/src/mca/mpi/base/Makefile.am new file mode 100644 index 0000000000..879e8fc1a9 --- /dev/null +++ b/src/mca/mpi/base/Makefile.am @@ -0,0 +1,10 @@ +# +# $HEADER$ +# + +include $(top_srcdir)/config/Makefile.options + +noinst_LTLIBRARIES = libmca_mpi_base.la + +libmca_mpi_base_la_SOURCES = \ + mpi_mem.c diff --git a/src/mca/mpi/base/mca_mpi_mem.c b/src/mca/mpi/base/mca_mpi_mem.c new file mode 100644 index 0000000000..c3d9c18d95 --- /dev/null +++ b/src/mca/mpi/base/mca_mpi_mem.c @@ -0,0 +1,47 @@ +/* + * $HEADER$ + */ + +#include "lam_config.h" + +#include +#include + +#include "lam/util/malloc.h" +#include "mpi.h" +#include "mca/mca.h" +#include "mca/mpi/mpi.h" + + +int mca_mpi_alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr) +{ + void *temp; + + /* Error checks */ + + if (0 == size) + return MPI_SUCCESS; + else if (size < 0) + return LAM_ERROR; + + /* Do the alloc */ + + temp = LAM_MALLOC(size); + if (NULL == temp) + return LAM_ERROR; + + /* All done */ + + *((void **) baseptr) = temp; + return MPI_SUCCESS; +} + + +int mca_mpi_free_mem(void *baseptr) +{ + if (NULL != baseptr) + LAM_FREE(baseptr); + + return MPI_SUCCESS; +} + diff --git a/src/mca/mpi/coll/.cvsignore b/src/mca/mpi/coll/.cvsignore index 282522db03..2a185d9fed 100644 --- a/src/mca/mpi/coll/.cvsignore +++ b/src/mca/mpi/coll/.cvsignore @@ -1,2 +1,4 @@ Makefile Makefile.in +.libs +*.la diff --git a/src/mca/mpi/coll/Makefile.am b/src/mca/mpi/coll/Makefile.am index 7bf8db2808..a0c6611084 100644 --- a/src/mca/mpi/coll/Makefile.am +++ b/src/mca/mpi/coll/Makefile.am @@ -11,6 +11,13 @@ DIST_SUBDIRS = base $(MCA_coll_ALL_SUBDIRS) headers = coll.h +noinst_LTLIBRARIES = libmca_mpi_coll.la +libmca_mpi_coll_la_SOURCES = +libmca_mpi_coll_la_LIBADD = \ + base/libmca_mpi_coll_base.la \ + $(MCA_coll_STATIC_LTLIBS) +libmca_mpi_coll_la_DEPENDENCIES = $(libmca_mpi_coll_la_LIBADD) + # Conditionally install the header files if WANT_INSTALL_HEADERS diff --git a/src/mca/mpi/coll/base/.cvsignore b/src/mca/mpi/coll/base/.cvsignore index 282522db03..a1021e38b8 100644 --- a/src/mca/mpi/coll/base/.cvsignore +++ b/src/mca/mpi/coll/base/.cvsignore @@ -1,2 +1,7 @@ Makefile Makefile.in +*.lo +*.la +.libs +.deps +static-modules.h diff --git a/src/mca/mpi/coll/base/Makefile.am b/src/mca/mpi/coll/base/Makefile.am index 49007265cc..60a96e97c2 100644 --- a/src/mca/mpi/coll/base/Makefile.am +++ b/src/mca/mpi/coll/base/Makefile.am @@ -3,3 +3,20 @@ # include $(top_srcdir)/config/Makefile.options + +noinst_LTLIBRARIES = libmca_mpi_coll_base.la + +headers = \ + base.h + +libmca_mpi_coll_base_la_SOURCES = \ + coll_base_open.c + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +lamdir = $(includedir)/lam/mca/mpi/coll/base +lam_HEADERS = $(headers) +else +lamdir = $(includedir) +endif diff --git a/src/mca/mpi/coll/base/base.h b/src/mca/mpi/coll/base/base.h new file mode 100644 index 0000000000..3f1d2a2ae2 --- /dev/null +++ b/src/mca/mpi/coll/base/base.h @@ -0,0 +1,55 @@ +/* + * $HEADER$ + */ + +#ifndef MCA_COLL_BASE_H +#define MCA_COLL_BASE_H + +#include "lam_config.h" + +#include "mpi.h" +#include "lam/lfc/list.h" +#include "lam/util/cmd_line.h" +#include "mca/mpi/coll/coll.h" + + +/* + * Global functions for MCA overall collective open and close + */ + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + int mca_coll_base_open(lam_cmd_line_t *cmd); + int mca_coll_base_query(void); + int mca_coll_base_close(void); + + int mca_coll_base_init_comm(MPI_Comm comm); + int mca_coll_base_get_param(MPI_Comm comm, int keyval); +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + + +/* + * Public variables + */ + +extern int mca_coll_base_verbose; +extern int mca_coll_base_did; +extern int mca_coll_base_crossover; +extern int mca_coll_base_associative; +extern int mca_coll_base_reduce_crossover; +extern lam_list_t *mca_coll_base_opened; +extern lam_list_t *mca_coll_base_available; + + +/* + * Global instance of array of pointers to statically-linked coll + * modules. Will be filled in by configure. + */ + +extern const mca_base_module_t **mca_coll_base_static_modules; + + +#endif /* MCA_COLL_H */ diff --git a/src/mca/mpi/coll/base/coll_base_open.c b/src/mca/mpi/coll/base/coll_base_open.c new file mode 100644 index 0000000000..77dac309b5 --- /dev/null +++ b/src/mca/mpi/coll/base/coll_base_open.c @@ -0,0 +1,18 @@ +/* + * $HEADER$ + */ + +#include "lam_config.h" + +#include + +#include "lam/constants.h" +#include "lam/util/cmd_line.h" +#include "mca/mpi/coll/base/base.h" + + +int mca_coll_base_open(lam_cmd_line_t *cmd) +{ + printf("In mca_coll_base_open\n"); + return LAM_SUCCESS; +} diff --git a/src/mca/mpi/coll/coll.h b/src/mca/mpi/coll/coll.h index a780c1a743..4a7dbb05a0 100644 --- a/src/mca/mpi/coll/coll.h +++ b/src/mca/mpi/coll/coll.h @@ -8,105 +8,113 @@ #include "lam_config.h" #include "mpi.h" -#include "lam/lfc/list.h" -#include "lam/util/cmd_line.h" #include "mca/mca.h" +#include "mca/mpi/mpi.h" /* - * Types for each API function + * Coll module function typedefs */ -typedef int (*mca_coll_thread_query_fn_t)(int *thread_min, int *thread_max); -typedef const struct mca_coll_1_0_0 * - (*mca_coll_query_1_0_0_fn_t)(MPI_Comm comm, int *priority); +typedef int (*mca_coll_base_thread_query_fn_t)(int *thread_min, + int *thread_max); +typedef const struct mca_coll_1_0_0_t * + (*mca_coll_base_query_1_0_0_fn_t)(MPI_Comm comm, int *priority); + + +/* + * Coll interface function typedefs + */ typedef int - (*mca_coll_init_1_0_0_fn_t) - (MPI_Comm comm, const struct mca_coll_1_0_0 **new_coll); -typedef int (*mca_coll_finalize_fn_t)(MPI_Comm comm); + (*mca_coll_base_init_1_0_0_fn_t) + (MPI_Comm comm, const struct mca_coll_1_0_0_t **new_coll); +typedef int (*mca_coll_base_finalize_fn_t)(MPI_Comm comm); -typedef int (*mca_coll_checkpoint_fn_t)(MPI_Comm comm); -typedef int (*mca_coll_continue_fn_t)(MPI_Comm comm); -typedef int (*mca_coll_restart_fn_t)(MPI_Comm comm); -typedef int (*mca_coll_interrupt_fn_t)(void); +typedef int (*mca_coll_base_checkpoint_fn_t)(MPI_Comm comm); +typedef int (*mca_coll_base_continue_fn_t)(MPI_Comm comm); +typedef int (*mca_coll_base_restart_fn_t)(MPI_Comm comm); +typedef int (*mca_coll_base_interrupt_fn_t)(void); -typedef int (*mca_coll_allgather_fn_t)(void *sbuf, int scount, - MPI_Datatype sdtype, void *rbuf, - int rcount, MPI_Datatype rdtype, - MPI_Comm comm); -typedef int (*mca_coll_allgatherv_fn_t)(void *sbuf, int scount, - MPI_Datatype sdtype, void * rbuf, - int *rcounts, int *disps, - MPI_Datatype rdtype, +typedef int (*mca_coll_base_allgather_fn_t)(void *sbuf, int scount, + MPI_Datatype sdtype, void *rbuf, + int rcount, MPI_Datatype rdtype, + MPI_Comm comm); +typedef int (*mca_coll_base_allgatherv_fn_t)(void *sbuf, int scount, + MPI_Datatype sdtype, void * rbuf, + int *rcounts, int *disps, + MPI_Datatype rdtype, + MPI_Comm comm); +typedef int (*mca_coll_base_allreduce_fn_t)(void *sbuf, void *rbuf, int count, + MPI_Datatype dtype, MPI_Op op, + MPI_Comm comm); +typedef int (*mca_coll_base_alltoall_fn_t)(void *sbuf, int scount, + MPI_Datatype sdtype, void* rbuf, + int rcount, MPI_Datatype rdtype, + MPI_Comm comm); +typedef int (*mca_coll_base_alltoallv_fn_t)(void *sbuf, int *scounts, + int *sdisps, MPI_Datatype sdtype, + void *rbuf, int *rcounts, + int *rdisps, MPI_Datatype rdtype, + MPI_Comm comm); +typedef int (*mca_coll_base_alltoallw_fn_t)(void *sbuf, int *scounts, + int *sdisps, + MPI_Datatype *sdtypes, + void *rbuf, int *rcounts, + int *rdisps, + MPI_Datatype *rdtypes, + MPI_Comm comm); +typedef int (*mca_coll_base_barrier_fn_t)(MPI_Comm comm); +typedef int (*mca_coll_base_bcast_fn_t)(void *buff, int count, + MPI_Datatype datatype, int root, MPI_Comm comm); -typedef int (*mca_coll_allreduce_fn_t)(void *sbuf, void *rbuf, int count, +typedef int (*mca_coll_base_exscan_fn_t)(void *sbuf, void *rbuf, int count, + MPI_Datatype dtype, MPI_Op op, + MPI_Comm comm); +typedef int (*mca_coll_base_gather_fn_t)(void *sbuf, int scount, + MPI_Datatype sdtype, void *rbuf, + int rcount, MPI_Datatype rdtype, + int root, MPI_Comm comm); +typedef int (*mca_coll_base_gatherv_fn_t)(void *sbuf, int scount, + MPI_Datatype sdtype, void *rbuf, + int *rcounts, int *disps, + MPI_Datatype rdtype, int root, + MPI_Comm comm); +typedef int (*mca_coll_base_reduce_fn_t)(void *sbuf, void* rbuf, int count, + MPI_Datatype dtype, MPI_Op op, + int root, MPI_Comm comm); +typedef int (*mca_coll_base_reduce_scatter_fn_t)(void *sbuf, void *rbuf, + int *rcounts, + MPI_Datatype dtype, + MPI_Op op, MPI_Comm comm); +typedef int (*mca_coll_base_scan_fn_t)(void *sbuf, void *rbuf, int count, MPI_Datatype dtype, MPI_Op op, MPI_Comm comm); -typedef int (*mca_coll_alltoall_fn_t)(void *sbuf, int scount, - MPI_Datatype sdtype, void* rbuf, - int rcount, MPI_Datatype rdtype, - MPI_Comm comm); -typedef int (*mca_coll_alltoallv_fn_t)(void *sbuf, int *scounts, - int *sdisps, MPI_Datatype sdtype, - void *rbuf, int *rcounts, - int *rdisps, MPI_Datatype rdtype, - MPI_Comm comm); -typedef int (*mca_coll_alltoallw_fn_t)(void *sbuf, int *scounts, - int *sdisps, MPI_Datatype *sdtypes, - void *rbuf, int *rcounts, - int *rdisps, MPI_Datatype *rdtypes, - MPI_Comm comm); -typedef int (*mca_coll_barrier_fn_t)(MPI_Comm comm); -typedef int (*mca_coll_bcast_fn_t)(void *buff, int count, - MPI_Datatype datatype, int root, - MPI_Comm comm); -typedef int (*mca_coll_exscan_fn_t)(void *sbuf, void *rbuf, int count, - MPI_Datatype dtype, MPI_Op op, - MPI_Comm comm); -typedef int (*mca_coll_gather_fn_t)(void *sbuf, int scount, - MPI_Datatype sdtype, void *rbuf, - int rcount, MPI_Datatype rdtype, - int root, MPI_Comm comm); -typedef int (*mca_coll_gatherv_fn_t)(void *sbuf, int scount, - MPI_Datatype sdtype, void *rbuf, - int *rcounts, int *disps, - MPI_Datatype rdtype, int root, - MPI_Comm comm); -typedef int (*mca_coll_reduce_fn_t)(void *sbuf, void* rbuf, int count, - MPI_Datatype dtype, MPI_Op op, - int root, MPI_Comm comm); -typedef int (*mca_coll_reduce_scatter_fn_t)(void *sbuf, void *rbuf, - int *rcounts, - MPI_Datatype dtype, - MPI_Op op, MPI_Comm comm); -typedef int (*mca_coll_scan_fn_t)(void *sbuf, void *rbuf, int count, - MPI_Datatype dtype, MPI_Op op, - MPI_Comm comm); -typedef int (*mca_coll_scatter_fn_t)(void *sbuf, int scount, - MPI_Datatype sdtype, void *rbuf, - int rcount, MPI_Datatype rdtype, - int root, MPI_Comm comm); -typedef int (*mca_coll_scatterv_fn_t)(void *sbuf, int *scounts, - int *disps, MPI_Datatype sdtype, - void* rbuf, int rcount, - MPI_Datatype rdtype, int root, - MPI_Comm comm); +typedef int (*mca_coll_base_scatter_fn_t)(void *sbuf, int scount, + MPI_Datatype sdtype, void *rbuf, + int rcount, MPI_Datatype rdtype, + int root, MPI_Comm comm); +typedef int (*mca_coll_base_scatterv_fn_t)(void *sbuf, int *scounts, + int *disps, MPI_Datatype sdtype, + void* rbuf, int rcount, + MPI_Datatype rdtype, int root, + MPI_Comm comm); /* - * Ver 1.0.0 + * Structure for coll v1.0.0 modules + * Chained to MCA v1.0.0 */ - -struct mca_coll_module_1_0_0_t { - mca_module_1_0_0_t super; +struct mca_coll_base_module_1_0_0_t { + mca_base_module_t collm_version; + mca_base_module_data_1_0_0_t collm_data; /* Initialization / querying functions */ - mca_coll_thread_query_fn_t collm_thread_query; - mca_coll_query_1_0_0_fn_t collm_query; + mca_coll_base_thread_query_fn_t collm_thread_query; + mca_coll_base_query_1_0_0_fn_t collm_query; }; -typedef struct mca_coll_module_1_0_0_t mca_coll_module_1_0_0_t; +typedef struct mca_coll_base_module_1_0_0_t mca_coll_base_module_1_0_0_t; /* @@ -120,121 +128,99 @@ struct mca_coll_1_0_0_t { /* Per-communicator initialization and finalization functions */ - mca_coll_init_1_0_0_fn_t coll_init; - mca_coll_finalize_fn_t coll_finalize; + mca_coll_base_init_1_0_0_fn_t coll_init; + mca_coll_base_finalize_fn_t coll_finalize; /* Checkpoint / restart functions */ - mca_coll_checkpoint_fn_t coll_checkpoint; - mca_coll_continue_fn_t coll_continue; - mca_coll_restart_fn_t coll_restart; - mca_coll_interrupt_fn_t coll_interrupt; + mca_coll_base_checkpoint_fn_t coll_checkpoint; + mca_coll_base_continue_fn_t coll_continue; + mca_coll_base_restart_fn_t coll_restart; + mca_coll_base_interrupt_fn_t coll_interrupt; /* Memory allocation / freeing */ - mca_alloc_mem_fn_t coll_alloc_mem; - mca_free_mem_fn_t coll_free_mem; + mca_mpi_alloc_mem_fn_t coll_alloc_mem; + mca_mpi_free_mem_fn_t coll_free_mem; /* Collective function pointers */ - mca_coll_allgather_fn_t coll_allgather_intra; - mca_coll_allgather_fn_t coll_allgather_inter; + mca_coll_base_allgather_fn_t coll_allgather_intra; + mca_coll_base_allgather_fn_t coll_allgather_inter; - mca_coll_allgatherv_fn_t coll_allgatherv_intra; - mca_coll_allgatherv_fn_t coll_allgatherv_inter; + mca_coll_base_allgatherv_fn_t coll_allgatherv_intra; + mca_coll_base_allgatherv_fn_t coll_allgatherv_inter; - mca_coll_allreduce_fn_t coll_allreduce_intra; - mca_coll_allreduce_fn_t coll_allreduce_inter; + mca_coll_base_allreduce_fn_t coll_allreduce_intra; + mca_coll_base_allreduce_fn_t coll_allreduce_inter; - mca_coll_alltoall_fn_t coll_alltoall_intra; - mca_coll_alltoall_fn_t coll_alltoall_inter; + mca_coll_base_alltoall_fn_t coll_alltoall_intra; + mca_coll_base_alltoall_fn_t coll_alltoall_inter; - mca_coll_alltoallv_fn_t coll_alltoallv_intra; - mca_coll_alltoallv_fn_t coll_alltoallv_inter; + mca_coll_base_alltoallv_fn_t coll_alltoallv_intra; + mca_coll_base_alltoallv_fn_t coll_alltoallv_inter; - mca_coll_alltoallw_fn_t coll_alltoallw_intra; - mca_coll_alltoallw_fn_t coll_alltoallw_inter; + mca_coll_base_alltoallw_fn_t coll_alltoallw_intra; + mca_coll_base_alltoallw_fn_t coll_alltoallw_inter; - mca_coll_barrier_fn_t coll_barrier_intra; - mca_coll_barrier_fn_t coll_barrier_inter; + mca_coll_base_barrier_fn_t coll_barrier_intra; + mca_coll_base_barrier_fn_t coll_barrier_inter; bool coll_bcast_optimization; - mca_coll_bcast_fn_t coll_bcast_intra; - mca_coll_bcast_fn_t coll_bcast_inter; + mca_coll_base_bcast_fn_t coll_bcast_intra; + mca_coll_base_bcast_fn_t coll_bcast_inter; - mca_coll_exscan_fn_t coll_exscan_intra; - mca_coll_exscan_fn_t coll_exscan_inter; + mca_coll_base_exscan_fn_t coll_exscan_intra; + mca_coll_base_exscan_fn_t coll_exscan_inter; - mca_coll_gather_fn_t coll_gather_intra; - mca_coll_gather_fn_t coll_gather_inter; + mca_coll_base_gather_fn_t coll_gather_intra; + mca_coll_base_gather_fn_t coll_gather_inter; - mca_coll_gatherv_fn_t coll_gatherv_intra; - mca_coll_gatherv_fn_t coll_gatherv_inter; + mca_coll_base_gatherv_fn_t coll_gatherv_intra; + mca_coll_base_gatherv_fn_t coll_gatherv_inter; bool coll_reduce_optimization; - mca_coll_reduce_fn_t coll_reduce_intra; - mca_coll_reduce_fn_t coll_reduce_inter; + mca_coll_base_reduce_fn_t coll_reduce_intra; + mca_coll_base_reduce_fn_t coll_reduce_inter; - mca_coll_reduce_scatter_fn_t coll_reduce_scatter_intra; - mca_coll_reduce_scatter_fn_t coll_reduce_scatter_inter; + mca_coll_base_reduce_scatter_fn_t coll_reduce_scatter_intra; + mca_coll_base_reduce_scatter_fn_t coll_reduce_scatter_inter; - mca_coll_scan_fn_t coll_scan_intra; - mca_coll_scan_fn_t coll_scan_inter; + mca_coll_base_scan_fn_t coll_scan_intra; + mca_coll_base_scan_fn_t coll_scan_inter; - mca_coll_scatter_fn_t coll_scatter_intra; - mca_coll_scatter_fn_t coll_scatter_inter; + mca_coll_base_scatter_fn_t coll_scatter_intra; + mca_coll_base_scatter_fn_t coll_scatter_inter; - mca_coll_scatterv_fn_t coll_scatterv_intra; - mca_coll_scatterv_fn_t coll_scatterv_inter; + mca_coll_base_scatterv_fn_t coll_scatterv_intra; + mca_coll_base_scatterv_fn_t coll_scatterv_inter; }; -struct mca_coll_1_0_0_t mca_coll_1_0_0_t; +typedef struct mca_coll_1_0_0_t mca_coll_1_0_0_t; /* - * Global functions for MCA overall collective open and close + * Macro for use in modules that are of type coll v1.0.0 + */ +#define MCA_COLL_BASE_VERSION_1_0_0 \ + /* coll v1.0 is chained to MCA v1.0 */ \ + MCA_BASE_VERSION_1_0_0, \ + /* coll v1.0 */ \ + "coll", 1, 0, 0 + + +/* + * This function is technically part of the basic module, but since it + * ships with LAM, and other modules may use the basic module for + * query/init functionality, prototype this function here. */ #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif - int mca_coll_base_close(void); - int mca_coll_base_init_comm(MPI_Comm comm); - int mca_coll_base_get_param(MPI_Comm comm, int keyval); - int mca_coll_base_open(lam_cmd_line_t *cmd); - int mca_coll_base_query(void); - - /* - * This is technically part of the basic module, but since it ships - * with LAM, and other modules may use the basic module for - * query/init functionality, prototype this function here. - */ - - const mca_coll_module_1_0_0_t * + const mca_coll_1_0_0_t * mca_coll_basic_query(MPI_Comm comm, int *priority); #if defined(c_plusplus) || defined(__cplusplus) } #endif - -/* - * Public variables - */ - -extern int mca_coll_verbose; -extern int mca_coll_did; -extern int mca_coll_base_crossover; -extern int mca_coll_base_associative; -extern int mca_coll_base_reduce_crossover; -extern lam_list_t *mca_coll_base_opened; -extern lam_list_t *mca_coll_base_available; - - -/* - * Global instance of array of pointers to mca_coll_t. Will - * effectively be filled in by configure. - */ - -extern const mca_module_t **mca_coll_modules; - - #endif /* MCA_COLL_H */ diff --git a/src/mca/mpi/common_mpi/.cvsignore b/src/mca/mpi/common_mpi/.cvsignore new file mode 100644 index 0000000000..2a185d9fed --- /dev/null +++ b/src/mca/mpi/common_mpi/.cvsignore @@ -0,0 +1,4 @@ +Makefile +Makefile.in +.libs +*.la diff --git a/src/mca/mpi/common_mpi/Makefile.am b/src/mca/mpi/common_mpi/Makefile.am new file mode 100644 index 0000000000..e592aae646 --- /dev/null +++ b/src/mca/mpi/common_mpi/Makefile.am @@ -0,0 +1,6 @@ +# +# $HEADER$ +# + +include $(top_srcdir)/config/Makefile.options + diff --git a/src/mca/mpi/common_mpi/base/.cvsignore b/src/mca/mpi/common_mpi/base/.cvsignore new file mode 100644 index 0000000000..2a185d9fed --- /dev/null +++ b/src/mca/mpi/common_mpi/base/.cvsignore @@ -0,0 +1,4 @@ +Makefile +Makefile.in +.libs +*.la diff --git a/src/mca/mpi/common_mpi/base/Makefile.am b/src/mca/mpi/common_mpi/base/Makefile.am new file mode 100644 index 0000000000..e592aae646 --- /dev/null +++ b/src/mca/mpi/common_mpi/base/Makefile.am @@ -0,0 +1,6 @@ +# +# $HEADER$ +# + +include $(top_srcdir)/config/Makefile.options + diff --git a/src/mca/mpi/mpi.h b/src/mca/mpi/mpi.h new file mode 100644 index 0000000000..53139ffab7 --- /dev/null +++ b/src/mca/mpi/mpi.h @@ -0,0 +1,48 @@ +/* + * $HEADER$ + */ + +#ifndef LAM_MCA_MPI_H +#define LAM_MCA_MPI_H + +#include "mpi.h" +#include "mca/mca.h" + +/* + * Types for each function + */ + +typedef int (*mca_mpi_init_cb_t)(void); +typedef int (*mca_mpi_alloc_mem_fn_t)(MPI_Aint size, MPI_Info info, + void **base); +typedef int (*mca_mpi_free_mem_fn_t)(void *base); + + +/* + * Global functions for MPI MCA modules + */ + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + int mca_mpi_alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr); + int mca_mpi_free_mem(void *baseptr); + + int mca_mpi_init_callback(mca_mpi_init_cb_t func); + int mca_mpi_init_callbacks_invoke(void); + int mca_mpi_module_select(int requested); + +#if 0 + /* JMS Are these necessary in L8? */ + struct in_addr mca_mpi_hostmap(struct in_addr *addr, char *keyname); +#endif + void mca_mpi_hostmap_finalize(void); + + int mca_mpi_param_associate(int index, int keyval); + int mca_mpi_param_lookup_int(int index, MPI_Comm comm); + char *mca_mpi_param_lookup_string(int index, MPI_Comm comm); +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif /* LAM_MCA_MPI_H */ diff --git a/src/mca/mpi/pml/.cvsignore b/src/mca/mpi/pml/.cvsignore index 282522db03..2a185d9fed 100644 --- a/src/mca/mpi/pml/.cvsignore +++ b/src/mca/mpi/pml/.cvsignore @@ -1,2 +1,4 @@ Makefile Makefile.in +.libs +*.la diff --git a/src/mca/mpi/pml/Makefile.am b/src/mca/mpi/pml/Makefile.am index 073664ff81..d01533c9af 100644 --- a/src/mca/mpi/pml/Makefile.am +++ b/src/mca/mpi/pml/Makefile.am @@ -4,13 +4,20 @@ include $(top_srcdir)/config/Makefile.options -SUBDIRS = base teg $(MCA_pml_STATIC_SUBDIRS) +SUBDIRS = base $(MCA_pml_STATIC_SUBDIRS) DIST_SUBDIRS = base $(MCA_pml_ALL_SUBDIRS) # Source code files headers = pml.h +noinst_LTLIBRARIES = libmca_mpi_pml.la +libmca_mpi_pml_la_SOURCES = +libmca_mpi_pml_la_LIBADD = \ + base/libmca_mpi_pml_base.la \ + $(MCA_pml_STATIC_LTLIBS) +libmca_mpi_pml_la_DEPENDENCIES = $(libmca_mpi_pml_la_LIBADD) + # Conditionally install the header files if WANT_INSTALL_HEADERS diff --git a/src/mca/mpi/pml/base/.cvsignore b/src/mca/mpi/pml/base/.cvsignore index 6e5ca7ed41..a618e8c097 100644 --- a/src/mca/mpi/pml/base/.cvsignore +++ b/src/mca/mpi/pml/base/.cvsignore @@ -4,3 +4,4 @@ Makefile.in .libs *.lo *.la +static-modules.h diff --git a/src/mca/mpi/pml/base/Makefile.am b/src/mca/mpi/pml/base/Makefile.am index 61d3d5ae6e..019234de8e 100644 --- a/src/mca/mpi/pml/base/Makefile.am +++ b/src/mca/mpi/pml/base/Makefile.am @@ -4,11 +4,12 @@ include $(top_srcdir)/config/Makefile.options -noinst_LTLIBRARIES = libpmlb.la +noinst_LTLIBRARIES = libmca_mpi_pml_base.la # Source code files headers = \ + base.h \ fragment.h \ header.h \ recvfrag.h \ @@ -16,17 +17,17 @@ headers = \ sendfrag.h \ sendreq.h -libpmlb_la_SOURCES = \ +libmca_mpi_pml_base_la_SOURCES = \ $(headers) \ - fragment.c \ - recvfrag.c \ - request.c \ - sendfrag.c + pml_base_fragment.c \ + pml_base_recvfrag.c \ + pml_base_request.c \ + pml_base_sendfrag.c # Conditionally install the header files if WANT_INSTALL_HEADERS -lamdir = $(includedir)/mfc/mpi/pml/base +lamdir = $(includedir)/mca/mpi/pml/base lam_HEADERS = $(headers) else lamdir = $(includedir) diff --git a/src/mca/mpi/pml/base/base.h b/src/mca/mpi/pml/base/base.h new file mode 100644 index 0000000000..d9a320d2d6 --- /dev/null +++ b/src/mca/mpi/pml/base/base.h @@ -0,0 +1,43 @@ +/* + * $HEADER$ + */ + +#ifndef MCA_PML_BASE_H +#define MCA_PML_BASE_H + +#include "lam_config.h" + +#include "mca/mca.h" +#include "mca/mpi/pml/pml.h" + + +/* + * Global functions for the PML + */ + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + int mca_pml_base_close(void); + int mca_pml_base_open(lam_cmd_line_t *cmd); + int mca_pml_base_query(void); + int mca_pml_base_init(void); +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +/* + * Public variables + */ + +extern lam_list_t *mca_pml_base_opened; +extern lam_list_t *mca_pml_base_available; + +/* + * Global instance of array of pointers to mca_base_module_t. Will + * effectively be filled in by configure. + */ + +extern const mca_base_module_t **mca_pml_base_modules; + +#endif /* MCA_PML_BASE_H */ diff --git a/src/mca/mpi/pml/base/pml_base_request.h b/src/mca/mpi/pml/base/pml_base_request.h index d5ba817b69..706b8a3898 100644 --- a/src/mca/mpi/pml/base/pml_base_request.h +++ b/src/mca/mpi/pml/base/pml_base_request.h @@ -22,10 +22,10 @@ typedef enum { LAM_STATUS_INCOMPLETE = 3, LAM_STATUS_COMPLETE = 4, LAM_STATUS_INACTIVE = 5 -} mca_pml_request_status_t; +} mca_pml_base_request_status_t; -/* MPI request */ +/* MPI pml (point-to-point) request */ typedef struct { /* base request */ lam_request_t super; @@ -38,9 +38,9 @@ typedef struct { /* pointer to data type */ lam_datatype_t *req_datatype; /* MPI request status */ - mca_pml_request_status_t req_status; + mca_pml_base_request_status_t req_status; /* type of message - standard,buffered,synchronous,ready,recv */ - mca_pml_request_type_t req_type; + mca_pml_base_request_type_t req_type; /* persistence indicating if the this is a persistent request */ bool req_persistent; /* flag indicating if MPI is done with this request called */ diff --git a/src/mca/mpi/pml/pml.h b/src/mca/mpi/pml/pml.h index 4934caaf2b..c90cade386 100644 --- a/src/mca/mpi/pml/pml.h +++ b/src/mca/mpi/pml/pml.h @@ -2,103 +2,102 @@ * $HEADER$ */ -#ifndef LAM_MCA_PML_H -#define LAM_MCA_PML_H +#ifndef MCA_PML_H +#define MCA_PML_H + +#include "lam_config.h" #include "lam/lam.h" #include "lam/lfc/list.h" #include "mpi/proc/proc.h" +#include "mpi/communicator/communicator.h" +#include "mpi/datatype/datatype.h" +#include "mpi/request/request.h" #include "mca/mca.h" + /* * PML module functions */ -typedef int (*mca_pml_query_fn_t)(int *priority, int *min_thread, int* max_thread); -typedef struct mca_pml_1_0_0_t * (*mca_pml_init_1_0_0_fn_t)( - struct lam_proc_t **procs, - int nprocs, - int *max_tag, - int *max_cid -); +typedef int (*mca_pml_base_query_fn_t)(int *priority, int *min_thread, + int* max_thread); +typedef struct mca_pml_1_0_0_t * + (*mca_pml_base_init_1_0_0_fn_t) + (struct lam_proc_t **procs, int nprocs, int *max_tag, int *max_cid); /* * PML types */ -typedef uint64_t mca_pml_sequence_t; -typedef uint64_t mca_pml_tstamp_t; -typedef lam_list_t mca_pml_queue_t; +typedef uint64_t mca_pml_base_sequence_t; +typedef uint64_t mca_pml_base_tstamp_t; +typedef lam_list_t mca_pml_base_queue_t; typedef enum { - MCA_PML_REQUEST_TYPE_RECV, - MCA_PML_REQUEST_TYPE_SEND_STANDARD, - MCA_PML_REQUEST_TYPE_SEND_BUFFERED, - MCA_PML_REQUEST_TYPE_SEND_SYNCHRONOUS, - MCA_PML_REQUEST_TYPE_SEND_READY -} mca_pml_request_type_t; + MCA_PML_BASE_REQUEST_TYPE_RECV, + MCA_PML_BASE_REQUEST_TYPE_SEND_STANDARD, + MCA_PML_BASE_REQUEST_TYPE_SEND_BUFFERED, + MCA_PML_BASE_REQUEST_TYPE_SEND_SYNCHRONOUS, + MCA_PML_BASE_REQUEST_TYPE_SEND_READY +} mca_pml_base_request_type_t; /* * PML interface functions */ -struct lam_communicator_t; -struct lam_datatype_t; -struct lam_proc_t; -struct lam_request_t; +typedef int (*mca_pml_base_progress_fn_t)(mca_pml_base_tstamp_t); -typedef int (*mca_pml_progress_fn_t)(mca_pml_tstamp_t); - -typedef int (*mca_pml_isend_fn_t)( +typedef int (*mca_pml_base_isend_fn_t)( void *buf, size_t size, struct lam_datatype_t *datatype, int dest, int tag, struct lam_communicator_t* comm, - mca_pml_request_type_t req_type, + mca_pml_base_request_type_t req_type, struct lam_request_t **request ); -typedef int (*mca_pml_addprocs_fn_t)(lam_proc_t **procs, int nprocs); +typedef int (*mca_pml_base_addprocs_fn_t)(lam_proc_t **procs, int nprocs); /* * PML module definition. */ -struct mca_pml_module_1_0_0_t { - - mca_module_1_0_0_t super; - mca_pml_query_fn_t pmlm_query; - mca_pml_init_1_0_0_fn_t pmlm_init; +struct mca_pml_base_module_1_0_0_t { + mca_base_module_t pmlm_version; + mca_base_module_data_1_0_0_t pmlm_data; + mca_pml_base_query_fn_t pmlm_query; + mca_pml_base_init_1_0_0_fn_t pmlm_init; }; -typedef struct mca_pml_module_1_0_0_t mca_pml_module_1_0_0_t; +typedef struct mca_pml_base_module_1_0_0_t mca_pml_base_module_1_0_0_t; /* * Struct that represents the common state and interface functions * provided by a PML. */ - + struct mca_pml_1_0_0_t { - - mca_pml_addprocs_fn_t pml_addprocs; - mca_pml_isend_fn_t pml_isend; - mca_pml_progress_fn_t pml_progress; - + mca_pml_base_addprocs_fn_t pml_addprocs; + mca_pml_base_isend_fn_t pml_isend; + mca_pml_base_progress_fn_t pml_progress; }; typedef struct mca_pml_1_0_0_t mca_pml_1_0_0_t; /* - * Set the default type to use version 1.1.0 of the PML + * Macro for use in modules that are of type pml v1.0.0 */ - -typedef struct mca_pml_module_1_1_0_t mca_pml_module_t; -typedef struct mca_pml_1_1_0_t mca_pml_t; +#define MCA_PML_BASE_VERSION_1_0_0 \ + /* pml v1.0 is chained to MCA v1.0 */ \ + MCA_BASE_VERSION_1_0_0, \ + /* pml v1.0 */ \ + "pml", 1, 0, 0 /* @@ -124,10 +123,10 @@ extern lam_list_t *mca_pml_base_opened; extern lam_list_t *mca_pml_base_available; /* - * Global instance of array of pointers to lam_ssi_rpi_t. Will + * Global instance of array of pointers to mca_base_module_t. Will * effectively be filled in by configure. */ -extern const mca_module_t **mca_pml_modules; +extern const mca_base_module_t **mca_pml_base_modules; -#endif /* LAM_MCA_PML_H */ +#endif /* MCA_PML_H */ diff --git a/src/mca/mpi/pml/teg/.cvsignore b/src/mca/mpi/pml/teg/.cvsignore index c62f0af123..4f7712fb02 100644 --- a/src/mca/mpi/pml/teg/.cvsignore +++ b/src/mca/mpi/pml/teg/.cvsignore @@ -1,8 +1,14 @@ -.deps -.libs -libteg.la Makefile Makefile.in -proc.lo -ptl_array.lo -teg.lo +acinclude.m4 +aclocal.m4 +configure +configure.ac +config.log +config.status +libtool +autom4te.cache +.libs +.deps +*.la +.lam* diff --git a/src/mca/mpi/pml/teg/Makefile.am b/src/mca/mpi/pml/teg/Makefile.am index 5f0e18aa23..1ad0ccb939 100644 --- a/src/mca/mpi/pml/teg/Makefile.am +++ b/src/mca/mpi/pml/teg/Makefile.am @@ -2,21 +2,47 @@ # $HEADER$ # -include $(top_srcdir)/config/Makefile.options - -noinst_LTLIBRARIES = libteg.la - +# Use the top-level LAM Makefile.options + +include $(top_lam_srcdir)/config/Makefile.options + +EXTRA_DIST = VERSION + +AM_CPPFLAGS = \ + -I$(top_lam_builddir)/src/include \ + -I$(top_lam_srcdir)/src \ + -I$(top_lam_srcdir)/src/include + # Source code files - -headers = \ + +sources = \ comm.h \ proc.h \ ptl_array.h \ - teg.h + teg.h \ + pml_teg_proc.c \ + pml_teg_ptl_array.c \ + pml_teg.c + +# For static MCA modules, we have to make the output library here in +# the top-level directory, and it has to be named +# libmca_{library}_{type}_{name}.la. For dynamic modules, we build +# mca_{type}_{name}.la and install them into $(libdir)/lam. + +if LAM_BUILD_LOADABLE_MODULE +module_noinst = +module_install = mca_pml_teg.la +else +module_noinst = libmca_mpi_pml_teg.la +module_install = +endif + +lamssiexecdir = $(libdir)/lam +lamssiexec_LTLIBRARIES = $(module_install) +mca_pml_teg_la_SOURCES = $(sources) +mca_pml_teg_la_LDFLAGS = -module -avoid-version + +noinst_LTLIBRARIES = $(module_noinst) +libmca_mpi_pml_teg_la_SOURCES = $(sources) +libmca_mpi_pml_teg_la_LDFLAGS = -module -avoid-version -libteg_la_SOURCES = \ - $(headers) \ - proc.c \ - ptl_array.c \ - teg.c - diff --git a/src/mca/mpi/pml/teg/VERSION b/src/mca/mpi/pml/teg/VERSION new file mode 100644 index 0000000000..54f912ce99 --- /dev/null +++ b/src/mca/mpi/pml/teg/VERSION @@ -0,0 +1,6 @@ +major=1 +minor=0 +release=0 +alpha=0 +beta=0 +cvs=1 diff --git a/src/mca/mpi/pml/teg/src/pml_teg.c b/src/mca/mpi/pml/teg/src/pml_teg.c index 8fba1fd0d0..6f43c43067 100644 --- a/src/mca/mpi/pml/teg/src/pml_teg.c +++ b/src/mca/mpi/pml/teg/src/pml_teg.c @@ -1,23 +1,33 @@ +#include "mca/mpi/pml/pml.h" #include "mca/mpi/pml/teg/teg.h" -mca_pml_module_1_0_0_t mca_pml_teg_module_1_0_0_0 = { +mca_pml_base_module_1_0_0_t mca_pml_teg_module = { + /* First, the mca_base_module_t struct containing meta information + about the module itself */ + { - 1, /* MCA major version */ - 0, /* MCA minor version */ - 0, /* MCA release version */ - "pml", /* MCA type name */ - 1, /* MCA type major version */ - 0, /* MCA type minor version */ - 0, /* MCA type release version */ + /* Indicate that we are a pml v1.0.0 module (which also implies a + specific MCA version) */ + + MCA_PML_BASE_VERSION_1_0_0, + "teg", /* MCA module name */ 1, /* MCA module major version */ 0, /* MCA module minor version */ 0, /* MCA module release version */ mca_pml_teg_open, /* module open */ - mca_pml_teg_close, /* module close */ - false, + mca_pml_teg_close /* module close */ }, + + /* Next the MCA v1.0.0 module meta data */ + + { + /* Whether the module is checkpointable or not */ + + false + }, + mca_pml_teg_query, /* module query */ mca_pml_teg_init /* module init */ }; @@ -43,5 +53,3 @@ mca_pml_1_0_0_t* mca_pml_teg_init( lam_frl_init(&mca_pml_teg.teg_recv_requests); return &mca_pml_teg.super; } - - diff --git a/src/mca/mpi/pml/teg/src/pml_teg.h b/src/mca/mpi/pml/teg/src/pml_teg.h index 4ba8e054d6..2afbae8398 100644 --- a/src/mca/mpi/pml/teg/src/pml_teg.h +++ b/src/mca/mpi/pml/teg/src/pml_teg.h @@ -5,15 +5,17 @@ #ifndef MCA_PML_TEG_H_ #define MCA_PML_TEG_H -#include "mca/mpi/pml/pml.h" #include "lam/mem/free_list.h" +#include "lam/util/cmd_line.h" +#include "mpi/request/request.h" +#include "mca/mpi/pml/pml.h" /* * PML module functions. */ -extern mca_pml_module_1_0_0_t mca_pml_teg_module_1_0_0_0; +extern mca_pml_base_module_1_0_0_t mca_pml_teg_module_1_0_0_0; extern int mca_pml_teg_open( @@ -29,7 +31,7 @@ extern int mca_pml_teg_query( ); extern mca_pml_1_0_0_t* mca_pml_teg_init( - struct lam_proc_t **procs, + lam_proc_t **procs, int nprocs, int *max_tag, int *max_cid @@ -38,6 +40,14 @@ extern mca_pml_1_0_0_t* mca_pml_teg_init( /* * TEG PML Interface + * + * JMS: Tim--Note that you don't have to do versioning here. + * Versioning is only for the MCA framework (i.e., able to load + * modules of different versions). This type is going to be used + * specifically within your module, and the framework will never see + * it. Ergo, no other teg modules (even those of different versions) + * will ever see it, either. So while you can do the 1_0_0 stuff + * here, it isn't strictly necessary. */ struct mca_pml_teg_1_0_0_t { @@ -60,12 +70,12 @@ extern int mca_pml_teg_isend( int dest, int tag, struct lam_communicator_t* comm, - mca_pml_request_type_t req_type, + mca_pml_base_request_type_t req_type, struct lam_request_t **request ); extern int mca_pml_teg_progress( - mca_pml_tstamp_t + mca_pml_base_tstamp_t tstamp ); extern int mca_pml_teg_addprocs( diff --git a/src/mca/mpi/ptl/base/ptl_base_match.c b/src/mca/mpi/ptl/base/ptl_base_match.c index 2e9d7b62d9..596a8a8bf2 100644 --- a/src/mca/mpi/ptl/base/ptl_base_match.c +++ b/src/mca/mpi/ptl/base/ptl_base_match.c @@ -49,7 +49,7 @@ int mca_ptl_base_match(mca_pml_base_reliable_hdr_t *frag_header, lam_list_t *additional_matches) { /* local variables */ - mca_pml_sequence_t frag_msg_seq_num,next_msg_seq_num_expected; + mca_pml_base_sequence_t frag_msg_seq_num,next_msg_seq_num_expected; lam_communicator_t *comm_ptr; mca_pml_base_recv_request_t *matched_receive; int frag_src;