Solve the issues when several PML are available. The main problem here come from the fact that an PML
is a lot more difficult than a PTL, and it can adapt it's behavior to the level of threading required by the user. In this case the behavior is the priorit of the PML. Therefore this information is never availale before the init function (of the PML) is called. So I try to keep nearly the same structure as it was before, with one change. When a PML get initialized it does not necessarily means it has been selected, so it does not means it has to create all it's internal structures (and select the PTL and all this stuff). They can all be done later, when a PML knows that it definitively get selected (when the enable function is called with the argument set to true). Thus, in the case of a PML close one have to check if the PML has been selected or not before trying to clean up the internals. I had to change the MPI_Init function to allow the PML to be enabled before we start adding procs inside. This commit was SVN r6434.
Этот коммит содержится в:
родитель
59d886e6c7
Коммит
6aa956241f
@ -22,7 +22,7 @@
|
||||
#include "mca/base/base.h"
|
||||
#include "mca/pml/pml.h"
|
||||
#include "mca/pml/base/base.h"
|
||||
|
||||
#include "ompi/mca/ptl/base/base.h"
|
||||
|
||||
/*
|
||||
* The following file was created by configure. It contains extern
|
||||
@ -70,24 +70,23 @@ char *mca_pml_base_pml;
|
||||
*/
|
||||
int mca_pml_base_open(void)
|
||||
{
|
||||
/* Open up all available components */
|
||||
/* Open up all available components */
|
||||
|
||||
if (OMPI_SUCCESS !=
|
||||
mca_base_components_open("pml", 0, mca_pml_base_static_components,
|
||||
&mca_pml_base_components_available,
|
||||
!MCA_pml_DIRECT_CALL)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
if (OMPI_SUCCESS !=
|
||||
mca_base_components_open("pml", 0, mca_pml_base_static_components,
|
||||
&mca_pml_base_components_available,
|
||||
!MCA_pml_DIRECT_CALL)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
/* Set a sentinel in case we don't select any components (e.g.,
|
||||
ompi_info) */
|
||||
/* Set a sentinel in case we don't select any components (e.g.,
|
||||
ompi_info) */
|
||||
|
||||
mca_pml_base_selected_component.pmlm_finalize = NULL;
|
||||
mca_pml_base_selected_component.pmlm_finalize = NULL;
|
||||
|
||||
mca_base_param_lookup_string(
|
||||
mca_base_param_register_string("pml",NULL,NULL,NULL,NULL), &mca_pml_base_pml);
|
||||
mca_base_param_lookup_string(
|
||||
mca_base_param_register_string("pml",NULL,NULL,NULL,NULL), &mca_pml_base_pml);
|
||||
|
||||
/* All done */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
/* All done, now let's start the PTLs */
|
||||
return mca_ptl_base_open();
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ typedef struct opened_component_t {
|
||||
mca_pml_base_component_t *om_component;
|
||||
} opened_component_t;
|
||||
|
||||
|
||||
/**
|
||||
* Function for selecting one component from all those that are
|
||||
* available.
|
||||
@ -60,100 +59,106 @@ int mca_pml_base_select(bool enable_progress_threads,
|
||||
OBJ_CONSTRUCT(&opened, opal_list_t);
|
||||
for (item = opal_list_get_first(&mca_pml_base_components_available);
|
||||
opal_list_get_end(&mca_pml_base_components_available) != item;
|
||||
item = opal_list_get_next(item)) {
|
||||
item = opal_list_get_next(item) ) {
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
component = (mca_pml_base_component_t *) cli->cli_component;
|
||||
|
||||
/* if there is an include list - item must be in the list to be included */
|
||||
if ( NULL != mca_pml_base_pml &&
|
||||
strcmp(component->pmlm_version.mca_component_name, mca_pml_base_pml) != 0)
|
||||
strcmp(component->pmlm_version.mca_component_name, mca_pml_base_pml) != 0) {
|
||||
opal_output_verbose( 10, mca_pml_base_output,
|
||||
"select: component %s not in the include list",
|
||||
component->pmlm_version.mca_component_name );
|
||||
continue;
|
||||
}
|
||||
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: initializing %s component %s",
|
||||
component->pmlm_version.mca_type_name,
|
||||
component->pmlm_version.mca_component_name);
|
||||
if (NULL == component->pmlm_init) {
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: no init function; ignoring component");
|
||||
} else {
|
||||
module = component->pmlm_init(&priority, enable_progress_threads,
|
||||
enable_mpi_threads);
|
||||
if (NULL == module) {
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: init returned failure");
|
||||
} else {
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: init returned priority %d", priority);
|
||||
if (priority > best_priority) {
|
||||
best_priority = priority;
|
||||
best_component = component;
|
||||
best_module = module;
|
||||
}
|
||||
opal_output_verbose( 10, mca_pml_base_output,
|
||||
"select: no init function; ignoring component %s",
|
||||
component->pmlm_version.mca_component_name );
|
||||
continue;
|
||||
}
|
||||
opal_output_verbose( 10, mca_pml_base_output,
|
||||
"select: initializing %s component %s",
|
||||
component->pmlm_version.mca_type_name,
|
||||
component->pmlm_version.mca_component_name );
|
||||
module = component->pmlm_init(&priority, enable_progress_threads,
|
||||
enable_mpi_threads);
|
||||
if (NULL == module) {
|
||||
opal_output_verbose( 10, mca_pml_base_output,
|
||||
"select: init returned failure for component %s",
|
||||
component->pmlm_version.mca_component_name );
|
||||
continue;
|
||||
}
|
||||
opal_output_verbose( 10, mca_pml_base_output,
|
||||
"select: init returned priority %d", priority );
|
||||
if (priority > best_priority) {
|
||||
best_priority = priority;
|
||||
best_component = component;
|
||||
best_module = module;
|
||||
}
|
||||
|
||||
om = malloc(sizeof(opened_component_t));
|
||||
if (NULL == om) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
OBJ_CONSTRUCT(om, opal_list_item_t);
|
||||
om->om_component = component;
|
||||
opal_list_append(&opened, (opal_list_item_t*) om);
|
||||
}
|
||||
|
||||
om = malloc(sizeof(opened_component_t));
|
||||
if (NULL == om) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
OBJ_CONSTRUCT(om, opal_list_item_t);
|
||||
om->om_component = component;
|
||||
opal_list_append(&opened, (opal_list_item_t*) om);
|
||||
/* Finished querying all components. Check for the bozo case. */
|
||||
|
||||
if( NULL == best_component ) {
|
||||
/* JMS Replace with show_help */
|
||||
orte_abort(1, "No pml component available. This shouldn't happen.");
|
||||
}
|
||||
|
||||
/* Finalize all non-selected components */
|
||||
|
||||
for (item = opal_list_remove_first(&opened);
|
||||
NULL != item;
|
||||
item = opal_list_remove_first(&opened)) {
|
||||
om = (opened_component_t *) item;
|
||||
if (om->om_component != best_component) {
|
||||
|
||||
/* Finalize */
|
||||
|
||||
if (NULL != om->om_component->pmlm_finalize) {
|
||||
|
||||
/* Blatently ignore the return code (what would we do to
|
||||
recover, anyway? This component is going away, so errors
|
||||
don't matter anymore) */
|
||||
|
||||
om->om_component->pmlm_finalize();
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: component %s not selected / finalized",
|
||||
component->pmlm_version.mca_component_name);
|
||||
}
|
||||
}
|
||||
OBJ_DESTRUCT( om );
|
||||
free(om);
|
||||
}
|
||||
OBJ_DESTRUCT( &opened );
|
||||
/* This base function closes, unloads, and removes from the
|
||||
available list all unselected components. The available list will
|
||||
contain only the selected component. */
|
||||
|
||||
/* Finished querying all components. Check for the bozo case. */
|
||||
mca_base_components_close(mca_pml_base_output,
|
||||
&mca_pml_base_components_available,
|
||||
(mca_base_component_t *) best_component);
|
||||
|
||||
/* Save the winner */
|
||||
|
||||
if (NULL == best_component) {
|
||||
/* JMS Replace with show_help */
|
||||
orte_abort(1, "No pml component available. This shouldn't happen.");
|
||||
}
|
||||
mca_pml_base_selected_component = *best_component;
|
||||
mca_pml = *best_module;
|
||||
opal_output_verbose( 10, mca_pml_base_output,
|
||||
"select: component %s selected",
|
||||
best_component->pmlm_version.mca_component_name );
|
||||
/* register the winner's callback */
|
||||
opal_progress_register(mca_pml.pml_progress);
|
||||
|
||||
/* Finalize all non-selected components */
|
||||
/* All done */
|
||||
|
||||
for (item = opal_list_remove_first(&opened);
|
||||
NULL != item;
|
||||
item = opal_list_remove_first(&opened)) {
|
||||
om = (opened_component_t *) item;
|
||||
if (om->om_component != best_component) {
|
||||
|
||||
/* Finalize */
|
||||
|
||||
if (NULL != om->om_component->pmlm_finalize) {
|
||||
|
||||
/* Blatently ignore the return code (what would we do to
|
||||
recover, anyway? This component is going away, so errors
|
||||
don't matter anymore) */
|
||||
|
||||
om->om_component->pmlm_finalize();
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: component %s not selected / finalized",
|
||||
component->pmlm_version.mca_component_name);
|
||||
}
|
||||
}
|
||||
free(om);
|
||||
}
|
||||
|
||||
/* This base function closes, unloads, and removes from the
|
||||
available list all unselected components. The available list will
|
||||
contain only the selected component. */
|
||||
|
||||
mca_base_components_close(mca_pml_base_output,
|
||||
&mca_pml_base_components_available,
|
||||
(mca_base_component_t *) best_component);
|
||||
|
||||
/* Save the winner */
|
||||
|
||||
mca_pml_base_selected_component = *best_component;
|
||||
mca_pml = *best_module;
|
||||
opal_output_verbose(10, mca_pml_base_output,
|
||||
"select: component %s selected",
|
||||
component->pmlm_version.mca_component_name);
|
||||
|
||||
/* register the winner's callback */
|
||||
opal_progress_register(mca_pml.pml_progress);
|
||||
|
||||
/* All done */
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include "pml_ob1_proc.h"
|
||||
#include "pml_ob1_hdr.h"
|
||||
#include "pml_ob1_recvfrag.h"
|
||||
|
||||
#include "pml_ob1_sendreq.h"
|
||||
#include "pml_ob1_recvreq.h"
|
||||
#include "pml_ob1_rdmafrag.h"
|
||||
|
||||
mca_pml_ob1_t mca_pml_ob1 = {
|
||||
{
|
||||
@ -51,9 +53,76 @@ mca_pml_ob1_t mca_pml_ob1 = {
|
||||
}
|
||||
};
|
||||
|
||||
static int mca_pml_ob1_add_btls( void );
|
||||
|
||||
int mca_pml_ob1_enable(bool enable)
|
||||
{
|
||||
int rc;
|
||||
uint32_t proc_arch;
|
||||
|
||||
if( false == enable ) return OMPI_SUCCESS;
|
||||
|
||||
/* post this processes datatype */
|
||||
proc_arch = ompi_proc_local()->proc_arch;
|
||||
proc_arch = htonl(proc_arch);
|
||||
rc = mca_base_modex_send(&mca_pml_ob1_component.pmlm_version, &proc_arch, sizeof(proc_arch));
|
||||
if(rc != OMPI_SUCCESS)
|
||||
return rc;
|
||||
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.lock, opal_mutex_t);
|
||||
|
||||
/* requests */
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.send_requests, ompi_free_list_t);
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.send_requests,
|
||||
sizeof(mca_pml_ob1_send_request_t),
|
||||
OBJ_CLASS(mca_pml_ob1_send_request_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.recv_requests, ompi_free_list_t);
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.recv_requests,
|
||||
sizeof(mca_pml_ob1_recv_request_t),
|
||||
OBJ_CLASS(mca_pml_ob1_recv_request_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
/* fragments */
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.rdma_frags, ompi_free_list_t);
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.rdma_frags,
|
||||
sizeof(mca_pml_ob1_rdma_frag_t),
|
||||
OBJ_CLASS(mca_pml_ob1_rdma_frag_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.recv_frags, ompi_free_list_t);
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.recv_frags,
|
||||
sizeof(mca_pml_ob1_recv_frag_t),
|
||||
OBJ_CLASS(mca_pml_ob1_recv_frag_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.buffers, ompi_free_list_t);
|
||||
|
||||
/* pending operations */
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.send_pending, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.recv_pending, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.acks_pending, opal_list_t);
|
||||
|
||||
if(OMPI_SUCCESS != (rc = mca_pml_ob1_add_btls()) )
|
||||
return rc;
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -102,8 +171,7 @@ static int btl_exclusivity_compare(const void* arg1, const void* arg2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int mca_pml_ob1_add_btls()
|
||||
static int mca_pml_ob1_add_btls( void )
|
||||
{
|
||||
/* build an array of ob1s and ob1 modules */
|
||||
opal_list_t* btls = &mca_btl_base_modules_initialized;
|
||||
|
@ -122,8 +122,6 @@ extern int mca_pml_ob1_del_procs(
|
||||
size_t nprocs
|
||||
);
|
||||
|
||||
extern int mca_pml_ob1_add_btls(void);
|
||||
|
||||
extern int mca_pml_ob1_enable(
|
||||
bool enable
|
||||
);
|
||||
|
@ -78,21 +78,6 @@ static inline int mca_pml_ob1_param_register_int(
|
||||
int mca_pml_ob1_component_open(void)
|
||||
{
|
||||
int param, value;
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.lock, opal_mutex_t);
|
||||
|
||||
/* requests */
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.send_requests, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.recv_requests, ompi_free_list_t);
|
||||
|
||||
/* fragments */
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.rdma_frags, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.recv_frags, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.buffers, ompi_free_list_t);
|
||||
|
||||
/* pending operations */
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.send_pending, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.recv_pending, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pml_ob1.acks_pending, opal_list_t);
|
||||
|
||||
mca_pml_ob1.btl_components = NULL;
|
||||
mca_pml_ob1.num_btl_components = 0;
|
||||
@ -128,9 +113,23 @@ int mca_pml_ob1_component_open(void)
|
||||
int mca_pml_ob1_component_close(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if( NULL == mca_pml_ob1.btl_components ) /* I was not selected */
|
||||
return OMPI_SUCCESS;
|
||||
|
||||
if(OMPI_SUCCESS != (rc = mca_btl_base_close()))
|
||||
return rc;
|
||||
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.acks_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.send_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.recv_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.send_requests);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.recv_requests);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.rdma_frags);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.recv_frags);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.buffers);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.lock);
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if (mca_pml_ob1.send_requests.fl_num_allocated !=
|
||||
mca_pml_ob1.send_requests.super.opal_list_length) {
|
||||
@ -148,22 +147,17 @@ int mca_pml_ob1_component_close(void)
|
||||
|
||||
if(NULL != mca_pml_ob1.btl_components) {
|
||||
free(mca_pml_ob1.btl_components);
|
||||
mca_pml_ob1.btl_components = NULL;
|
||||
}
|
||||
if(NULL != mca_pml_ob1.btl_modules) {
|
||||
free(mca_pml_ob1.btl_modules);
|
||||
mca_pml_ob1.btl_modules = NULL;
|
||||
}
|
||||
if(NULL != mca_pml_ob1.btl_progress) {
|
||||
free(mca_pml_ob1.btl_progress);
|
||||
mca_pml_ob1.btl_progress = NULL;
|
||||
}
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.acks_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.send_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.recv_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.send_requests);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.recv_requests);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.rdma_frags);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.recv_frags);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.buffers);
|
||||
OBJ_DESTRUCT(&mca_pml_ob1.lock);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -172,66 +166,17 @@ mca_pml_base_module_t* mca_pml_ob1_component_init(int* priority,
|
||||
bool enable_progress_threads,
|
||||
bool enable_mpi_threads)
|
||||
{
|
||||
uint32_t proc_arch;
|
||||
int rc;
|
||||
*priority = mca_pml_ob1.priority;
|
||||
|
||||
/* requests */
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.send_requests,
|
||||
sizeof(mca_pml_ob1_send_request_t),
|
||||
OBJ_CLASS(mca_pml_ob1_send_request_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.recv_requests,
|
||||
sizeof(mca_pml_ob1_recv_request_t),
|
||||
OBJ_CLASS(mca_pml_ob1_recv_request_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
/* fragments */
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.rdma_frags,
|
||||
sizeof(mca_pml_ob1_rdma_frag_t),
|
||||
OBJ_CLASS(mca_pml_ob1_rdma_frag_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
ompi_free_list_init(
|
||||
&mca_pml_ob1.recv_frags,
|
||||
sizeof(mca_pml_ob1_recv_frag_t),
|
||||
OBJ_CLASS(mca_pml_ob1_recv_frag_t),
|
||||
mca_pml_ob1.free_list_num,
|
||||
mca_pml_ob1.free_list_max,
|
||||
mca_pml_ob1.free_list_inc,
|
||||
NULL);
|
||||
|
||||
/* buffered send */
|
||||
if(OMPI_SUCCESS != mca_pml_base_bsend_init(enable_mpi_threads)) {
|
||||
opal_output(0, "mca_pml_ob1_component_init: mca_pml_bsend_init failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* post this processes datatype */
|
||||
proc_arch = ompi_proc_local()->proc_arch;
|
||||
proc_arch = htonl(proc_arch);
|
||||
rc = mca_base_modex_send(&mca_pml_ob1_component.pmlm_version, &proc_arch, sizeof(proc_arch));
|
||||
if(rc != OMPI_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
/* initialize NTLs */
|
||||
if(OMPI_SUCCESS != mca_btl_base_select(enable_progress_threads,enable_mpi_threads))
|
||||
return NULL;
|
||||
if(OMPI_SUCCESS != mca_pml_ob1_add_btls())
|
||||
return NULL;
|
||||
|
||||
return &mca_pml_ob1.super;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ static int ptl_exclusivity_compare(const void* arg1, const void* arg2)
|
||||
}
|
||||
|
||||
|
||||
int mca_pml_teg_add_ptls(void)
|
||||
static int mca_pml_teg_add_ptls(void)
|
||||
{
|
||||
/* build an array of ptls and ptl modules */
|
||||
mca_ptl_base_selected_module_t* selected_ptl;
|
||||
@ -161,13 +161,41 @@ int mca_pml_teg_add_ptls(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass control information through to all PTL modules.
|
||||
* Called by the base PML in order to notify the PMLs about their selected status. After the init pass,
|
||||
* the base module will choose one PML (depending on informations provided by the init function) and then
|
||||
* it will call the pml_enable function with true (for the selected one) and with false for all the
|
||||
* others. The selected one can then pass control information through to all PTL modules.
|
||||
*/
|
||||
|
||||
int mca_pml_teg_enable(bool enable)
|
||||
{
|
||||
size_t i=0;
|
||||
int value = enable;
|
||||
int value = enable, rc;
|
||||
uint32_t proc_arch;
|
||||
|
||||
/* If I'm not selected then prepare for close */
|
||||
if( false == enable ) return OMPI_SUCCESS;
|
||||
|
||||
/* recv requests */
|
||||
ompi_free_list_init( &mca_pml_teg.teg_recv_requests,
|
||||
sizeof(mca_pml_teg_recv_request_t),
|
||||
OBJ_CLASS(mca_pml_teg_recv_request_t),
|
||||
mca_pml_teg.teg_free_list_num,
|
||||
mca_pml_teg.teg_free_list_max,
|
||||
mca_pml_teg.teg_free_list_inc,
|
||||
NULL );
|
||||
|
||||
/* I get selected. Publish my information */
|
||||
proc_arch = ompi_proc_local()->proc_arch;
|
||||
proc_arch = htonl(proc_arch);
|
||||
rc = mca_base_modex_send(&mca_pml_teg_component.pmlm_version, &proc_arch, sizeof(proc_arch));
|
||||
if(rc != OMPI_SUCCESS)
|
||||
return rc;
|
||||
|
||||
/* Grab all the PTLs and prepare them */
|
||||
mca_pml_teg_add_ptls();
|
||||
|
||||
/* and now notify them about the status */
|
||||
for(i=0; i<mca_pml_teg.teg_num_ptl_components; i++) {
|
||||
if(NULL != mca_pml_teg.teg_ptl_components[i]->ptlm_control) {
|
||||
int rc = mca_pml_teg.teg_ptl_components[i]->ptlm_control(MCA_PTL_ENABLE,&value,sizeof(value));
|
||||
|
@ -113,8 +113,6 @@ extern int mca_pml_teg_del_procs(
|
||||
size_t nprocs
|
||||
);
|
||||
|
||||
extern int mca_pml_teg_add_ptls(void);
|
||||
|
||||
extern int mca_pml_teg_enable(
|
||||
bool enable
|
||||
);
|
||||
|
@ -77,7 +77,7 @@ int mca_pml_teg_component_open(void)
|
||||
#ifdef WIN32
|
||||
WSADATA win_sock_data;
|
||||
if (WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0) {
|
||||
opal_output (0, "mca_oob_tcp_component_init: failed to initialise windows sockets: %d\n", WSAGetLastError());
|
||||
opal_output (0, "failed to initialise windows sockets: %d\n", WSAGetLastError());
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
#endif
|
||||
@ -105,14 +105,18 @@ int mca_pml_teg_component_open(void)
|
||||
mca_pml_teg.teg_priority =
|
||||
mca_pml_teg_param_register_int("priority", 1);
|
||||
|
||||
/* attempt to open all ptls */
|
||||
return mca_ptl_base_open();
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int mca_pml_teg_component_close(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* I was not enabled */
|
||||
if( NULL == mca_pml_teg.teg_ptl_components )
|
||||
return OMPI_SUCCESS;
|
||||
|
||||
if(OMPI_SUCCESS != (rc = mca_ptl_base_close()))
|
||||
return rc;
|
||||
|
||||
@ -131,12 +135,15 @@ int mca_pml_teg_component_close(void)
|
||||
|
||||
if(NULL != mca_pml_teg.teg_ptl_components) {
|
||||
free(mca_pml_teg.teg_ptl_components);
|
||||
mca_pml_teg.teg_ptl_components = NULL;
|
||||
}
|
||||
if(NULL != mca_pml_teg.teg_ptl_modules) {
|
||||
free(mca_pml_teg.teg_ptl_modules);
|
||||
mca_pml_teg.teg_ptl_modules = NULL;
|
||||
}
|
||||
if(NULL != mca_pml_teg.teg_ptl_progress) {
|
||||
free(mca_pml_teg.teg_ptl_progress);
|
||||
mca_pml_teg.teg_ptl_progress = NULL;
|
||||
}
|
||||
OBJ_DESTRUCT(&mca_pml_teg.teg_send_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_teg.teg_send_requests);
|
||||
@ -147,42 +154,23 @@ int mca_pml_teg_component_close(void)
|
||||
}
|
||||
|
||||
|
||||
mca_pml_base_module_t* mca_pml_teg_component_init(int* priority,
|
||||
bool enable_progress_threads,
|
||||
bool enable_mpi_threads)
|
||||
mca_pml_base_module_t* mca_pml_teg_component_init( int* priority,
|
||||
bool enable_progress_threads,
|
||||
bool enable_mpi_threads )
|
||||
{
|
||||
uint32_t proc_arch;
|
||||
int rc;
|
||||
*priority = mca_pml_teg.teg_priority;
|
||||
|
||||
/* recv requests */
|
||||
ompi_free_list_init(
|
||||
&mca_pml_teg.teg_recv_requests,
|
||||
sizeof(mca_pml_teg_recv_request_t),
|
||||
OBJ_CLASS(mca_pml_teg_recv_request_t),
|
||||
mca_pml_teg.teg_free_list_num,
|
||||
mca_pml_teg.teg_free_list_max,
|
||||
mca_pml_teg.teg_free_list_inc,
|
||||
NULL);
|
||||
|
||||
/* buffered send */
|
||||
if(OMPI_SUCCESS != mca_pml_base_bsend_init(enable_mpi_threads)) {
|
||||
opal_output(0, "mca_pml_teg_component_init: mca_pml_bsend_init failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* post this processes datatype */
|
||||
proc_arch = ompi_proc_local()->proc_arch;
|
||||
proc_arch = htonl(proc_arch);
|
||||
rc = mca_base_modex_send(&mca_pml_teg_component.pmlm_version, &proc_arch, sizeof(proc_arch));
|
||||
if(rc != OMPI_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
rc = mca_ptl_base_select(enable_progress_threads,enable_mpi_threads);
|
||||
if(rc != OMPI_SUCCESS)
|
||||
rc = mca_ptl_base_select( enable_progress_threads, enable_mpi_threads );
|
||||
if( rc != OMPI_SUCCESS )
|
||||
return NULL;
|
||||
|
||||
mca_pml_teg_add_ptls();
|
||||
return &mca_pml_teg.super;
|
||||
}
|
||||
|
||||
|
@ -91,12 +91,13 @@ static int ptl_exclusivity_compare(const void* arg1, const void* arg2)
|
||||
}
|
||||
|
||||
|
||||
int mca_pml_uniq_add_ptls( void )
|
||||
static int mca_pml_uniq_add_ptls( void )
|
||||
{
|
||||
/* build an array of ptls and ptl modules */
|
||||
mca_ptl_base_selected_module_t* selected_ptl;
|
||||
size_t num_ptls = opal_list_get_size(&mca_ptl_base_modules_initialized);
|
||||
size_t cache_bytes = 0;
|
||||
|
||||
mca_pml_uniq.uniq_num_ptl_modules = 0;
|
||||
mca_pml_uniq.uniq_num_ptl_progress = 0;
|
||||
mca_pml_uniq.uniq_num_ptl_components = 0;
|
||||
@ -118,12 +119,12 @@ int mca_pml_uniq_add_ptls( void )
|
||||
size_t i;
|
||||
|
||||
mca_pml_uniq.uniq_ptl_modules[mca_pml_uniq.uniq_num_ptl_modules++] = ptl;
|
||||
for(i=0; i<mca_pml_uniq.uniq_num_ptl_components; i++) {
|
||||
for( i = 0; i < mca_pml_uniq.uniq_num_ptl_components; i++ ) {
|
||||
if(mca_pml_uniq.uniq_ptl_components[i] == ptl->ptl_component) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i == mca_pml_uniq.uniq_num_ptl_components) {
|
||||
if( i == mca_pml_uniq.uniq_num_ptl_components ) {
|
||||
mca_pml_uniq.uniq_ptl_components[mca_pml_uniq.uniq_num_ptl_components++] = ptl->ptl_component;
|
||||
}
|
||||
|
||||
@ -141,20 +142,18 @@ int mca_pml_uniq_add_ptls( void )
|
||||
ptl->ptl_base = NULL;
|
||||
|
||||
/* find maximum required size for cache */
|
||||
if(ptl->ptl_cache_bytes > cache_bytes) {
|
||||
if(ptl->ptl_cache_bytes > cache_bytes)
|
||||
cache_bytes = ptl->ptl_cache_bytes;
|
||||
}
|
||||
}
|
||||
|
||||
/* setup send fragments based on largest required send request */
|
||||
ompi_free_list_init(
|
||||
&mca_pml_uniq.uniq_send_requests,
|
||||
sizeof(mca_pml_uniq_send_request_t) + cache_bytes,
|
||||
OBJ_CLASS(mca_pml_uniq_send_request_t),
|
||||
mca_pml_uniq.uniq_free_list_num,
|
||||
mca_pml_uniq.uniq_free_list_max,
|
||||
mca_pml_uniq.uniq_free_list_inc,
|
||||
NULL);
|
||||
ompi_free_list_init( &mca_pml_uniq.uniq_send_requests,
|
||||
sizeof(mca_pml_uniq_send_request_t) + cache_bytes,
|
||||
OBJ_CLASS(mca_pml_uniq_send_request_t),
|
||||
mca_pml_uniq.uniq_free_list_num,
|
||||
mca_pml_uniq.uniq_free_list_max,
|
||||
mca_pml_uniq.uniq_free_list_inc,
|
||||
NULL );
|
||||
|
||||
/* sort ptl list by exclusivity */
|
||||
qsort(mca_pml_uniq.uniq_ptl_modules, mca_pml_uniq.uniq_num_ptl_modules, sizeof(struct mca_ptl_t*), ptl_exclusivity_compare);
|
||||
@ -162,13 +161,41 @@ int mca_pml_uniq_add_ptls( void )
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass control information through to all PTL modules.
|
||||
* Called by the base PML in order to notify the PMLs about their selected status. After the init pass,
|
||||
* the base module will choose one PML (depending on informations provided by the init function) and then
|
||||
* it will call the pml_enable function with true (for the selected one) and with false for all the
|
||||
* others. The selected one can then pass control information through to all PTL modules.
|
||||
*/
|
||||
|
||||
int mca_pml_uniq_enable( bool enable )
|
||||
{
|
||||
size_t i;
|
||||
int value = enable;
|
||||
int value = enable, rc;
|
||||
uint32_t proc_arch;
|
||||
|
||||
/* If I'm not selected then prepare for close */
|
||||
if( false == enable ) return OMPI_SUCCESS;
|
||||
|
||||
/* recv requests */
|
||||
ompi_free_list_init( &mca_pml_uniq.uniq_recv_requests,
|
||||
sizeof(mca_pml_uniq_recv_request_t),
|
||||
OBJ_CLASS(mca_pml_uniq_recv_request_t),
|
||||
mca_pml_uniq.uniq_free_list_num,
|
||||
mca_pml_uniq.uniq_free_list_max,
|
||||
mca_pml_uniq.uniq_free_list_inc,
|
||||
NULL );
|
||||
|
||||
/* I get selected. Publish my informations */
|
||||
proc_arch = ompi_proc_local()->proc_arch;
|
||||
proc_arch = htonl(proc_arch);
|
||||
rc = mca_base_modex_send(&mca_pml_uniq_component.pmlm_version, &proc_arch, sizeof(proc_arch));
|
||||
if( rc != OMPI_SUCCESS )
|
||||
return rc;
|
||||
|
||||
|
||||
/* Grab all the PTLs and prepare them */
|
||||
mca_pml_uniq_add_ptls();
|
||||
|
||||
for( i = 0; i < mca_pml_uniq.uniq_num_ptl_components; i++ ) {
|
||||
if(NULL != mca_pml_uniq.uniq_ptl_components[i]->ptlm_control) {
|
||||
int rc = mca_pml_uniq.uniq_ptl_components[i]->ptlm_control(MCA_PTL_ENABLE,&value,sizeof(value));
|
||||
|
@ -58,6 +58,7 @@ struct mca_pml_uniq_t {
|
||||
int uniq_free_list_max; /* maximum size of free list */
|
||||
int uniq_free_list_inc; /* number of elements to grow free list */
|
||||
int uniq_poll_iterations; /* number of iterations to poll for completion */
|
||||
int uniq_priority; /* the PML priority */
|
||||
|
||||
/* free list of requests */
|
||||
ompi_free_list_t uniq_send_requests;
|
||||
@ -111,8 +112,6 @@ extern int mca_pml_uniq_del_procs(
|
||||
size_t nprocs
|
||||
);
|
||||
|
||||
extern int mca_pml_uniq_add_ptls(void);
|
||||
|
||||
extern int mca_pml_uniq_enable(
|
||||
bool enable
|
||||
);
|
||||
|
@ -77,7 +77,7 @@ int mca_pml_uniq_component_open(void)
|
||||
#ifdef WIN32
|
||||
WSADATA win_sock_data;
|
||||
if (WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0) {
|
||||
opal_output (0, "mca_oob_tcp_component_init: failed to initialise windows sockets: %d\n", WSAGetLastError());
|
||||
opal_output (0, "failed to initialise windows sockets: %d\n", WSAGetLastError());
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
#endif
|
||||
@ -103,15 +103,20 @@ int mca_pml_uniq_component_open(void)
|
||||
mca_pml_uniq.uniq_poll_iterations =
|
||||
mca_pml_uniq_param_register_int("poll_iterations", 100000);
|
||||
|
||||
/* attempt to open ptls */
|
||||
return mca_ptl_base_open();
|
||||
mca_pml_uniq.uniq_priority =
|
||||
mca_pml_uniq_param_register_int("priority", 50);
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
int mca_pml_uniq_component_close(void)
|
||||
{
|
||||
int rc;
|
||||
if(OMPI_SUCCESS != (rc = mca_ptl_base_close()))
|
||||
|
||||
if( NULL == mca_pml_uniq.uniq_ptl_components ) /* I was not enabled */
|
||||
return OMPI_SUCCESS;
|
||||
|
||||
if( OMPI_SUCCESS != (rc = mca_ptl_base_close()) )
|
||||
return rc;
|
||||
|
||||
#ifdef WIN32
|
||||
@ -129,12 +134,17 @@ int mca_pml_uniq_component_close(void)
|
||||
|
||||
if(NULL != mca_pml_uniq.uniq_ptl_components) {
|
||||
free(mca_pml_uniq.uniq_ptl_components);
|
||||
mca_pml_uniq.uniq_ptl_components = NULL;
|
||||
}
|
||||
mca_pml_uniq.uniq_num_ptl_components = 0;
|
||||
if(NULL != mca_pml_uniq.uniq_ptl_modules) {
|
||||
free(mca_pml_uniq.uniq_ptl_modules);
|
||||
mca_pml_uniq.uniq_ptl_modules = NULL;
|
||||
}
|
||||
mca_pml_uniq.uniq_num_ptl_modules = 0;
|
||||
if(NULL != mca_pml_uniq.uniq_ptl_progress) {
|
||||
free(mca_pml_uniq.uniq_ptl_progress);
|
||||
mca_pml_uniq.uniq_ptl_progress = NULL;
|
||||
}
|
||||
OBJ_DESTRUCT(&mca_pml_uniq.uniq_send_pending);
|
||||
OBJ_DESTRUCT(&mca_pml_uniq.uniq_send_requests);
|
||||
@ -149,38 +159,19 @@ mca_pml_base_module_t* mca_pml_uniq_component_init(int* priority,
|
||||
bool enable_progress_threads,
|
||||
bool enable_mpi_threads)
|
||||
{
|
||||
uint32_t proc_arch;
|
||||
int rc;
|
||||
*priority = 0;
|
||||
|
||||
/* recv requests */
|
||||
ompi_free_list_init(
|
||||
&mca_pml_uniq.uniq_recv_requests,
|
||||
sizeof(mca_pml_uniq_recv_request_t),
|
||||
OBJ_CLASS(mca_pml_uniq_recv_request_t),
|
||||
mca_pml_uniq.uniq_free_list_num,
|
||||
mca_pml_uniq.uniq_free_list_max,
|
||||
mca_pml_uniq.uniq_free_list_inc,
|
||||
NULL);
|
||||
*priority = mca_pml_uniq.uniq_priority;
|
||||
|
||||
/* buffered send */
|
||||
if(OMPI_SUCCESS != mca_pml_base_bsend_init(enable_mpi_threads)) {
|
||||
if( OMPI_SUCCESS != mca_pml_base_bsend_init(enable_mpi_threads) ) {
|
||||
opal_output(0, "mca_pml_uniq_component_init: mca_pml_bsend_init failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* post this processes datatype */
|
||||
proc_arch = ompi_proc_local()->proc_arch;
|
||||
proc_arch = htonl(proc_arch);
|
||||
rc = mca_base_modex_send(&mca_pml_uniq_component.pmlm_version, &proc_arch, sizeof(proc_arch));
|
||||
if(rc != OMPI_SUCCESS)
|
||||
rc = mca_ptl_base_select( enable_progress_threads, enable_mpi_threads );
|
||||
if( rc != OMPI_SUCCESS )
|
||||
return NULL;
|
||||
|
||||
rc = mca_ptl_base_select(enable_progress_threads,enable_mpi_threads);
|
||||
if(rc != OMPI_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
mca_pml_uniq_add_ptls();
|
||||
|
||||
return &mca_pml_uniq.super;
|
||||
}
|
||||
|
||||
|
@ -55,6 +55,7 @@ OMPI_DECLSPEC extern int mca_ptl_base_output;
|
||||
OMPI_DECLSPEC extern char* mca_ptl_base_include;
|
||||
OMPI_DECLSPEC extern char* mca_ptl_base_exclude;
|
||||
OMPI_DECLSPEC extern opal_list_t mca_ptl_base_components_opened;
|
||||
OMPI_DECLSPEC extern opal_list_t mca_ptl_base_components_initialized;
|
||||
OMPI_DECLSPEC extern opal_list_t mca_ptl_base_modules_initialized;
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
|
@ -26,51 +26,57 @@
|
||||
#include "mca/ptl/ptl.h"
|
||||
#include "mca/ptl/base/base.h"
|
||||
|
||||
extern int mca_ptl_base_open_called;
|
||||
|
||||
int mca_ptl_base_close(void)
|
||||
{
|
||||
opal_list_item_t *item;
|
||||
mca_ptl_base_selected_module_t *sm;
|
||||
opal_list_item_t *item;
|
||||
mca_ptl_base_selected_module_t *sm;
|
||||
|
||||
/* disable event processing while cleaning up ptls */
|
||||
opal_event_disable();
|
||||
if( 0 == mca_ptl_base_open_called ) return OMPI_ERROR;
|
||||
mca_ptl_base_open_called = 0;
|
||||
|
||||
/* Finalize all the ptl components and free their list items */
|
||||
/* disable event processing while cleaning up ptls */
|
||||
opal_event_disable();
|
||||
|
||||
for (item = opal_list_remove_first(&mca_ptl_base_modules_initialized);
|
||||
NULL != item;
|
||||
item = opal_list_remove_first(&mca_ptl_base_modules_initialized)) {
|
||||
sm = (mca_ptl_base_selected_module_t *) item;
|
||||
/* Finalize all the ptl components and free their list items */
|
||||
|
||||
/* Blatently ignore the return code (what would we do to recover,
|
||||
anyway? This component is going away, so errors don't matter
|
||||
anymore) */
|
||||
for (item = opal_list_remove_first(&mca_ptl_base_modules_initialized);
|
||||
NULL != item;
|
||||
item = opal_list_remove_first(&mca_ptl_base_modules_initialized)) {
|
||||
sm = (mca_ptl_base_selected_module_t *) item;
|
||||
|
||||
sm->pbsm_module->ptl_finalize(sm->pbsm_module);
|
||||
free(sm);
|
||||
}
|
||||
/* Blatently ignore the return code (what would we do to recover,
|
||||
anyway? This component is going away, so errors don't matter
|
||||
anymore) */
|
||||
|
||||
/* Close all remaining opened components (may be one if this is a
|
||||
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
|
||||
sm->pbsm_module->ptl_finalize(sm->pbsm_module);
|
||||
free(sm);
|
||||
}
|
||||
|
||||
if (0 != opal_list_get_size(&mca_ptl_base_components_opened)) {
|
||||
mca_base_components_close(mca_ptl_base_output,
|
||||
&mca_ptl_base_components_opened, NULL);
|
||||
}
|
||||
/* Close all remaining opened components (may be one if this is a
|
||||
OMPI RTE program, or [possibly] multiple if this is ompi_info) */
|
||||
|
||||
/* cleanup */
|
||||
if( NULL != mca_ptl_base_include ) {
|
||||
free(mca_ptl_base_include);
|
||||
mca_ptl_base_include = NULL;
|
||||
}
|
||||
if( NULL != mca_ptl_base_exclude ) {
|
||||
free(mca_ptl_base_exclude);
|
||||
mca_ptl_base_exclude = NULL;
|
||||
}
|
||||
if (0 != opal_list_get_size(&mca_ptl_base_components_initialized)) {
|
||||
mca_base_components_close(mca_ptl_base_output,
|
||||
&mca_ptl_base_components_initialized, NULL);
|
||||
}
|
||||
OBJ_DESTRUCT( &mca_ptl_base_components_initialized );
|
||||
OBJ_DESTRUCT( &mca_ptl_base_components_opened );
|
||||
|
||||
/* restore event processing */
|
||||
opal_event_enable();
|
||||
/* cleanup */
|
||||
if( NULL != mca_ptl_base_include ) {
|
||||
free(mca_ptl_base_include);
|
||||
mca_ptl_base_include = NULL;
|
||||
}
|
||||
if( NULL != mca_ptl_base_exclude ) {
|
||||
free(mca_ptl_base_exclude);
|
||||
mca_ptl_base_exclude = NULL;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
/* restore event processing */
|
||||
opal_event_enable();
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -42,8 +42,9 @@ int mca_ptl_base_output = -1;
|
||||
char* mca_ptl_base_include = NULL;
|
||||
char* mca_ptl_base_exclude = NULL;
|
||||
opal_list_t mca_ptl_base_components_opened;
|
||||
opal_list_t mca_ptl_base_components_initialized;
|
||||
opal_list_t mca_ptl_base_modules_initialized;
|
||||
|
||||
int mca_ptl_base_open_called = 0;
|
||||
|
||||
/**
|
||||
* Function for finding and opening either all MCA components, or the one
|
||||
@ -51,26 +52,32 @@ opal_list_t mca_ptl_base_modules_initialized;
|
||||
*/
|
||||
int mca_ptl_base_open(void)
|
||||
{
|
||||
/* Open up all available components */
|
||||
|
||||
if (OMPI_SUCCESS !=
|
||||
mca_base_components_open("ptl", 0, mca_ptl_base_static_components,
|
||||
&mca_ptl_base_components_opened, true)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
if( 0 != mca_ptl_base_open_called ) return OMPI_SUCCESS;
|
||||
mca_ptl_base_open_called = 1;
|
||||
|
||||
/* 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
|
||||
ompi_info) */
|
||||
/* Open up all available components */
|
||||
if (OMPI_SUCCESS !=
|
||||
mca_base_components_open("ptl", 0, mca_ptl_base_static_components,
|
||||
&mca_ptl_base_components_opened, true)) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
OBJ_CONSTRUCT(&mca_ptl_base_modules_initialized, opal_list_t);
|
||||
/* Initialize the list containing all the PTL's where the init function has been called */
|
||||
OBJ_CONSTRUCT( &mca_ptl_base_components_initialized, opal_list_t );
|
||||
|
||||
/* register parameters */
|
||||
mca_base_param_lookup_string(
|
||||
mca_base_param_register_string("ptl","base","include",NULL,NULL), &mca_ptl_base_include);
|
||||
mca_base_param_lookup_string(
|
||||
mca_base_param_register_string("ptl","base","exclude",NULL,NULL), &mca_ptl_base_exclude);
|
||||
/* 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
|
||||
ompi_info) */
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
OBJ_CONSTRUCT(&mca_ptl_base_modules_initialized, opal_list_t);
|
||||
|
||||
/* register parameters */
|
||||
mca_base_param_lookup_string(
|
||||
mca_base_param_register_string("ptl","base","include",NULL,NULL), &mca_ptl_base_include);
|
||||
mca_base_param_lookup_string(
|
||||
mca_base_param_register_string("ptl","base","exclude",NULL,NULL), &mca_ptl_base_exclude);
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -35,114 +35,110 @@
|
||||
int mca_ptl_base_select(bool enable_progress_threads,
|
||||
bool enable_mpi_threads)
|
||||
{
|
||||
int i, num_ptls;
|
||||
opal_list_item_t *item;
|
||||
mca_base_component_list_item_t *cli;
|
||||
mca_ptl_base_component_t *component;
|
||||
mca_ptl_base_module_t **modules;
|
||||
mca_ptl_base_selected_module_t *sm;
|
||||
int i, num_ptls;
|
||||
opal_list_item_t *item;
|
||||
opal_list_t* useless = OBJ_NEW(opal_list_t);
|
||||
mca_base_component_list_item_t *cli;
|
||||
mca_ptl_base_component_t *component;
|
||||
mca_ptl_base_module_t **modules;
|
||||
mca_ptl_base_selected_module_t *sm;
|
||||
|
||||
char** include = opal_argv_split(mca_ptl_base_include, ',');
|
||||
char** exclude = opal_argv_split(mca_ptl_base_exclude, ',');
|
||||
char** include = opal_argv_split(mca_ptl_base_include, ',');
|
||||
char** exclude = opal_argv_split(mca_ptl_base_exclude, ',');
|
||||
|
||||
/* Traverse the list of opened modules; call their init
|
||||
functions. */
|
||||
/* Traverse the list of opened modules; call their init
|
||||
functions. */
|
||||
|
||||
item = opal_list_get_first(&mca_ptl_base_components_opened);
|
||||
while(item != opal_list_get_end(&mca_ptl_base_components_opened)) {
|
||||
opal_list_item_t *next = opal_list_get_next(item);
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
while( NULL != (item = opal_list_remove_first(&mca_ptl_base_components_opened)) ) {
|
||||
bool keep_me = false;
|
||||
|
||||
component = (mca_ptl_base_component_t *) cli->cli_component;
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
component = (mca_ptl_base_component_t *) cli->cli_component;
|
||||
|
||||
/* if there is an include list - item must be in the list to be included */
|
||||
if ( NULL != include ) {
|
||||
char** argv = include;
|
||||
bool found = false;
|
||||
while(argv && *argv) {
|
||||
if(strcmp(component->ptlm_version.mca_component_name,*argv) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
/* if there is an include list - item must be in the list to be included */
|
||||
if ( NULL != include ) {
|
||||
char** argv = include;
|
||||
while(argv && *argv) {
|
||||
if(strcmp(component->ptlm_version.mca_component_name,*argv) == 0) {
|
||||
keep_me = true;
|
||||
break;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
/* otherwise - check the exclude list to see if this item has been specifically excluded */
|
||||
} else if ( NULL != exclude ) {
|
||||
char** argv = exclude;
|
||||
keep_me = true;
|
||||
while(argv && *argv) {
|
||||
if(strcmp(component->ptlm_version.mca_component_name,*argv) == 0) {
|
||||
keep_me = false;
|
||||
break;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
if(found == false) {
|
||||
item = next;
|
||||
if( keep_me == false) {
|
||||
opal_list_append( useless, item );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* otherwise - check the exclude list to see if this item has been specifically excluded */
|
||||
} else if ( NULL != exclude ) {
|
||||
char** argv = exclude;
|
||||
bool found = false;
|
||||
while(argv && *argv) {
|
||||
if(strcmp(component->ptlm_version.mca_component_name,*argv) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
argv++;
|
||||
}
|
||||
if(found == true) {
|
||||
item = next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: initializing %s component %s",
|
||||
component->ptlm_version.mca_type_name,
|
||||
component->ptlm_version.mca_component_name);
|
||||
if (NULL == component->ptlm_init) {
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: no init function; ignoring component");
|
||||
} else {
|
||||
modules = component->ptlm_init(&num_ptls, enable_progress_threads,
|
||||
enable_mpi_threads);
|
||||
|
||||
/* If the component didn't initialize, remove it from the opened
|
||||
list and remove it from the component repository */
|
||||
|
||||
if (NULL == modules) {
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: init returned failure");
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: module %s unloaded",
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: initializing %s component %s",
|
||||
component->ptlm_version.mca_type_name,
|
||||
component->ptlm_version.mca_component_name);
|
||||
if (NULL == component->ptlm_init) {
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: no init function; ignoring component");
|
||||
opal_list_append( useless, item );
|
||||
continue;
|
||||
} else {
|
||||
modules = component->ptlm_init(&num_ptls, enable_progress_threads,
|
||||
enable_mpi_threads);
|
||||
|
||||
mca_base_component_repository_release((mca_base_component_t *) component);
|
||||
opal_list_remove_item(&mca_ptl_base_components_opened, item);
|
||||
}
|
||||
/* If the component didn't initialize, remove it from the opened
|
||||
list and remove it from the component repository */
|
||||
|
||||
/* Otherwise, it initialized properly. Save it. */
|
||||
if (NULL == modules) {
|
||||
opal_output_verbose( 10, mca_ptl_base_output,
|
||||
"select: %s PTL init returned failure",
|
||||
component->ptlm_version.mca_component_name);
|
||||
opal_list_append( useless, item );
|
||||
continue;
|
||||
}
|
||||
|
||||
else {
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: init returned success");
|
||||
/* Otherwise, it initialized properly. Save it. */
|
||||
|
||||
for (i = 0; i < num_ptls; ++i) {
|
||||
sm = malloc(sizeof(mca_ptl_base_selected_module_t));
|
||||
if (NULL == sm) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
OBJ_CONSTRUCT(sm, opal_list_item_t);
|
||||
sm->pbsm_component = component;
|
||||
sm->pbsm_module = modules[i];
|
||||
opal_list_append(&mca_ptl_base_modules_initialized,
|
||||
(opal_list_item_t*) sm);
|
||||
else {
|
||||
opal_output_verbose(10, mca_ptl_base_output,
|
||||
"select: init returned success");
|
||||
opal_list_append( &mca_ptl_base_components_initialized, item );
|
||||
for (i = 0; i < num_ptls; ++i) {
|
||||
sm = malloc(sizeof(mca_ptl_base_selected_module_t));
|
||||
if (NULL == sm) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
OBJ_CONSTRUCT(sm, opal_list_item_t);
|
||||
sm->pbsm_component = component;
|
||||
sm->pbsm_module = modules[i];
|
||||
opal_list_append(&mca_ptl_base_modules_initialized,
|
||||
(opal_list_item_t*) sm);
|
||||
}
|
||||
free(modules);
|
||||
}
|
||||
}
|
||||
free(modules);
|
||||
}
|
||||
}
|
||||
item = next;
|
||||
}
|
||||
|
||||
/* Finished querying all components. Check for the bozo case. */
|
||||
/* All useless components have to be cleanly removed */
|
||||
mca_base_components_close( mca_ptl_base_output, useless, NULL );
|
||||
OBJ_RELEASE( useless );
|
||||
|
||||
if (0 == opal_list_get_size(&mca_ptl_base_modules_initialized)) {
|
||||
/* JMS Replace with show_help */
|
||||
orte_abort(1, "No ptl components available. This shouldn't happen.");
|
||||
}
|
||||
/* Finished querying all components. Check for the bozo case. */
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
if (0 == opal_list_get_size(&mca_ptl_base_modules_initialized)) {
|
||||
/* JMS Replace with show_help */
|
||||
orte_abort(1, "No ptl components available. This shouldn't happen.");
|
||||
}
|
||||
|
||||
/* All done */
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
@ -320,27 +320,28 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* start PTL's */
|
||||
ret = MCA_PML_CALL(enable(true));
|
||||
if( OMPI_SUCCESS != ret ) {
|
||||
error = "PML control failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* add all ompi_proc_t's to PML */
|
||||
if (NULL == (procs = ompi_proc_world(&nprocs))) {
|
||||
error = "ompi_proc_world() failed";
|
||||
goto error;
|
||||
}
|
||||
if (OMPI_SUCCESS != (ret = mca_pml.pml_add_procs(procs, nprocs))) {
|
||||
free(procs);
|
||||
ret = MCA_PML_CALL(add_procs(procs, nprocs));
|
||||
free(procs);
|
||||
if( OMPI_SUCCESS != ret ) {
|
||||
error = "PML add procs failed";
|
||||
goto error;
|
||||
}
|
||||
free(procs);
|
||||
|
||||
MCA_PML_CALL(add_comm(&ompi_mpi_comm_world));
|
||||
MCA_PML_CALL(add_comm(&ompi_mpi_comm_self));
|
||||
|
||||
/* start PTL's */
|
||||
if (OMPI_SUCCESS != (ret = mca_pml.pml_enable(true))) {
|
||||
error = "PML control failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Figure out the final MPI thread levels. If we were not
|
||||
compiled for support for MPI threads, then don't allow
|
||||
MPI_THREAD_MULTIPLE. */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user