- Update/revise pcm base functionality
- First cut of oob/registry base functionality This commit was SVN r628.
Этот коммит содержится в:
родитель
3c09880e57
Коммит
2df075a1ff
@ -17,6 +17,8 @@ noinst_LTLIBRARIES = libmca_lam_convenience.la
|
||||
libmca_lam_convenience_la_SOURCES =
|
||||
libmca_lam_convenience_la_LIBADD = \
|
||||
base/libmca_lam_base.la \
|
||||
pcm/libmca_pcm.la
|
||||
oob/libmca_oob.la \
|
||||
pcm/libmca_pcm.la \
|
||||
registry/libmca_registry.la
|
||||
# Add base, common_lam, oob, pcm, registry as required
|
||||
libmca_lam_convenience_la_DEPENDENCIES = $(libmca_lam_convenience_la_LIBADD)
|
||||
|
@ -1,2 +1,4 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.libs
|
||||
*.la
|
||||
|
@ -7,10 +7,19 @@ include $(top_srcdir)/config/Makefile.options
|
||||
SUBDIRS = base $(MCA_oob_STATIC_SUBDIRS)
|
||||
DIST_SUBDIRS = base $(MCA_oob_ALL_SUBDIRS)
|
||||
|
||||
noinst_LTLIBRARIES = libmca_oob.la
|
||||
|
||||
# Source code files
|
||||
|
||||
headers = oob.h
|
||||
|
||||
# Library
|
||||
|
||||
libmca_oob_la_SOURCES = $(headers)
|
||||
libmca_oob_la_LIBADD = \
|
||||
$(MCA_oob_STATIC_LTLIBS) \
|
||||
base/libmca_oob_base.la
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
|
@ -1,3 +1,7 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
.libs
|
||||
*.lo
|
||||
*.la
|
||||
static-modules.h
|
||||
|
@ -3,3 +3,27 @@
|
||||
#
|
||||
|
||||
include $(top_srcdir)/config/Makefile.options
|
||||
|
||||
noinst_LTLIBRARIES = libmca_oob_base.la
|
||||
|
||||
# Source code files
|
||||
|
||||
headers = \
|
||||
base.h
|
||||
|
||||
# Library
|
||||
|
||||
libmca_oob_base_la_SOURCES = \
|
||||
$(headers) \
|
||||
oob_base_close.c \
|
||||
oob_base_open.c \
|
||||
oob_base_select.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
lamdir = $(includedir)/lam/mca/lam/oob/base
|
||||
lam_HEADERS = $(headers)
|
||||
else
|
||||
lamdir = $(includedir)
|
||||
endif
|
||||
|
44
src/mca/lam/oob/base/base.h
Обычный файл
44
src/mca/lam/oob/base/base.h
Обычный файл
@ -0,0 +1,44 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_OOB_BASE_H_
|
||||
#define MCA_OOB_BASE_H_
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "lam/types.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/oob/oob.h"
|
||||
|
||||
/*
|
||||
* Global functions for MCA overall collective open and close
|
||||
*/
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_oob_base_open(void);
|
||||
int mca_oob_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
int mca_oob_base_close(void);
|
||||
|
||||
bool mca_oob_base_is_checkpointable(void);
|
||||
|
||||
int mca_oob_base_checkpoint(void);
|
||||
int mca_oob_base_continue(void);
|
||||
int mca_oob_base_restart(void);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Global struct holding the selected module's function pointers
|
||||
*/
|
||||
extern int mca_oob_base_output;
|
||||
extern lam_list_t mca_oob_base_modules_available;
|
||||
extern mca_oob_base_module_t mca_oob_base_selected_module;
|
||||
extern mca_oob_t mca_oob;
|
||||
|
||||
#endif
|
27
src/mca/lam/oob/base/oob_base_close.c
Обычный файл
27
src/mca/lam/oob/base/oob_base_close.c
Обычный файл
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/oob/oob.h"
|
||||
#include "mca/lam/oob/base/base.h"
|
||||
|
||||
|
||||
int mca_oob_base_close(void)
|
||||
{
|
||||
/* Close all remaining available modules (may be one if this is a
|
||||
LAM RTE program, or [possibly] multiple if this is laminfo) */
|
||||
|
||||
mca_base_modules_close(mca_oob_base_output,
|
||||
&mca_oob_base_modules_available, NULL);
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
48
src/mca/lam/oob/base/oob_base_open.c
Обычный файл
48
src/mca/lam/oob/base/oob_base_open.c
Обычный файл
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/oob/oob.h"
|
||||
#include "mca/lam/oob/base/base.h"
|
||||
|
||||
|
||||
/*
|
||||
* The following file was created by configure. It contains extern
|
||||
* statements and the definition of an array of pointers to each
|
||||
* module's public mca_base_module_t struct.
|
||||
*/
|
||||
|
||||
#include "mca/lam/oob/base/static-modules.h"
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
int mca_oob_base_output = -1;
|
||||
mca_oob_t mca_oob;
|
||||
lam_list_t mca_oob_base_modules_available;
|
||||
mca_oob_base_module_t mca_oob_base_selected_module;
|
||||
|
||||
|
||||
/**
|
||||
* Function for finding and opening either all MCA modules, or the one
|
||||
* that was specifically requested via a MCA parameter.
|
||||
*/
|
||||
int mca_oob_base_open(void)
|
||||
{
|
||||
/* Open up all available modules */
|
||||
|
||||
if (LAM_SUCCESS !=
|
||||
mca_base_modules_open("oob", 0, mca_oob_base_static_modules,
|
||||
&mca_oob_base_modules_available)) {
|
||||
return LAM_ERROR;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
125
src/mca/lam/oob/base/oob_base_select.c
Обычный файл
125
src/mca/lam/oob/base/oob_base_select.c
Обычный файл
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/oob/oob.h"
|
||||
#include "mca/lam/oob/base/base.h"
|
||||
|
||||
|
||||
/**
|
||||
* Function for selecting one module from all those that are
|
||||
* available.
|
||||
*
|
||||
* Call the init function on all available modules and get their
|
||||
* priorities. Select the module with the highest priority. All
|
||||
* other modules will be closed and unloaded.
|
||||
*/
|
||||
int mca_oob_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads)
|
||||
{
|
||||
int priority, best_priority;
|
||||
bool user_threads, hidden_threads;
|
||||
bool best_user_threads, best_hidden_threads;
|
||||
lam_list_item_t *item;
|
||||
mca_base_module_list_item_t *mli;
|
||||
mca_oob_base_module_t *module, *best_module;
|
||||
mca_oob_t *actions;
|
||||
extern lam_list_t mca_oob_base_modules_available;
|
||||
|
||||
/* Traverse the list of available modules; call their init
|
||||
functions. */
|
||||
|
||||
best_priority = -1;
|
||||
best_module = NULL;
|
||||
for (item = lam_list_get_first(&mca_oob_base_modules_available);
|
||||
lam_list_get_end(&mca_oob_base_modules_available) != item;
|
||||
item = lam_list_get_next(item)) {
|
||||
mli = (mca_base_module_list_item_t *) item;
|
||||
module = (mca_oob_base_module_t *) mli->mli_module;
|
||||
|
||||
lam_output_verbose(10, mca_oob_base_output,
|
||||
"select: initializing %s module %s",
|
||||
module->oobm_version.mca_type_name,
|
||||
module->oobm_version.mca_module_name);
|
||||
if (NULL == module->oobm_init) {
|
||||
lam_output_verbose(10, mca_oob_base_output,
|
||||
"select: no init function; ignoring module");
|
||||
} else {
|
||||
if (MCA_SUCCESS != module->oobm_init(&priority, &user_threads,
|
||||
&hidden_threads)) {
|
||||
lam_output_verbose(10, mca_oob_base_output,
|
||||
"select: init returned failure");
|
||||
} else {
|
||||
lam_output_verbose(10, mca_oob_base_output,
|
||||
"select: init returned priority %d", priority);
|
||||
if (priority > best_priority) {
|
||||
best_priority = priority;
|
||||
best_user_threads = user_threads;
|
||||
best_hidden_threads = hidden_threads;
|
||||
best_module = module;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Finished querying all modules. Check for the bozo case. */
|
||||
|
||||
if (NULL == best_module) {
|
||||
/* JMS Replace with show_help */
|
||||
lam_abort(1, "No OOB module available. This shouldn't happen.");
|
||||
}
|
||||
|
||||
/* Finalize all non-selected modules */
|
||||
|
||||
for (item = lam_list_get_first(&mca_oob_base_modules_available);
|
||||
lam_list_get_end(&mca_oob_base_modules_available) != item;
|
||||
item = lam_list_get_next(item)) {
|
||||
mli = (mca_base_module_list_item_t *) item;
|
||||
module = (mca_oob_base_module_t *) mli->mli_module;
|
||||
|
||||
if (module != best_module) {
|
||||
|
||||
/* Finalize */
|
||||
|
||||
if (NULL != module->oobm_finalize) {
|
||||
|
||||
/* Blatently ignore the return code (what would we do to
|
||||
recover, anyway? This module is going away, so errors
|
||||
don't matter anymore) */
|
||||
|
||||
module->oobm_finalize();
|
||||
lam_output_verbose(10, mca_oob_base_output,
|
||||
"select: module %s finalized",
|
||||
module->oobm_version.mca_module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This base function closes, unloads, and removes from the
|
||||
available list all unselected modules. The available list will
|
||||
contain only the selected module. */
|
||||
|
||||
mca_base_modules_close(mca_oob_base_output, &mca_oob_base_modules_available,
|
||||
(mca_base_module_t *) best_module);
|
||||
|
||||
/* Save the winner */
|
||||
|
||||
mca_oob_base_selected_module = *best_module;
|
||||
mca_oob = *actions;
|
||||
*allow_multi_user_threads = best_user_threads;
|
||||
*have_hidden_threads = best_hidden_threads;
|
||||
lam_output_verbose(10, mca_oob_base_output,
|
||||
"select: module %s initialized",
|
||||
module->oobm_version.mca_module_name);
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
@ -18,8 +18,9 @@ int mca_oob_cofs_close(void);
|
||||
/*
|
||||
* Startup / Shutdown
|
||||
*/
|
||||
int mca_oob_cofs_query(int *priority);
|
||||
struct mca_oob_1_0_0_t* mca_oob_cofs_init(void);
|
||||
struct mca_oob_1_0_0_t* mca_oob_cofs_init(int *priority,
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
int mca_oob_cofs_finalize(void);
|
||||
|
||||
|
||||
|
@ -34,7 +34,6 @@ mca_oob_base_module_1_0_0_t mca_oob_cofs_module = {
|
||||
{
|
||||
false /* checkpoint / restart */
|
||||
},
|
||||
mca_oob_cofs_query, /* module query */
|
||||
mca_oob_cofs_init, /* module init */
|
||||
mca_oob_cofs_finalize
|
||||
};
|
||||
@ -64,20 +63,17 @@ mca_oob_cofs_close(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mca_oob_cofs_query(int *priority)
|
||||
{
|
||||
*priority = 0;
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
struct mca_oob_1_0_0_t*
|
||||
mca_oob_cofs_init(void)
|
||||
mca_oob_cofs_init(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads)
|
||||
{
|
||||
char *tmp;
|
||||
FILE *fp;
|
||||
|
||||
*priority = 0;
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_threads = true;
|
||||
|
||||
/*
|
||||
* BWB - fix me, make register the "right" way...
|
||||
*/
|
||||
|
@ -34,8 +34,8 @@
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "mca/mca.h"
|
||||
#include "lam/types.h"
|
||||
#include "mca/mca.h"
|
||||
|
||||
/*
|
||||
* Global constants / types
|
||||
@ -55,8 +55,9 @@ typedef void (*mca_oob_base_recv_cb_t)(lam_job_handle_t job_handle, int tag,
|
||||
/*
|
||||
* Functions every module instance will have to provide
|
||||
*/
|
||||
typedef int (*mca_oob_base_query_fn_t)(int *priority);
|
||||
typedef struct mca_oob_1_0_0_t* (*mca_oob_base_init_fn_t)(void);
|
||||
typedef struct mca_oob_1_0_0_t*
|
||||
(*mca_oob_base_init_fn_t)(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
typedef int (*mca_oob_base_send_fn_t)(lam_job_handle_t job_handle, int vpid, int tag,
|
||||
void* data, size_t data_len);
|
||||
typedef int (*mca_oob_base_recv_fn_t)(lam_job_handle_t job_handle, int vpid, int* tag,
|
||||
@ -75,9 +76,8 @@ struct mca_oob_base_module_1_0_0_t {
|
||||
mca_base_module_t oobm_version;
|
||||
mca_base_module_data_1_0_0_t oobm_data;
|
||||
|
||||
mca_oob_base_query_fn_t oobm_query;
|
||||
mca_oob_base_init_fn_t oobm_init;
|
||||
mca_oob_base_finalize_fn_t oob_finalize;
|
||||
mca_oob_base_finalize_fn_t oobm_finalize;
|
||||
};
|
||||
typedef struct mca_oob_base_module_1_0_0_t mca_oob_base_module_1_0_0_t;
|
||||
|
||||
@ -89,6 +89,9 @@ struct mca_oob_1_0_0_t {
|
||||
};
|
||||
typedef struct mca_oob_1_0_0_t mca_oob_1_0_0_t;
|
||||
|
||||
typedef mca_oob_base_module_1_0_0_t mca_oob_base_module_t;
|
||||
typedef mca_oob_1_0_0_t mca_oob_t;
|
||||
|
||||
/*
|
||||
* Macro for use in modules that are of type coll v1.0.0
|
||||
*/
|
||||
@ -99,31 +102,4 @@ typedef struct mca_oob_1_0_0_t mca_oob_1_0_0_t;
|
||||
"oob", 1, 0, 0
|
||||
|
||||
|
||||
typedef mca_oob_base_module_1_0_0_t mca_oob_base_module_t;
|
||||
typedef mca_oob_1_0_0_t mca_oob_t;
|
||||
|
||||
|
||||
/*
|
||||
* Global functions for MCA overall collective open and close
|
||||
*/
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_oob_base_open(lam_cmd_line_t *cmd);
|
||||
int mca_oob_base_close(void);
|
||||
|
||||
bool mca_oob_base_is_checkpointable(void);
|
||||
|
||||
int mca_oob_base_checkpoint(void);
|
||||
int mca_oob_base_continue(void);
|
||||
int mca_oob_base_restart(void);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global struct holding the selected module's function pointers
|
||||
*/
|
||||
extern mca_oob_t mca_oob;
|
||||
|
||||
#endif
|
||||
|
45
src/mca/lam/pcm/base/base.h
Обычный файл
45
src/mca/lam/pcm/base/base.h
Обычный файл
@ -0,0 +1,45 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_PCM_BASE_H_
|
||||
#define MCA_PCM_BASE_H_
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "lam/types.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/pcm/pcm.h"
|
||||
|
||||
|
||||
/*
|
||||
* Global functions for MCA overall collective open and close
|
||||
*/
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_pcm_base_open(void);
|
||||
int mca_oob_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
int mca_pcm_base_close(void);
|
||||
|
||||
bool mca_pcm_base_is_checkpointable(void);
|
||||
|
||||
int mca_pcm_base_checkpoint(void);
|
||||
int mca_pcm_base_continue(void);
|
||||
int mca_pcm_base_restart(void);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Globals
|
||||
*/
|
||||
extern int mca_pcm_base_output;
|
||||
extern lam_list_t mca_pcm_base_modules_available;
|
||||
extern mca_pcm_base_module_t mca_pcm_base_selected_module;
|
||||
extern mca_pcm_t mca_pcm;
|
||||
|
||||
#endif /* MCA_PCM_BASE_H */
|
@ -5,7 +5,6 @@
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "mca/mca.h"
|
||||
@ -15,8 +14,6 @@
|
||||
|
||||
int mca_pcm_base_close(void)
|
||||
{
|
||||
extern lam_list_t mca_pcm_base_modules_available;
|
||||
|
||||
/* Close all remaining available modules (may be one if this is a
|
||||
LAM RTE program, or [possibly] multiple if this is laminfo) */
|
||||
|
||||
|
@ -4,10 +4,6 @@
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/pcm/pcm.h"
|
||||
|
@ -5,8 +5,6 @@
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "mca/mca.h"
|
||||
@ -22,9 +20,12 @@
|
||||
* priorities. Select the module with the highest priority. All
|
||||
* other modules will be closed and unloaded.
|
||||
*/
|
||||
int mca_pcm_base_select(void)
|
||||
int mca_pcm_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads)
|
||||
{
|
||||
int priority, best_priority;
|
||||
bool user_threads, hidden_threads;
|
||||
bool best_user_threads, best_hidden_threads;
|
||||
lam_list_item_t *item;
|
||||
mca_base_module_list_item_t *mli;
|
||||
mca_pcm_base_module_t *module, *best_module;
|
||||
@ -50,7 +51,8 @@ int mca_pcm_base_select(void)
|
||||
lam_output_verbose(10, mca_pcm_base_output,
|
||||
"select: no init function; ignoring module");
|
||||
} else {
|
||||
if (MCA_SUCCESS != module->pcmm_init(&priority)) {
|
||||
if (MCA_SUCCESS != module->pcmm_init(&priority, &user_threads,
|
||||
&hidden_threads)) {
|
||||
lam_output_verbose(10, mca_pcm_base_output,
|
||||
"select: init returned failure");
|
||||
} else {
|
||||
@ -58,6 +60,8 @@ int mca_pcm_base_select(void)
|
||||
"select: init returned priority %d", priority);
|
||||
if (priority > best_priority) {
|
||||
best_priority = priority;
|
||||
best_user_threads = user_threads;
|
||||
best_hidden_threads = hidden_threads;
|
||||
best_module = module;
|
||||
}
|
||||
}
|
||||
@ -108,6 +112,8 @@ int mca_pcm_base_select(void)
|
||||
|
||||
mca_pcm_base_selected_module = *best_module;
|
||||
mca_pcm = *actions;
|
||||
*allow_multi_user_threads = best_user_threads;
|
||||
*have_hidden_threads = best_hidden_threads;
|
||||
lam_output_verbose(10, mca_pcm_base_output,
|
||||
"select: module %s initialized",
|
||||
module->pcmm_version.mca_module_name);
|
||||
|
@ -17,7 +17,9 @@ int mca_pcm_cofs_close(void);
|
||||
/*
|
||||
* Startup / Shutdown
|
||||
*/
|
||||
struct mca_pcm_1_0_0_t* mca_pcm_cofs_init(int *priority);
|
||||
struct mca_pcm_1_0_0_t* mca_pcm_cofs_init(int *priority,
|
||||
bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
int mca_pcm_cofs_finalize(void);
|
||||
|
||||
|
||||
|
@ -71,6 +71,8 @@ size_t mca_pcm_cofs_nprocs = 0;
|
||||
int
|
||||
mca_pcm_cofs_open(void)
|
||||
{
|
||||
/* JMS/BWB: Register MCA params in here -- see
|
||||
src/mca/lam/base/mca_base_param.h */
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
@ -83,7 +85,8 @@ mca_pcm_cofs_close(void)
|
||||
|
||||
|
||||
struct mca_pcm_1_0_0_t*
|
||||
mca_pcm_cofs_init(int *priority)
|
||||
mca_pcm_cofs_init(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads)
|
||||
{
|
||||
char *tmp;
|
||||
FILE *fp;
|
||||
@ -91,8 +94,11 @@ mca_pcm_cofs_init(int *priority)
|
||||
char *test_ret;
|
||||
|
||||
*priority = 0;
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_threads = false;
|
||||
|
||||
/* BWB - remove printfs once things settle down some... */
|
||||
/* JMS: Look in src/mca/lam/base/mca_base_param.h */
|
||||
test_ret = getenv("MCA_common_lam_cofs_my_vpid");
|
||||
if (test_ret == NULL) {
|
||||
printf("COFS PCM will not be running because MCA_common_lam_cofs_my_vpid not set\n");
|
||||
|
@ -87,7 +87,9 @@ typedef struct mca_pcm_proc_t mca_pcm_proc_t;
|
||||
* functions every module must provide
|
||||
*/
|
||||
|
||||
typedef struct mca_pcm_1_0_0_t* (*mca_pcm_base_init_fn_t)(int *priority);
|
||||
typedef struct mca_pcm_1_0_0_t*
|
||||
(*mca_pcm_base_init_fn_t)(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
|
||||
/**
|
||||
* \func mca_pcm_query_get_nodes
|
||||
@ -422,7 +424,8 @@ typedef mca_pcm_1_0_0_t mca_pcm_t;
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_pcm_base_open(void);
|
||||
int mca_pcm_base_select(void);
|
||||
int mca_pcm_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
int mca_pcm_base_close(void);
|
||||
|
||||
bool mca_pcm_base_is_checkpointable(void);
|
||||
|
@ -1,2 +1,4 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.libs
|
||||
*.la
|
||||
|
@ -7,10 +7,19 @@ include $(top_srcdir)/config/Makefile.options
|
||||
SUBDIRS = base $(MCA_registry_STATIC_SUBDIRS)
|
||||
DIST_SUBDIRS = base $(MCA_registry_ALL_SUBDIRS)
|
||||
|
||||
noinst_LTLIBRARIES = libmca_registry.la
|
||||
|
||||
# Source code files
|
||||
|
||||
headers = registry.h
|
||||
|
||||
# Library
|
||||
|
||||
libmca_registry_la_SOURCES = $(headers)
|
||||
libmca_registry_la_LIBADD = \
|
||||
$(MCA_registry_STATIC_LTLIBS) \
|
||||
base/libmca_registry_base.la
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
|
@ -1,3 +1,7 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
.libs
|
||||
*.lo
|
||||
*.la
|
||||
static-modules.h
|
||||
|
@ -3,3 +3,27 @@
|
||||
#
|
||||
|
||||
include $(top_srcdir)/config/Makefile.options
|
||||
|
||||
noinst_LTLIBRARIES = libmca_registry_base.la
|
||||
|
||||
# Source code files
|
||||
|
||||
headers = \
|
||||
base.h
|
||||
|
||||
# Library
|
||||
|
||||
libmca_registry_base_la_SOURCES = \
|
||||
$(headers) \
|
||||
registry_base_close.c \
|
||||
registry_base_open.c \
|
||||
registry_base_select.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
if WANT_INSTALL_HEADERS
|
||||
lamdir = $(includedir)/lam/mca/lam/registry/base
|
||||
lam_HEADERS = $(headers)
|
||||
else
|
||||
lamdir = $(includedir)
|
||||
endif
|
||||
|
43
src/mca/lam/registry/base/base.h
Обычный файл
43
src/mca/lam/registry/base/base.h
Обычный файл
@ -0,0 +1,43 @@
|
||||
/* -*- C -*-
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_REGISTRY_BASE_H_
|
||||
#define MCA_REGISTRY_BASE_H_
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/registry/registry.h"
|
||||
|
||||
/*
|
||||
* Global functions for MCA overall collective open and close
|
||||
*/
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_registry_base_open(void);
|
||||
int mca_registry_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
int mca_registry_base_close(void);
|
||||
|
||||
bool mca_registry_base_is_checkpointable(void);
|
||||
|
||||
int mca_registry_base_checkpoint(void);
|
||||
int mca_registry_base_continue(void);
|
||||
int mca_registry_base_restart(void);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Global struct holding the selected module's function pointers
|
||||
*/
|
||||
extern int mca_registry_base_output;
|
||||
extern lam_list_t mca_registry_base_modules_available;
|
||||
extern mca_registry_base_module_t mca_registry_base_selected_module;
|
||||
extern mca_registry_t mca_registry;
|
||||
|
||||
#endif
|
27
src/mca/lam/registry/base/registry_base_close.c
Обычный файл
27
src/mca/lam/registry/base/registry_base_close.c
Обычный файл
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/constants.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/registry/registry.h"
|
||||
#include "mca/lam/registry/base/base.h"
|
||||
|
||||
|
||||
int mca_registry_base_close(void)
|
||||
{
|
||||
/* Close all remaining available modules (may be one if this is a
|
||||
LAM RTE program, or [possibly] multiple if this is laminfo) */
|
||||
|
||||
mca_base_modules_close(mca_registry_base_output,
|
||||
&mca_registry_base_modules_available, NULL);
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
48
src/mca/lam/registry/base/registry_base_open.c
Обычный файл
48
src/mca/lam/registry/base/registry_base_open.c
Обычный файл
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/registry/registry.h"
|
||||
#include "mca/lam/registry/base/base.h"
|
||||
|
||||
|
||||
/*
|
||||
* The following file was created by configure. It contains extern
|
||||
* statements and the definition of an array of pointers to each
|
||||
* module's public mca_base_module_t struct.
|
||||
*/
|
||||
|
||||
#include "mca/lam/registry/base/static-modules.h"
|
||||
|
||||
|
||||
/*
|
||||
* Global variables
|
||||
*/
|
||||
int mca_registry_base_output = -1;
|
||||
mca_registry_t mca_registry;
|
||||
lam_list_t mca_registry_base_modules_available;
|
||||
mca_registry_base_module_t mca_registry_base_selected_module;
|
||||
|
||||
|
||||
/**
|
||||
* Function for finding and opening either all MCA modules, or the one
|
||||
* that was specifically requested via a MCA parameter.
|
||||
*/
|
||||
int mca_registry_base_open(void)
|
||||
{
|
||||
/* Open up all available modules */
|
||||
|
||||
if (LAM_SUCCESS !=
|
||||
mca_base_modules_open("registry", 0, mca_registry_base_static_modules,
|
||||
&mca_registry_base_modules_available)) {
|
||||
return LAM_ERROR;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
125
src/mca/lam/registry/base/registry_base_select.c
Обычный файл
125
src/mca/lam/registry/base/registry_base_select.c
Обычный файл
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lam/runtime/runtime.h"
|
||||
#include "mca/mca.h"
|
||||
#include "mca/lam/base/base.h"
|
||||
#include "mca/lam/registry/registry.h"
|
||||
#include "mca/lam/registry/base/base.h"
|
||||
|
||||
|
||||
/**
|
||||
* Function for selecting one module from all those that are
|
||||
* available.
|
||||
*
|
||||
* Call the init function on all available modules and get their
|
||||
* priorities. Select the module with the highest priority. All
|
||||
* other modules will be closed and unloaded.
|
||||
*/
|
||||
int mca_registry_base_select(bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads)
|
||||
{
|
||||
int priority, best_priority;
|
||||
bool user_threads, hidden_threads;
|
||||
bool best_user_threads, best_hidden_threads;
|
||||
lam_list_item_t *item;
|
||||
mca_base_module_list_item_t *mli;
|
||||
mca_registry_base_module_t *module, *best_module;
|
||||
mca_registry_t *actions;
|
||||
extern lam_list_t mca_registry_base_modules_available;
|
||||
|
||||
/* Traverse the list of available modules; call their init
|
||||
functions. */
|
||||
|
||||
best_priority = -1;
|
||||
best_module = NULL;
|
||||
for (item = lam_list_get_first(&mca_registry_base_modules_available);
|
||||
lam_list_get_end(&mca_registry_base_modules_available) != item;
|
||||
item = lam_list_get_next(item)) {
|
||||
mli = (mca_base_module_list_item_t *) item;
|
||||
module = (mca_registry_base_module_t *) mli->mli_module;
|
||||
|
||||
lam_output_verbose(10, mca_registry_base_output,
|
||||
"select: initializing %s module %s",
|
||||
module->registrym_version.mca_type_name,
|
||||
module->registrym_version.mca_module_name);
|
||||
if (NULL == module->registrym_init) {
|
||||
lam_output_verbose(10, mca_registry_base_output,
|
||||
"select: no init function; ignoring module");
|
||||
} else {
|
||||
if (MCA_SUCCESS != module->registrym_init(&priority, &user_threads,
|
||||
&hidden_threads)) {
|
||||
lam_output_verbose(10, mca_registry_base_output,
|
||||
"select: init returned failure");
|
||||
} else {
|
||||
lam_output_verbose(10, mca_registry_base_output,
|
||||
"select: init returned priority %d", priority);
|
||||
if (priority > best_priority) {
|
||||
best_priority = priority;
|
||||
best_user_threads = user_threads;
|
||||
best_hidden_threads = hidden_threads;
|
||||
best_module = module;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Finished querying all modules. Check for the bozo case. */
|
||||
|
||||
if (NULL == best_module) {
|
||||
/* JMS Replace with show_help */
|
||||
lam_abort(1, "No REGISTRY module available. This shouldn't happen.");
|
||||
}
|
||||
|
||||
/* Finalize all non-selected modules */
|
||||
|
||||
for (item = lam_list_get_first(&mca_registry_base_modules_available);
|
||||
lam_list_get_end(&mca_registry_base_modules_available) != item;
|
||||
item = lam_list_get_next(item)) {
|
||||
mli = (mca_base_module_list_item_t *) item;
|
||||
module = (mca_registry_base_module_t *) mli->mli_module;
|
||||
|
||||
if (module != best_module) {
|
||||
|
||||
/* Finalize */
|
||||
|
||||
if (NULL != module->registrym_finalize) {
|
||||
|
||||
/* Blatently ignore the return code (what would we do to
|
||||
recover, anyway? This module is going away, so errors
|
||||
don't matter anymore) */
|
||||
|
||||
module->registrym_finalize();
|
||||
lam_output_verbose(10, mca_registry_base_output,
|
||||
"select: module %s finalized",
|
||||
module->registrym_version.mca_module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This base function closes, unloads, and removes from the
|
||||
available list all unselected modules. The available list will
|
||||
contain only the selected module. */
|
||||
|
||||
mca_base_modules_close(mca_registry_base_output, &mca_registry_base_modules_available,
|
||||
(mca_base_module_t *) best_module);
|
||||
|
||||
/* Save the winner */
|
||||
|
||||
mca_registry_base_selected_module = *best_module;
|
||||
mca_registry = *actions;
|
||||
*allow_multi_user_threads = best_user_threads;
|
||||
*have_hidden_threads = best_hidden_threads;
|
||||
lam_output_verbose(10, mca_registry_base_output,
|
||||
"select: module %s initialized",
|
||||
module->registrym_version.mca_module_name);
|
||||
|
||||
/* All done */
|
||||
|
||||
return LAM_SUCCESS;
|
||||
}
|
10
src/mca/lam/registry/base/static-modules.h
Обычный файл
10
src/mca/lam/registry/base/static-modules.h
Обычный файл
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
extern const mca_base_module_t mca_registry_cofs_module;
|
||||
|
||||
const mca_base_module_t *mca_registry_base_static_modules[] = {
|
||||
&mca_registry_cofs_module,
|
||||
NULL
|
||||
};
|
@ -18,8 +18,9 @@ int mca_registry_cofs_close(void);
|
||||
/*
|
||||
* Startup / Shutdown
|
||||
*/
|
||||
int mca_registry_cofs_query(int *priority);
|
||||
struct mca_registry_1_0_0_t* mca_registry_cofs_init(void);
|
||||
struct mca_registry_1_0_0_t*
|
||||
mca_registry_cofs_init(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_user_threads);
|
||||
int mca_registry_cofs_finalize(void);
|
||||
|
||||
|
||||
|
@ -34,7 +34,6 @@ mca_registry_base_module_1_0_0_t mca_registry_cofs_module = {
|
||||
{
|
||||
false /* checkpoint / restart */
|
||||
},
|
||||
mca_registry_cofs_query, /* module query */
|
||||
mca_registry_cofs_init, /* module init */
|
||||
mca_registry_cofs_finalize
|
||||
};
|
||||
@ -62,20 +61,17 @@ mca_registry_cofs_close(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mca_registry_cofs_query(int *priority)
|
||||
{
|
||||
*priority = 0;
|
||||
return LAM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
struct mca_registry_1_0_0_t*
|
||||
mca_registry_cofs_init(void)
|
||||
mca_registry_cofs_init(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_user_threads)
|
||||
{
|
||||
char *tmp;
|
||||
FILE *fp;
|
||||
|
||||
*priority = 0;
|
||||
*allow_multi_user_threads = true;
|
||||
*have_hidden_user_threads = false;
|
||||
|
||||
/*
|
||||
* BWB - fix me, make register the "right" way...
|
||||
*/
|
||||
|
@ -35,8 +35,9 @@
|
||||
/*
|
||||
* Functions every module instance will have to provide
|
||||
*/
|
||||
typedef int (*mca_registry_base_query_fn_t)(int *priority);
|
||||
typedef struct mca_registry_1_0_0_t* (*mca_registry_base_init_fn_t)(void);
|
||||
typedef struct mca_registry_1_0_0_t*
|
||||
(*mca_registry_base_init_fn_t)(int *priority, bool *allow_multi_user_threads,
|
||||
bool *have_hidden_threads);
|
||||
|
||||
/**
|
||||
* Publish a key=value piece of information
|
||||
@ -95,7 +96,6 @@ struct mca_registry_base_module_1_0_0_t {
|
||||
mca_base_module_t registrym_version;
|
||||
mca_base_module_data_1_0_0_t registrym_data;
|
||||
|
||||
mca_registry_base_query_fn_t registrym_query;
|
||||
mca_registry_base_init_fn_t registrym_init;
|
||||
mca_registry_base_finalize_fn_t registrym_finalize;
|
||||
};
|
||||
@ -108,6 +108,10 @@ struct mca_registry_1_0_0_t {
|
||||
};
|
||||
typedef struct mca_registry_1_0_0_t mca_registry_1_0_0_t;
|
||||
|
||||
typedef mca_registry_base_module_1_0_0_t mca_registry_base_module_t;
|
||||
typedef mca_registry_1_0_0_t mca_registry_t;
|
||||
|
||||
|
||||
/*
|
||||
* Macro for use in modules that are of type registry v1.0.0
|
||||
*/
|
||||
@ -117,32 +121,4 @@ typedef struct mca_registry_1_0_0_t mca_registry_1_0_0_t;
|
||||
/* registry v1.0 */ \
|
||||
"registry", 1, 0, 0
|
||||
|
||||
typedef mca_registry_base_module_1_0_0_t mca_registry_base_module_t;
|
||||
typedef mca_registry_1_0_0_t mca_registry_t;
|
||||
|
||||
|
||||
/*
|
||||
* Global functions for MCA overall collective open and close
|
||||
*/
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
int mca_registry_base_open(lam_cmd_line_t *cmd);
|
||||
int mca_registry_base_close(void);
|
||||
|
||||
bool mca_registry_base_is_checkpointable(void);
|
||||
|
||||
int mca_registry_base_checkpoint(void);
|
||||
int mca_registry_base_continue(void);
|
||||
int mca_registry_base_restart(void);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Global struct holding the selected module's function pointers
|
||||
*/
|
||||
extern mca_registry_t mca_registry;
|
||||
|
||||
#endif
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user