Try to impose a little bit of consistency on how we parse lists of
modules by enforcing the use of OPAL list accessors. This commit was SVN r30045.
Этот коммит содержится в:
родитель
264150872b
Коммит
38cbaeaa82
@ -68,25 +68,16 @@ mca_mpool_base_module_t* mca_mpool_base_module_create(
|
||||
{
|
||||
mca_mpool_base_component_t* component = NULL;
|
||||
mca_mpool_base_module_t* module = NULL;
|
||||
opal_list_item_t* item;
|
||||
mca_base_component_list_item_t *cli;
|
||||
mca_mpool_base_selected_module_t *sm;
|
||||
|
||||
for (item = opal_list_get_first(&ompi_mpool_base_framework.framework_components);
|
||||
item != opal_list_get_end(&ompi_mpool_base_framework.framework_components);
|
||||
item = opal_list_get_next(item)) {
|
||||
mca_base_component_list_item_t *cli =
|
||||
(mca_base_component_list_item_t *) item;
|
||||
component =
|
||||
(mca_mpool_base_component_t *) cli->cli_component;
|
||||
OPAL_LIST_FOREACH(cli, &ompi_mpool_base_framework.framework_components, mca_base_component_list_item_t) {
|
||||
component = (mca_mpool_base_component_t *) cli->cli_component;
|
||||
if(0 == strcmp(component->mpool_version.mca_component_name, name)) {
|
||||
module = component->mpool_init(resources);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (opal_list_get_end(&ompi_mpool_base_framework.framework_components) == item) {
|
||||
return NULL;
|
||||
}
|
||||
module = component->mpool_init(resources);
|
||||
if ( NULL == module ) {
|
||||
return NULL;
|
||||
}
|
||||
@ -107,9 +98,9 @@ mca_mpool_base_module_t* mca_mpool_base_module_create(
|
||||
leave_pinned variables may have been set by a user MCA
|
||||
param or elsewhere in the code base). Yes, we could have
|
||||
coded this more succinctly, but this is more clear. Do not
|
||||
check memory hooks if the mpool explicity asked us not to. */
|
||||
check memory hooks if the mpool explicity asked us not to. */
|
||||
if ((ompi_mpi_leave_pinned > 0 || ompi_mpi_leave_pinned_pipeline) &&
|
||||
!(module->flags & MCA_MPOOL_FLAGS_NO_HOOKS)) {
|
||||
!(module->flags & MCA_MPOOL_FLAGS_NO_HOOKS)) {
|
||||
use_mem_hooks = 1;
|
||||
}
|
||||
|
||||
@ -136,13 +127,9 @@ mca_mpool_base_module_t* mca_mpool_base_module_create(
|
||||
|
||||
mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name)
|
||||
{
|
||||
opal_list_item_t* item;
|
||||
|
||||
for (item = opal_list_get_first(&mca_mpool_base_modules);
|
||||
item != opal_list_get_end(&mca_mpool_base_modules);
|
||||
item = opal_list_get_next(item)) {
|
||||
mca_mpool_base_selected_module_t *mli =
|
||||
(mca_mpool_base_selected_module_t *) item;
|
||||
mca_mpool_base_selected_module_t *mli;
|
||||
|
||||
OPAL_LIST_FOREACH(mli, &mca_mpool_base_modules, mca_mpool_base_selected_module_t) {
|
||||
if(0 == strcmp(mli->mpool_component->mpool_version.mca_component_name,
|
||||
name)) {
|
||||
return mli->mpool_module;
|
||||
@ -155,15 +142,11 @@ mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name)
|
||||
|
||||
int mca_mpool_base_module_destroy(mca_mpool_base_module_t *module)
|
||||
{
|
||||
opal_list_item_t* item;
|
||||
mca_mpool_base_selected_module_t *sm;
|
||||
mca_mpool_base_selected_module_t *sm, *next;
|
||||
|
||||
for (item = opal_list_get_first(&mca_mpool_base_modules);
|
||||
item != opal_list_get_end(&mca_mpool_base_modules);
|
||||
item = opal_list_get_next(item)) {
|
||||
sm = (mca_mpool_base_selected_module_t *) item;
|
||||
OPAL_LIST_FOREACH_SAFE(sm, next, &mca_mpool_base_modules, mca_mpool_base_selected_module_t) {
|
||||
if (module == sm->mpool_module) {
|
||||
opal_list_remove_item(&mca_mpool_base_modules,item);
|
||||
opal_list_remove_item(&mca_mpool_base_modules, (opal_list_item_t*)sm);
|
||||
if (NULL != sm->mpool_module->mpool_finalize) {
|
||||
sm->mpool_module->mpool_finalize(sm->mpool_module);
|
||||
}
|
||||
|
@ -30,34 +30,28 @@
|
||||
|
||||
mca_rcache_base_module_t* mca_rcache_base_module_create(const char* name)
|
||||
{
|
||||
|
||||
mca_rcache_base_component_t* component = NULL;
|
||||
mca_rcache_base_module_t* module = NULL;
|
||||
opal_list_item_t* item;
|
||||
mca_base_component_list_item_t* cli;
|
||||
mca_rcache_base_component_t* component = NULL;
|
||||
mca_rcache_base_module_t* module = NULL;
|
||||
mca_rcache_base_selected_module_t *sm;
|
||||
bool found = false;
|
||||
|
||||
for (item = opal_list_get_first(&ompi_rcache_base_framework.framework_components);
|
||||
item != opal_list_get_end(&ompi_rcache_base_framework.framework_components);
|
||||
item = opal_list_get_next(item)) {
|
||||
mca_base_component_list_item_t *cli =
|
||||
(mca_base_component_list_item_t *) item;
|
||||
component =
|
||||
(mca_rcache_base_component_t *) cli->cli_component;
|
||||
OPAL_LIST_FOREACH(cli, &ompi_rcache_base_framework.framework_components, mca_base_component_list_item_t) {
|
||||
component = (mca_rcache_base_component_t *) cli->cli_component;
|
||||
if(0 == strcmp(component->rcache_version.mca_component_name, name)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!found) {
|
||||
return NULL;
|
||||
}
|
||||
module = component->rcache_init();
|
||||
sm = OBJ_NEW(mca_rcache_base_selected_module_t);
|
||||
sm->rcache_component = component;
|
||||
sm->rcache_module = module;
|
||||
opal_list_append(&mca_rcache_base_modules, (opal_list_item_t*) sm);
|
||||
return module;
|
||||
sm = OBJ_NEW(mca_rcache_base_selected_module_t);
|
||||
sm->rcache_component = component;
|
||||
sm->rcache_module = module;
|
||||
opal_list_append(&mca_rcache_base_modules, (opal_list_item_t*) sm);
|
||||
return module;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ int mca_base_select(const char *type_name, int output_id,
|
||||
mca_base_component_list_item_t *cli = NULL;
|
||||
mca_base_component_t *component = NULL;
|
||||
mca_base_module_t *module = NULL;
|
||||
opal_list_item_t *item = NULL;
|
||||
int priority = 0, best_priority = INT32_MIN;
|
||||
|
||||
*best_module = NULL;
|
||||
@ -49,10 +48,7 @@ int mca_base_select(const char *type_name, int output_id,
|
||||
* Traverse the list of available components.
|
||||
* For each call their 'query' functions to determine relative priority.
|
||||
*/
|
||||
for (item = opal_list_get_first(components_available);
|
||||
item != opal_list_get_end(components_available);
|
||||
item = opal_list_get_next(item) ) {
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
OPAL_LIST_FOREACH(cli, components_available, mca_base_component_list_item_t) {
|
||||
component = (mca_base_component_t *) cli->cli_component;
|
||||
|
||||
/*
|
||||
@ -118,7 +114,7 @@ int mca_base_select(const char *type_name, int output_id,
|
||||
opal_output_verbose(5, output_id,
|
||||
"mca:base:select:(%5s) Selected component [%s]",
|
||||
type_name, (*best_component)->mca_component_name);
|
||||
|
||||
|
||||
/*
|
||||
* Close the non-selected components
|
||||
*/
|
||||
|
@ -34,7 +34,6 @@ static bool selected = false;
|
||||
*/
|
||||
int orte_rmaps_base_select(void)
|
||||
{
|
||||
opal_list_item_t *item, *itm2;
|
||||
mca_base_component_list_item_t *cli = NULL;
|
||||
mca_base_component_t *component = NULL;
|
||||
mca_base_module_t *module = NULL;
|
||||
@ -48,12 +47,9 @@ int orte_rmaps_base_select(void)
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
selected = true;
|
||||
|
||||
|
||||
/* Query all available components and ask if they have a module */
|
||||
for (item = opal_list_get_first(&orte_rmaps_base_framework.framework_components);
|
||||
opal_list_get_end(&orte_rmaps_base_framework.framework_components) != item;
|
||||
item = opal_list_get_next(item)) {
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
OPAL_LIST_FOREACH(cli, &orte_rmaps_base_framework.framework_components, mca_base_component_list_item_t) {
|
||||
component = (mca_base_component_t *) cli->cli_component;
|
||||
|
||||
opal_output_verbose(5, orte_rmaps_base_framework.framework_output,
|
||||
@ -91,13 +87,10 @@ int orte_rmaps_base_select(void)
|
||||
|
||||
/* maintain priority order */
|
||||
inserted = false;
|
||||
for (itm2 = opal_list_get_first(&orte_rmaps_base.selected_modules);
|
||||
itm2 != opal_list_get_end(&orte_rmaps_base.selected_modules);
|
||||
itm2 = opal_list_get_next(itm2)) {
|
||||
mod = (orte_rmaps_base_selected_module_t*)itm2;
|
||||
OPAL_LIST_FOREACH(mod, &orte_rmaps_base.selected_modules, orte_rmaps_base_selected_module_t) {
|
||||
if (priority > mod->pri) {
|
||||
opal_list_insert_pos(&orte_rmaps_base.selected_modules,
|
||||
itm2, &newmodule->super);
|
||||
(opal_list_item_t*)mod, &newmodule->super);
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
@ -111,10 +104,7 @@ int orte_rmaps_base_select(void)
|
||||
if (4 < opal_output_get_verbosity(orte_rmaps_base_framework.framework_output)) {
|
||||
opal_output(0, "%s: Final mapper priorities", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
||||
/* show the prioritized list */
|
||||
for (itm2 = opal_list_get_first(&orte_rmaps_base.selected_modules);
|
||||
itm2 != opal_list_get_end(&orte_rmaps_base.selected_modules);
|
||||
itm2 = opal_list_get_next(itm2)) {
|
||||
mod = (orte_rmaps_base_selected_module_t*)itm2;
|
||||
OPAL_LIST_FOREACH(mod, &orte_rmaps_base.selected_modules, orte_rmaps_base_selected_module_t) {
|
||||
opal_output(0, "\tMapper: %s Priority: %d", mod->component->mca_component_name, mod->pri);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,8 @@ MCA_BASE_FRAMEWORK_DECLARE(orte, rml, "ORTE Run-Time Messaging Layer",
|
||||
|
||||
int orte_rml_base_select(void)
|
||||
{
|
||||
opal_list_item_t *item;
|
||||
opal_list_item_t *item, *next;
|
||||
mca_base_component_list_item_t *cli;
|
||||
|
||||
int selected_priority = -1;
|
||||
orte_rml_component_t *selected_component = NULL;
|
||||
@ -104,14 +105,9 @@ int orte_rml_base_select(void)
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
selected = true;
|
||||
|
||||
for (item = opal_list_get_first(&orte_rml_base_framework.framework_components);
|
||||
item != opal_list_get_end(&orte_rml_base_framework.framework_components) ;
|
||||
item = opal_list_get_next(item)) {
|
||||
mca_base_component_list_item_t *cli;
|
||||
|
||||
OPAL_LIST_FOREACH(cli, &orte_rml_base_framework.framework_components, mca_base_component_list_item_t ) {
|
||||
orte_rml_component_t* component;
|
||||
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
component = (orte_rml_component_t *) cli->cli_component;
|
||||
|
||||
opal_output_verbose(10, orte_rml_base_framework.framework_output,
|
||||
@ -159,31 +155,21 @@ int orte_rml_base_select(void)
|
||||
/*
|
||||
* Unload all components that were not selected
|
||||
*/
|
||||
item = opal_list_get_first(&orte_rml_base_framework.framework_components);
|
||||
while (item != opal_list_get_end(&orte_rml_base_framework.framework_components)) {
|
||||
opal_list_item_t* next = opal_list_get_next(item);
|
||||
orte_rml_component_t* component;
|
||||
mca_base_component_list_item_t *cli;
|
||||
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
component = (orte_rml_component_t *) cli->cli_component;
|
||||
OPAL_LIST_FOREACH_SAFE(item, next, &orte_rml_base_framework.framework_components, opal_list_item_t) {
|
||||
mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item;
|
||||
orte_rml_component_t* component = (orte_rml_component_t *) cli->cli_component;
|
||||
|
||||
/* Keep it if it is the wrapper component */
|
||||
if (NULL != wrapper_component &&
|
||||
component == wrapper_component) {
|
||||
item = next;
|
||||
if ((component == wrapper_component) || (component == selected_component)) {
|
||||
continue;
|
||||
}
|
||||
/* Not the selected component */
|
||||
if (component != selected_component) {
|
||||
opal_output_verbose(10, orte_rml_base_framework.framework_output,
|
||||
"orte_rml_base_select: module %s unloaded",
|
||||
component->rml_version.mca_component_name);
|
||||
|
||||
mca_base_component_repository_release((mca_base_component_t *) component);
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
item = next;
|
||||
opal_output_verbose(10, orte_rml_base_framework.framework_output,
|
||||
"orte_rml_base_select: module %s unloaded",
|
||||
component->rml_version.mca_component_name);
|
||||
opal_list_remove_item(&orte_rml_base_framework.framework_components, item);
|
||||
mca_base_component_repository_release((mca_base_component_t *) component);
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
|
||||
/* setup reference to selected module */
|
||||
|
@ -44,7 +44,6 @@ int orte_sensor_base_select(void)
|
||||
mca_base_component_t *component = NULL;
|
||||
mca_base_module_t *module = NULL;
|
||||
orte_sensor_active_module_t *i_module;
|
||||
opal_list_item_t *item;
|
||||
int priority = 0, i, j, low_i;
|
||||
opal_pointer_array_t tmp_array;
|
||||
bool none_found;
|
||||
@ -57,21 +56,18 @@ int orte_sensor_base_select(void)
|
||||
selected = true;
|
||||
|
||||
OBJ_CONSTRUCT(&tmp_array, opal_pointer_array_t);
|
||||
|
||||
|
||||
opal_output_verbose(10, orte_sensor_base_framework.framework_output,
|
||||
"sensor:base:select: Auto-selecting components");
|
||||
|
||||
|
||||
/*
|
||||
* Traverse the list of available components.
|
||||
* For each call their 'query' functions to determine relative priority.
|
||||
*/
|
||||
none_found = true;
|
||||
for (item = opal_list_get_first(&orte_sensor_base_framework.framework_components);
|
||||
item != opal_list_get_end(&orte_sensor_base_framework.framework_components);
|
||||
item = opal_list_get_next(item) ) {
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
OPAL_LIST_FOREACH(cli, &orte_sensor_base_framework.framework_components, mca_base_component_list_item_t) {
|
||||
component = (mca_base_component_t *) cli->cli_component;
|
||||
|
||||
|
||||
/*
|
||||
* If there is a query function then use it.
|
||||
*/
|
||||
@ -81,16 +77,16 @@ int orte_sensor_base_select(void)
|
||||
component->mca_component_name );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Query this component for the module and priority
|
||||
*/
|
||||
opal_output_verbose(5, orte_sensor_base_framework.framework_output,
|
||||
"sensor:base:select Querying component [%s]",
|
||||
component->mca_component_name);
|
||||
|
||||
|
||||
component->mca_query_component(&module, &priority);
|
||||
|
||||
|
||||
/*
|
||||
* If no module was returned or negative priority, then skip component
|
||||
*/
|
||||
@ -100,7 +96,7 @@ int orte_sensor_base_select(void)
|
||||
component->mca_component_name );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Append them to the temporary list, we will sort later
|
||||
*/
|
||||
@ -111,16 +107,16 @@ int orte_sensor_base_select(void)
|
||||
tmp_module->component = component;
|
||||
tmp_module->module = (orte_sensor_base_module_t*)module;
|
||||
tmp_module->priority = priority;
|
||||
|
||||
|
||||
opal_pointer_array_add(&tmp_array, (void*)tmp_module);
|
||||
none_found = false;
|
||||
}
|
||||
|
||||
|
||||
if (none_found) {
|
||||
/* okay for no modules to be found */
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* ensure my_proc and my_node are available on the global arrays */
|
||||
if (NULL == (jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid))) {
|
||||
orte_sensor_base.my_proc = OBJ_NEW(orte_proc_t);
|
||||
@ -148,10 +144,10 @@ int orte_sensor_base_select(void)
|
||||
if( NULL == tmp_module_sw ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
low_i = -1;
|
||||
priority = tmp_module_sw->priority;
|
||||
|
||||
|
||||
for(i = 0; i < tmp_array.size; ++i) {
|
||||
tmp_module = (orte_sensor_active_module_t*)opal_pointer_array_get_item(&tmp_array, i);
|
||||
if( NULL == tmp_module ) {
|
||||
@ -162,7 +158,7 @@ int orte_sensor_base_select(void)
|
||||
priority = tmp_module->priority;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( low_i >= 0 ) {
|
||||
tmp_module = (orte_sensor_active_module_t*)opal_pointer_array_get_item(&tmp_array, low_i);
|
||||
opal_pointer_array_set_item(&tmp_array, low_i, NULL);
|
||||
@ -177,7 +173,7 @@ int orte_sensor_base_select(void)
|
||||
opal_pointer_array_add(&orte_sensor_base.modules, tmp_module);
|
||||
}
|
||||
OBJ_DESTRUCT(&tmp_array);
|
||||
|
||||
|
||||
/*
|
||||
* Initialize each of the modules in priority order from
|
||||
* highest to lowest
|
||||
@ -194,6 +190,6 @@ int orte_sensor_base_select(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user