/* * For each module in the list, check and see if it wants to run, and * do the resulting priority comparison. Make a list of modules to be * only those who returned that they want to run, and put them in * priority order (lowest to highest). */ static opal_list_t *check_components(opal_list_t *components, ompi_op_t *op) { int priority; mca_base_component_list_item_t *cli; const mca_base_component_t *component; ompi_op_base_module_1_0_0_t *module; opal_list_t *selectable; avail_op_t *avail; /* Make a list of the components that query successfully */ selectable = OBJ_NEW(opal_list_t); /* Scan through the list of components. This nested loop is O(N^2), but we should never have too many components and/or names, so this *hopefully* shouldn't matter... */ OPAL_LIST_FOREACH(cli, components, mca_base_component_list_item_t) { component = cli->cli_component; priority = check_one_component(op, component, &module); if (priority >= 0) { /* We have a component that indicated that it wants to run by giving us a module */ avail = OBJ_NEW(avail_op_t); avail->ao_priority = priority; avail->ao_module = module; opal_list_append(selectable, (opal_list_item_t*)avail); } }
/* * For each module in the list, if it is in the list of names (or the * list of names is NULL), then check and see if it wants to run, and * do the resulting priority comparison. Make a list of components to * be only those who returned that they want to run, and put them in * priority order. */ static opal_list_t *check_components(opal_list_t *components, const char *filename, struct ompi_info_t *info, char **names, int num_names) { int i; const mca_base_component_t *component; mca_base_component_list_item_t *cli; bool want_to_check; opal_list_t *selectable; avail_io_t *avail; /* Make a list of the components that query successfully */ selectable = OBJ_NEW(opal_list_t); /* Scan through the list of components. This nested loop is O(N^2), but we should never have too many components and/or names, so this *hopefully* shouldn't matter... */ OPAL_LIST_FOREACH(cli, components, mca_base_component_list_item_t) { component = cli->cli_component; /* If we have a list of names, scan through it */ if (0 == num_names) { want_to_check = true; } else { want_to_check = false; for (i = 0; i < num_names; ++i) { if (0 == strcmp(names[i], component->mca_component_name)) { want_to_check = true; } } } /* If we determined that we want to check this component, then do so */ if (want_to_check) { avail = check_one_component(component, filename, info); if (NULL != avail) { /* Put this item on the list in priority order (highest priority first). Should it go first? */ /* MSC actually put it Lowest priority first */ /* NTH sort this out later */ opal_list_append(selectable, (opal_list_item_t*)avail); } } }
/* * For each module in the list, if it is in the list of names (or the * list of names is NULL), then check and see if it wants to run, and * do the resulting priority comparison. Make a list of components to * be only those who returned that they want to run, and put them in * priority order. */ static opal_list_t *check_components(opal_list_t *components, char *filename, struct ompi_info_t *info, char **names, int num_names) { int i; const mca_base_component_t *component; opal_list_item_t *item, *item2; bool want_to_check; opal_list_t *selectable; avail_io_t *avail, *avail2; /* Make a list of the components that query successfully */ selectable = OBJ_NEW(opal_list_t); /* Scan through the list of components. This nested loop is O(N^2), but we should never have too many components and/or names, so this *hopefully* shouldn't matter... */ for (item = opal_list_get_first(components); item != opal_list_get_end(components); item = opal_list_get_next(item)) { component = ((mca_base_component_priority_list_item_t *) item)->super.cli_component; /* If we have a list of names, scan through it */ if (0 == num_names) { want_to_check = true; } else { want_to_check = false; for (i = 0; i < num_names; ++i) { if (0 == strcmp(names[i], component->mca_component_name)) { want_to_check = true; } } } /* If we determined that we want to check this component, then do so */ if (want_to_check) { avail = check_one_component(component, filename, info); if (NULL != avail) { /* Put this item on the list in priority order (highest priority first). Should it go first? */ /* MSC actually put it Lowest priority first */ for(item2 = opal_list_get_first(selectable); item2 != opal_list_get_end(selectable); item2 = opal_list_get_next(item2)) { avail2 = (avail_io_t*)item2; if(avail->ai_priority < avail2->ai_priority) { opal_list_insert_pos(selectable, item2, (opal_list_item_t*)avail); break; } } if(opal_list_get_end(selectable) == item2) { opal_list_append(selectable, (opal_list_item_t*)avail); } /* item2 = opal_list_get_first(selectable); avail2 = (avail_io_t *) item2; if (opal_list_get_end(selectable) == item2 || avail->ai_priority > avail2->ai_priority) { opal_list_prepend(selectable, (opal_list_item_t*) avail); } else { for (i = 1; item2 != opal_list_get_end(selectable); item2 = opal_list_get_next(selectable), ++i) { avail2 = (avail_io_t *) item2; if (avail->ai_priority > avail2->ai_priority) { opal_list_insert(selectable, (opal_list_item_t *) avail, i); break; } } */ /* If we didn't find a place to put it in the list, then append it (because it has the lowest priority found so far) */ /* if (opal_list_get_end(selectable) == item2) { opal_list_append(selectable, (opal_list_item_t *) avail); } } */ } } } /* If we didn't find any available components, return an error */ if (0 == opal_list_get_size(selectable)) { OBJ_RELEASE(selectable); return NULL; } /* All done */ return selectable; }