1
1

- Pass a lam_list_t of ptl's to the pml function add_ptls()

- Use allow_multi_use_threads/have_hidden_threads instead of
  min_thread/max_thread
- rename fini -> finalize
- selection is based on ptl's that fail to initialize (they are weeded out)
- finalize all ptl's when shutting down

This commit was SVN r617.
Этот коммит содержится в:
Jeff Squyres 2004-01-30 23:02:39 +00:00
родитель 94a9aab796
Коммит f28e15def9
8 изменённых файлов: 139 добавлений и 18 удалений

Просмотреть файл

@ -7,10 +7,20 @@
#include "lam_config.h"
#include "lam/lfc/list.h"
#include "mca/mca.h"
#include "mca/mpi/ptl/ptl.h"
struct mca_ptl_base_selected_module_t {
lam_list_item_t super;
mca_ptl_base_module_t *pbsm_module;
mca_ptl_t *pbsm_actions;
};
typedef struct mca_ptl_base_selected_module_t mca_ptl_base_selected_module_t;
/*
* Global functions for MCA: overall PTL open and close
*/
@ -25,10 +35,12 @@ extern "C" {
}
#endif
/*
* Globals
*/
extern int mca_ptl_base_output;
extern lam_list_t mca_ptl_base_modules_available;
extern lam_list_t mca_ptl_base_modules_initialized;
#endif /* MCA_PTL_BASE_H */

Просмотреть файл

@ -15,7 +15,23 @@
int mca_ptl_base_close(void)
{
extern lam_list_t mca_ptl_base_modules_available;
lam_list_item_t *item;
mca_ptl_base_selected_module_t *sm;
/* Finalize all the ptl modules and free their list items */
for (item = lam_list_remove_first(&mca_ptl_base_modules_initialized);
NULL != item;
item = lam_list_remove_first(&mca_ptl_base_modules_initialized)) {
sm = (mca_ptl_base_selected_module_t *) item;
/* Blatently ignore the return code (what would we do to recover,
anyway? This module is going away, so errors don't matter
anymore) */
sm->pbsm_actions->ptl_finalize(sm->pbsm_actions);
LAM_FREE(sm);
}
/* Close all remaining available modules (may be one if this is a
LAM RTE program, or [possibly] multiple if this is laminfo) */

Просмотреть файл

@ -26,6 +26,7 @@
*/
int mca_ptl_base_output = -1;
lam_list_t mca_ptl_base_modules_available;
lam_list_t mca_ptl_base_modules_initialized;
/**
@ -42,6 +43,12 @@ int mca_ptl_base_open(void)
return LAM_ERROR;
}
/* Initialize the list so that in mca_ptl_base_close(), we can
iterate over it (even if it's empty, as in the case of
laminfo) */
lam_list_init(&mca_ptl_base_modules_initialized);
/* All done */
return LAM_SUCCESS;

Просмотреть файл

@ -4,13 +4,92 @@
#include "lam_config.h"
#include "lam/runtime/runtime.h"
#include "mca/mca.h"
#include "mca/lam/base/base.h"
#include "mca/mpi/ptl/ptl.h"
#include "mca/mpi/ptl/base/base.h"
/**
* Function for weeding out ptl modules that don't want to run.
*
* Call the init function on all available modules to find out if they
* want to run. Select all modules that don't fail. Failing modules
* will be closed and unloaded. The selected modules will be returned
* to the caller in a lam_list_t.
*/
int mca_ptl_base_select(lam_list_t *selected)
{
int i, num_ptls;
bool allow_multi_user_threads, have_hidden_threads;
lam_list_item_t *item;
mca_base_module_list_item_t *mli;
mca_ptl_base_module_t *module;
mca_ptl_t **actions;
mca_ptl_base_selected_module_t *sm;
/* Traverse the list of available modules; call their init
functions. */
for (item = lam_list_get_first(&mca_ptl_base_modules_available);
lam_list_get_end(&mca_ptl_base_modules_available) != item;
item = lam_list_get_next(item)) {
mli = (mca_base_module_list_item_t *) item;
module = (mca_ptl_base_module_t *) mli->mli_module;
lam_output_verbose(10, mca_ptl_base_output,
"select: initializing %s module %s",
module->ptlm_version.mca_type_name,
module->ptlm_version.mca_module_name);
if (NULL == module->ptlm_init) {
lam_output_verbose(10, mca_ptl_base_output,
"select: no init function; ignoring module");
} else {
actions = module->ptlm_init(&num_ptls, &allow_multi_user_threads,
&have_hidden_threads);
/* If the module didn't initialize, unload it */
if (NULL == actions) {
lam_output_verbose(10, mca_ptl_base_output,
"select: init returned failure");
mca_base_module_registry_release((mca_base_module_t *) module);
lam_output_verbose(10, mca_ptl_base_output,
"select: module %s unloaded",
module->ptlm_version.mca_module_name);
}
/* Otherwise, it initialized properly. Save it. */
else {
lam_output_verbose(10, mca_ptl_base_output,
"select: init returned success");
for (i = 0; i < num_ptls; ++i) {
sm = LAM_MALLOC(sizeof(mca_ptl_base_selected_module_t));
if (NULL == sm) {
return LAM_ERR_OUT_OF_RESOURCE;
}
lam_list_item_init((lam_list_item_t *) sm);
sm->pbsm_module = module;
sm->pbsm_actions = actions[i];
lam_list_append(&mca_ptl_base_modules_initialized,
(lam_list_item_t*) sm);
}
LAM_FREE(actions);
}
}
}
/* Finished querying all modules. Check for the bozo case. */
if (0 == lam_list_get_size(selected)) {
/* JMS Replace with show_help */
lam_abort(1, "No ptl module available. This shouldn't happen.");
}
/* All done */
return LAM_SUCCESS;

Просмотреть файл

@ -35,15 +35,20 @@ typedef lam_list_t mca_ptl_base_queue_t;
/**
* MCA->PTL Intializes the PTL module and creates specific PTL instance(s).
*
* @param num_ptls (OUT) Returns the number of ptl instances created.
* @param thread_min (OUT) Minimum thread level supported by the PTL.
* @param thread_max (OUT) Maximum thread level supported by the PTL.
* @return Array of pointers to PTL instances.
* @param num_ptls (OUT) Returns the number of ptl instances created.
*
* @param allow_multi_user_threads (OUT) Whether this module can run
* at MPI_THREAD_MULTIPLE or not.
*
* @param have_hidden_threads (OUT) Whether this module may use
* hidden threads (e.g., progress threads) or not.
*
* @return Array of pointers to PTL instances.
*/
typedef struct mca_ptl_t** (*mca_ptl_base_module_init_fn_t)(
int* num_ptls,
int *thread_min,
int *thread_max
int *num_ptls,
bool *allow_multi_user_threads,
bool *have_hidden_threads
);
@ -107,7 +112,7 @@ typedef int (*mca_ptl_base_del_proc_fn_t)(
*
* @param ptl (IN) The PTL module instance that is being unloaded.
*/
typedef int (*mca_ptl_base_fini_fn_t)(
typedef int (*mca_ptl_base_finalize_fn_t)(
struct mca_ptl_t* ptl
);
@ -147,7 +152,7 @@ struct mca_ptl_t {
/* PTL function table */
mca_ptl_base_add_proc_fn_t ptl_add_proc;
mca_ptl_base_del_proc_fn_t ptl_del_proc;
mca_ptl_base_fini_fn_t ptl_fini;
mca_ptl_base_finalize_fn_t ptl_finalize;
mca_ptl_base_send_fn_t ptl_send;
mca_ptl_base_request_alloc_fn_t ptl_request_alloc;
mca_ptl_base_request_return_fn_t ptl_request_return;

Просмотреть файл

@ -26,7 +26,7 @@ mca_ptl_tcp_t mca_ptl_tcp = {
0, /* ptl_frag_max_size */
mca_ptl_tcp_add_proc,
mca_ptl_tcp_del_proc,
mca_ptl_tcp_fini,
mca_ptl_tcp_finalize,
mca_ptl_tcp_send,
mca_ptl_tcp_request_alloc,
mca_ptl_tcp_request_return
@ -97,7 +97,7 @@ int mca_ptl_tcp_del_proc(struct mca_ptl_t* ptl, struct lam_proc_t *proc, struct
return LAM_SUCCESS;
}
int mca_ptl_tcp_fini(struct mca_ptl_t* ptl)
int mca_ptl_tcp_finalize(struct mca_ptl_t* ptl)
{
return LAM_SUCCESS;

Просмотреть файл

@ -46,8 +46,8 @@ extern int mca_ptl_tcp_module_close(void);
extern mca_ptl_t** mca_ptl_tcp_module_init(
int *num_ptls,
int *thread_min,
int *thread_max
bool *allow_multi_user_threads,
bool *have_hidden_threads
);
extern void mca_ptl_tcp_module_progress(
@ -75,7 +75,7 @@ extern int mca_ptl_tcp_create(
int if_index
);
extern int mca_ptl_tcp_fini(
extern int mca_ptl_tcp_finalize(
struct mca_ptl_t* ptl
);

Просмотреть файл

@ -262,11 +262,13 @@ static int mca_ptl_tcp_module_exchange(void)
* (2) setup TCP listen socket for incoming connection attempts
* (3) register PTL parameters with the MCA
*/
mca_ptl_t** mca_ptl_tcp_module_init(int* num_ptls, int* thread_min, int* thread_max)
mca_ptl_t** mca_ptl_tcp_module_init(int *num_ptls,
bool *allow_multi_user_threads,
bool *have_hidden_threads)
{
*num_ptls = 0;
*thread_min = MPI_THREAD_MULTIPLE;
*thread_max = MPI_THREAD_MULTIPLE;
*allow_multi_user_threads = true;
*have_hidden_threads = false;
/* initialize containers */
lam_reactor_init(&mca_ptl_tcp_module.tcp_reactor);