1
1

Fix component close issue with topo, coll, and io.

This commit was SVN r3556.
Этот коммит содержится в:
Jeff Squyres 2004-11-12 16:55:41 +00:00
родитель 73385f189e
Коммит 22f9115c82
11 изменённых файлов: 24 добавлений и 28 удалений

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

@ -36,12 +36,11 @@ OBJ_CLASS_DECLARATION(mca_base_component_list_item_t);
* Structure for making priority lists of components
*/
struct mca_base_component_priority_list_item_t {
ompi_list_item_t super;
mca_base_component_list_item_t super;
int cpli_priority;
bool cpli_allow_multi_user_threads;
bool cpli_have_hidden_threads;
const mca_base_component_t *cpli_component;
};
typedef struct mca_base_component_priority_list_item_t
mca_base_component_priority_list_item_t;

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

@ -33,7 +33,8 @@ mca_base_component_compare_priority(mca_base_component_priority_list_item_t *a,
} else if (a->cpli_priority < b->cpli_priority) {
return 1;
} else {
return mca_base_component_compare(a->cpli_component, b->cpli_component);
return mca_base_component_compare(a->super.cli_component,
b->super.cli_component);
}
}

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

@ -15,7 +15,7 @@ int mca_base_components_close(int output_id,
const mca_base_component_t *skip)
{
ompi_list_item_t *item;
mca_base_component_list_item_t *cli;
mca_base_component_priority_list_item_t *pcli, *skipped_pcli = NULL;
const mca_base_component_t *component;
/* Close and unload all components in the available list, except the
@ -26,8 +26,8 @@ int mca_base_components_close(int output_id,
for (item = ompi_list_remove_first(components_available);
NULL != item;
item = ompi_list_remove_first(components_available)) {
cli = (mca_base_component_list_item_t *) item;
component = cli->cli_component;
pcli = (mca_base_component_priority_list_item_t *) item;
component = pcli->super.cli_component;
if (component != skip) {
@ -47,20 +47,17 @@ int mca_base_components_close(int output_id,
"mca: base: close: unloading component %s",
component->mca_component_name);
mca_base_component_repository_release((mca_base_component_t *) component);
free(pcli);
} else {
skipped_pcli = pcli;
}
free(cli);
}
/* Re-add the skipped component to the available list (see above
comment) */
/* If we found it, re-add the skipped component to the available
list (see above comment) */
if (NULL != skip) {
cli = malloc(sizeof(mca_base_component_list_item_t));
if (NULL == cli) {
return OMPI_ERR_OUT_OF_RESOURCE;
}
cli->cli_component = skip;
ompi_list_append(components_available, (ompi_list_item_t *) cli);
if (NULL != skipped_pcli) {
ompi_list_append(components_available, (ompi_list_item_t *) skipped_pcli);
}
/* All done */

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

@ -26,7 +26,7 @@ OBJ_CLASS_INSTANCE(mca_base_component_list_item_t,
* Class instance of the mca_base_component_priority_list_item_t class
*/
OBJ_CLASS_INSTANCE(mca_base_component_priority_list_item_t,
ompi_list_item_t, cpl_constructor, NULL);
mca_base_component_list_item_t, cpl_constructor, NULL);
/*
@ -49,5 +49,4 @@ static void cpl_constructor(ompi_object_t *obj)
cpli->cpli_priority = -1;
cpli->cpli_allow_multi_user_threads = false;
cpli->cpli_have_hidden_threads = false;
cpli->cpli_component = NULL;
}

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

@ -312,7 +312,7 @@ static ompi_list_t *check_components(ompi_list_t *components,
item != ompi_list_get_end(components);
item = ompi_list_get_next(item)) {
component = ((mca_base_component_priority_list_item_t *)
item)->cpli_component;
item)->super.cli_component;
/* If we have a list of names, scan through it */

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

@ -74,7 +74,7 @@ int mca_coll_base_find_available(bool *allow_multi_user_threads,
represent different versions of the coll MCA. */
entry = OBJ_NEW(mca_base_component_priority_list_item_t);
entry->cpli_component = component;
entry->super.cli_component = component;
entry->cpli_priority = 0;
if (OMPI_SUCCESS == init_query(component, entry)) {

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

@ -193,7 +193,7 @@ static ompi_list_t *check_components(ompi_list_t *components,
item != ompi_list_get_end(components);
item = ompi_list_get_next(item)) {
component = ((mca_base_component_priority_list_item_t *)
item)->cpli_component;
item)->super.cli_component;
/* If we have a list of names, scan through it */

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

@ -238,7 +238,7 @@ static ompi_list_t *check_components(ompi_list_t *components,
item != ompi_list_get_end(components);
item = ompi_list_get_next(item)) {
component = ((mca_base_component_priority_list_item_t *)
item)->cpli_component;
item)->super.cli_component;
/* If we have a list of names, scan through it */

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

@ -70,7 +70,7 @@ int mca_io_base_find_available(bool *allow_multi_user_threads,
represent different versions of the io MCA. */
entry = OBJ_NEW(mca_base_component_priority_list_item_t);
entry->cpli_component = component;
entry->super.cli_component = component;
entry->cpli_priority = 0;
if (OMPI_SUCCESS == init_query(component, entry)) {

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

@ -171,7 +171,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm,
item = ompi_list_get_next(item)) {
/* convert the ompi_list_item_t returned into the proper type */
cpli = (mca_base_component_priority_list_item_t *) item;
component = (mca_topo_base_component_t *) cpli->cpli_component;
component = (mca_topo_base_component_t *) cpli->super.cli_component;
ompi_output_verbose(10, mca_topo_base_output,
"select: initialising %s component %s",
component->topom_version.mca_type_name,
@ -219,7 +219,7 @@ int mca_topo_base_comm_select (struct ompi_communicator_t *comm,
* convert the ompi_list_item_t returned into the proper type
*/
cpli = (mca_base_component_priority_list_item_t *) item;
component = (mca_topo_base_component_t *) cpli->cpli_component;
component = (mca_topo_base_component_t *) cpli->super.cli_component;
ompi_output_verbose(10, mca_topo_base_output,
"select: initialising %s component %s",
component->topom_version.mca_type_name,

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

@ -41,13 +41,13 @@ int mca_topo_base_find_available(bool *allow_multi_user_threads,
NULL != p;
p = ompi_list_remove_first (&mca_topo_base_components_opened)) {
entry = OBJ_NEW(mca_base_component_priority_list_item_t);
entry->cpli_component =
entry->super.cli_component =
((mca_base_component_list_item_t *)p)->cli_component;
/* Now for this entry, we have to determine the thread level. Call
a subroutine to do the job for us */
if (OMPI_SUCCESS == init_query(entry->cpli_component, entry)) {
if (OMPI_SUCCESS == init_query(entry->super.cli_component, entry)) {
/* Save the results in the list. The priority is not relvant at
this point in time. But we save the thread arguments so that
the initial selection algorithm can negotiate overall thread
@ -60,7 +60,7 @@ int mca_topo_base_find_available(bool *allow_multi_user_threads,
/* The component does not want to run, so close it. Its close()
has already been invoked. Close it out of the DSO repository
(if it is there in the repository) */
mca_base_component_repository_release (entry->cpli_component);
mca_base_component_repository_release(entry->super.cli_component);
OBJ_RELEASE(entry);
}
/* Free entry from the "opened" list */