Fix bug in spacing of code per https://svn.open-mpi.org/trac/ompi/wiki/CodingStyle.
This commit was SVN r18463.
Этот коммит содержится в:
родитель
d45cb82ecc
Коммит
71091a19c3
@ -105,117 +105,117 @@ int mca_coll_base_comm_select(ompi_communicator_t *comm)
|
|||||||
opal_list_t *selectable;
|
opal_list_t *selectable;
|
||||||
opal_list_item_t *item;
|
opal_list_item_t *item;
|
||||||
|
|
||||||
/* Announce */
|
/* Announce */
|
||||||
snprintf(name, sizeof(name), "%s (cid %d)", comm->c_name,
|
snprintf(name, sizeof(name), "%s (cid %d)", comm->c_name,
|
||||||
comm->c_contextid);
|
comm->c_contextid);
|
||||||
name[sizeof(name) - 1] = '\0';
|
name[sizeof(name) - 1] = '\0';
|
||||||
orte_output_verbose(10, mca_coll_base_output,
|
|
||||||
"coll:base:comm_select: new communicator: %s",
|
|
||||||
name);
|
|
||||||
|
|
||||||
/* Initialize all the relevant pointers, since they're used as
|
|
||||||
sentinel values */
|
|
||||||
memset(&comm->c_coll, 0, sizeof(mca_coll_base_comm_coll_t));
|
|
||||||
|
|
||||||
/* See if a set of component was requested by the MCA parameter.
|
|
||||||
Don't check for error. */
|
|
||||||
names = NULL;
|
|
||||||
mca_base_param_lookup_string(mca_coll_base_param, &names);
|
|
||||||
|
|
||||||
if (NULL != names && 0 < strlen(names)) {
|
|
||||||
/* mca param based */
|
|
||||||
name_array = opal_argv_split(names, ',');
|
|
||||||
num_names = opal_argv_count(name_array);
|
|
||||||
|
|
||||||
orte_output_verbose(10, mca_coll_base_output,
|
orte_output_verbose(10, mca_coll_base_output,
|
||||||
"coll:base:comm_select: Checking specific modules: %s",
|
"coll:base:comm_select: new communicator: %s",
|
||||||
names);
|
name);
|
||||||
selectable = check_components(&mca_coll_base_components_available,
|
|
||||||
comm, name_array, num_names);
|
|
||||||
opal_argv_free(name_array);
|
|
||||||
} else {
|
|
||||||
/* no specific components given -- try all */
|
|
||||||
orte_output_verbose(10, mca_coll_base_output,
|
|
||||||
"coll:base:comm_select: Checking all available modules");
|
|
||||||
selectable = check_components(&mca_coll_base_components_available,
|
|
||||||
comm, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Upon return from the above, the modules list will contain the
|
/* Initialize all the relevant pointers, since they're used as
|
||||||
list of modules that returned (priority >= 0). If we have no
|
sentinel values */
|
||||||
collective modules available, then print error and return. */
|
memset(&comm->c_coll, 0, sizeof(mca_coll_base_comm_coll_t));
|
||||||
if (NULL == selectable) {
|
|
||||||
/* There's no modules available */
|
|
||||||
orte_show_help("help-mca-coll-base",
|
|
||||||
"comm-select:none-available", true);
|
|
||||||
return OMPI_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIX ME - Do some kind of collective operation to find a module
|
/* See if a set of component was requested by the MCA parameter.
|
||||||
that everyone has available */
|
Don't check for error. */
|
||||||
|
names = NULL;
|
||||||
|
mca_base_param_lookup_string(mca_coll_base_param, &names);
|
||||||
|
|
||||||
/* do the selection loop */
|
if (NULL != names && 0 < strlen(names)) {
|
||||||
for (item = opal_list_remove_first(selectable);
|
/* mca param based */
|
||||||
NULL != item;
|
name_array = opal_argv_split(names, ',');
|
||||||
item = opal_list_remove_first(selectable))
|
num_names = opal_argv_count(name_array);
|
||||||
{
|
|
||||||
avail_coll_t *avail = (avail_coll_t*) item;
|
|
||||||
|
|
||||||
/* initialize the module */
|
orte_output_verbose(10, mca_coll_base_output,
|
||||||
ret = avail->ac_module->coll_module_enable(avail->ac_module, comm);
|
"coll:base:comm_select: Checking specific modules: %s",
|
||||||
if (OMPI_SUCCESS != ret) {
|
names);
|
||||||
mca_coll_base_comm_unselect(comm);
|
selectable = check_components(&mca_coll_base_components_available,
|
||||||
continue;
|
comm, name_array, num_names);
|
||||||
}
|
opal_argv_free(name_array);
|
||||||
|
} else {
|
||||||
|
/* no specific components given -- try all */
|
||||||
|
orte_output_verbose(10, mca_coll_base_output,
|
||||||
|
"coll:base:comm_select: Checking all available modules");
|
||||||
|
selectable = check_components(&mca_coll_base_components_available,
|
||||||
|
comm, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* copy over any of the pointers */
|
/* Upon return from the above, the modules list will contain the
|
||||||
COPY(avail->ac_module, comm, allgather);
|
list of modules that returned (priority >= 0). If we have no
|
||||||
COPY(avail->ac_module, comm, allgatherv);
|
collective modules available, then print error and return. */
|
||||||
COPY(avail->ac_module, comm, allreduce);
|
if (NULL == selectable) {
|
||||||
COPY(avail->ac_module, comm, alltoall);
|
/* There's no modules available */
|
||||||
COPY(avail->ac_module, comm, alltoallv);
|
orte_show_help("help-mca-coll-base",
|
||||||
COPY(avail->ac_module, comm, alltoallw);
|
"comm-select:none-available", true);
|
||||||
COPY(avail->ac_module, comm, barrier);
|
return OMPI_ERROR;
|
||||||
COPY(avail->ac_module, comm, bcast);
|
}
|
||||||
COPY(avail->ac_module, comm, exscan);
|
|
||||||
COPY(avail->ac_module, comm, gather);
|
|
||||||
COPY(avail->ac_module, comm, gatherv);
|
|
||||||
COPY(avail->ac_module, comm, reduce);
|
|
||||||
COPY(avail->ac_module, comm, reduce_scatter);
|
|
||||||
COPY(avail->ac_module, comm, scan);
|
|
||||||
COPY(avail->ac_module, comm, scatter);
|
|
||||||
COPY(avail->ac_module, comm, scatterv);
|
|
||||||
|
|
||||||
/* release the original module reference and the list item */
|
/* FIX ME - Do some kind of collective operation to find a module
|
||||||
OBJ_RELEASE(avail->ac_module);
|
that everyone has available */
|
||||||
OBJ_RELEASE(avail);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Done with the list from the check_components() call so release it. */
|
/* do the selection loop */
|
||||||
OBJ_RELEASE(selectable);
|
for (item = opal_list_remove_first(selectable);
|
||||||
|
NULL != item;
|
||||||
|
item = opal_list_remove_first(selectable)) {
|
||||||
|
|
||||||
/* check to make sure no NULLs */
|
avail_coll_t *avail = (avail_coll_t*) item;
|
||||||
if ((NULL == comm->c_coll.coll_allgather) ||
|
|
||||||
(NULL == comm->c_coll.coll_allgatherv) ||
|
|
||||||
(NULL == comm->c_coll.coll_allreduce) ||
|
|
||||||
(NULL == comm->c_coll.coll_alltoall) ||
|
|
||||||
(NULL == comm->c_coll.coll_alltoallv) ||
|
|
||||||
(NULL == comm->c_coll.coll_alltoallw) ||
|
|
||||||
(NULL == comm->c_coll.coll_barrier) ||
|
|
||||||
(NULL == comm->c_coll.coll_bcast) ||
|
|
||||||
((OMPI_COMM_IS_INTRA(comm)) && (NULL == comm->c_coll.coll_exscan)) ||
|
|
||||||
(NULL == comm->c_coll.coll_gather) ||
|
|
||||||
(NULL == comm->c_coll.coll_gatherv) ||
|
|
||||||
(NULL == comm->c_coll.coll_reduce) ||
|
|
||||||
(NULL == comm->c_coll.coll_reduce_scatter) ||
|
|
||||||
((OMPI_COMM_IS_INTRA(comm)) && (NULL == comm->c_coll.coll_scan)) ||
|
|
||||||
(NULL == comm->c_coll.coll_scatter) ||
|
|
||||||
(NULL == comm->c_coll.coll_scatterv)) {
|
|
||||||
mca_coll_base_comm_unselect(comm);
|
|
||||||
return OMPI_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OMPI_SUCCESS;
|
/* initialize the module */
|
||||||
|
ret = avail->ac_module->coll_module_enable(avail->ac_module, comm);
|
||||||
|
if (OMPI_SUCCESS != ret) {
|
||||||
|
mca_coll_base_comm_unselect(comm);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy over any of the pointers */
|
||||||
|
COPY(avail->ac_module, comm, allgather);
|
||||||
|
COPY(avail->ac_module, comm, allgatherv);
|
||||||
|
COPY(avail->ac_module, comm, allreduce);
|
||||||
|
COPY(avail->ac_module, comm, alltoall);
|
||||||
|
COPY(avail->ac_module, comm, alltoallv);
|
||||||
|
COPY(avail->ac_module, comm, alltoallw);
|
||||||
|
COPY(avail->ac_module, comm, barrier);
|
||||||
|
COPY(avail->ac_module, comm, bcast);
|
||||||
|
COPY(avail->ac_module, comm, exscan);
|
||||||
|
COPY(avail->ac_module, comm, gather);
|
||||||
|
COPY(avail->ac_module, comm, gatherv);
|
||||||
|
COPY(avail->ac_module, comm, reduce);
|
||||||
|
COPY(avail->ac_module, comm, reduce_scatter);
|
||||||
|
COPY(avail->ac_module, comm, scan);
|
||||||
|
COPY(avail->ac_module, comm, scatter);
|
||||||
|
COPY(avail->ac_module, comm, scatterv);
|
||||||
|
|
||||||
|
/* release the original module reference and the list item */
|
||||||
|
OBJ_RELEASE(avail->ac_module);
|
||||||
|
OBJ_RELEASE(avail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Done with the list from the check_components() call so release it. */
|
||||||
|
OBJ_RELEASE(selectable);
|
||||||
|
|
||||||
|
/* check to make sure no NULLs */
|
||||||
|
if ((NULL == comm->c_coll.coll_allgather) ||
|
||||||
|
(NULL == comm->c_coll.coll_allgatherv) ||
|
||||||
|
(NULL == comm->c_coll.coll_allreduce) ||
|
||||||
|
(NULL == comm->c_coll.coll_alltoall) ||
|
||||||
|
(NULL == comm->c_coll.coll_alltoallv) ||
|
||||||
|
(NULL == comm->c_coll.coll_alltoallw) ||
|
||||||
|
(NULL == comm->c_coll.coll_barrier) ||
|
||||||
|
(NULL == comm->c_coll.coll_bcast) ||
|
||||||
|
((OMPI_COMM_IS_INTRA(comm)) && (NULL == comm->c_coll.coll_exscan)) ||
|
||||||
|
(NULL == comm->c_coll.coll_gather) ||
|
||||||
|
(NULL == comm->c_coll.coll_gatherv) ||
|
||||||
|
(NULL == comm->c_coll.coll_reduce) ||
|
||||||
|
(NULL == comm->c_coll.coll_reduce_scatter) ||
|
||||||
|
((OMPI_COMM_IS_INTRA(comm)) && (NULL == comm->c_coll.coll_scan)) ||
|
||||||
|
(NULL == comm->c_coll.coll_scatter) ||
|
||||||
|
(NULL == comm->c_coll.coll_scatterv)) {
|
||||||
|
mca_coll_base_comm_unselect(comm);
|
||||||
|
return OMPI_ERR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,86 +230,81 @@ static opal_list_t *check_components(opal_list_t *components,
|
|||||||
ompi_communicator_t *comm,
|
ompi_communicator_t *comm,
|
||||||
char **names, int num_names)
|
char **names, int num_names)
|
||||||
{
|
{
|
||||||
int i, priority;
|
int i, priority;
|
||||||
const mca_base_component_t *component;
|
const mca_base_component_t *component;
|
||||||
opal_list_item_t *item, *item2;
|
opal_list_item_t *item, *item2;
|
||||||
mca_coll_base_module_1_1_0_t *module;
|
mca_coll_base_module_1_1_0_t *module;
|
||||||
bool want_to_check;
|
bool want_to_check;
|
||||||
opal_list_t *selectable;
|
opal_list_t *selectable;
|
||||||
avail_coll_t *avail, *avail2;
|
avail_coll_t *avail, *avail2;
|
||||||
|
|
||||||
/* Make a list of the components that query successfully */
|
/* Make a list of the components that query successfully */
|
||||||
|
selectable = OBJ_NEW(opal_list_t);
|
||||||
|
|
||||||
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... */
|
||||||
|
|
||||||
/* Scan through the list of components. This nested loop is O(N^2),
|
for (item = opal_list_get_first(components);
|
||||||
but we should never have too many components and/or names, so this
|
item != opal_list_get_end(components);
|
||||||
*hopefully* shouldn't matter... */
|
item = opal_list_get_next(item)) {
|
||||||
|
component = ((mca_base_component_priority_list_item_t *)
|
||||||
|
item)->super.cli_component;
|
||||||
|
|
||||||
for (item = opal_list_get_first(components);
|
/* If we have a list of names, scan through it */
|
||||||
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;
|
||||||
if (0 == num_names) {
|
} else {
|
||||||
want_to_check = true;
|
want_to_check = false;
|
||||||
} else {
|
for (i = 0; i < num_names; ++i) {
|
||||||
want_to_check = false;
|
if (0 == strcmp(names[i], component->mca_component_name)) {
|
||||||
for (i = 0; i < num_names; ++i) {
|
want_to_check = true;
|
||||||
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) {
|
|
||||||
priority = check_one_component(comm, 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_coll_t);
|
|
||||||
avail->ac_priority = priority;
|
|
||||||
avail->ac_module = module;
|
|
||||||
|
|
||||||
/* Put this item on the list in priority order (lowest
|
|
||||||
priority first). Should it go first? */
|
|
||||||
|
|
||||||
for(item2 = opal_list_get_first(selectable);
|
|
||||||
item2 != opal_list_get_end(selectable);
|
|
||||||
item2 = opal_list_get_next(item2)) {
|
|
||||||
avail2 = (avail_coll_t*)item2;
|
|
||||||
if(avail->ac_priority < avail2->ac_priority) {
|
|
||||||
opal_list_insert_pos(selectable,
|
|
||||||
item2, (opal_list_item_t*)avail);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opal_list_get_end(selectable) == item2) {
|
/* If we determined that we want to check this component, then do
|
||||||
opal_list_append(selectable, (opal_list_item_t*)avail);
|
so */
|
||||||
|
|
||||||
|
if (want_to_check) {
|
||||||
|
priority = check_one_component(comm, 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_coll_t);
|
||||||
|
avail->ac_priority = priority;
|
||||||
|
avail->ac_module = module;
|
||||||
|
|
||||||
|
/* Put this item on the list in priority order (lowest
|
||||||
|
priority first). Should it go first? */
|
||||||
|
for(item2 = opal_list_get_first(selectable);
|
||||||
|
item2 != opal_list_get_end(selectable);
|
||||||
|
item2 = opal_list_get_next(item2)) {
|
||||||
|
avail2 = (avail_coll_t*)item2;
|
||||||
|
if(avail->ac_priority < avail2->ac_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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* If we didn't find any available components, return an error */
|
/* If we didn't find any available components, return an error */
|
||||||
|
if (0 == opal_list_get_size(selectable)) {
|
||||||
|
OBJ_RELEASE(selectable);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (0 == opal_list_get_size(selectable)) {
|
/* All done */
|
||||||
OBJ_RELEASE(selectable);
|
return selectable;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All done */
|
|
||||||
|
|
||||||
return selectable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -320,25 +315,25 @@ static int check_one_component(ompi_communicator_t *comm,
|
|||||||
const mca_base_component_t *component,
|
const mca_base_component_t *component,
|
||||||
mca_coll_base_module_1_1_0_t **module)
|
mca_coll_base_module_1_1_0_t **module)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int priority = -1;
|
int priority = -1;
|
||||||
|
|
||||||
err = query(component, comm, &priority, module);
|
err = query(component, comm, &priority, module);
|
||||||
|
|
||||||
if (OMPI_SUCCESS == err) {
|
if (OMPI_SUCCESS == err) {
|
||||||
priority = (priority < 100) ? priority : 100;
|
priority = (priority < 100) ? priority : 100;
|
||||||
orte_output_verbose(10, mca_coll_base_output,
|
orte_output_verbose(10, mca_coll_base_output,
|
||||||
"coll:base:comm_select: component available: %s, priority: %d",
|
"coll:base:comm_select: component available: %s, priority: %d",
|
||||||
component->mca_component_name, priority);
|
component->mca_component_name, priority);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
priority = -1;
|
priority = -1;
|
||||||
orte_output_verbose(10, mca_coll_base_output,
|
orte_output_verbose(10, mca_coll_base_output,
|
||||||
"coll:base:comm_select: component not available: %s",
|
"coll:base:comm_select: component not available: %s",
|
||||||
component->mca_component_name);
|
component->mca_component_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return priority;
|
return priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -354,21 +349,21 @@ static int query(const mca_base_component_t *component,
|
|||||||
ompi_communicator_t *comm,
|
ompi_communicator_t *comm,
|
||||||
int *priority, mca_coll_base_module_1_1_0_t **module)
|
int *priority, mca_coll_base_module_1_1_0_t **module)
|
||||||
{
|
{
|
||||||
/* coll v1.1.0 */
|
/* coll v1.1.0 */
|
||||||
|
|
||||||
*module = NULL;
|
*module = NULL;
|
||||||
if (1 == component->mca_type_major_version &&
|
if (1 == component->mca_type_major_version &&
|
||||||
1 == component->mca_type_minor_version &&
|
1 == component->mca_type_minor_version &&
|
||||||
0 == component->mca_type_release_version) {
|
0 == component->mca_type_release_version) {
|
||||||
const mca_coll_base_component_1_1_0_t *coll100 =
|
const mca_coll_base_component_1_1_0_t *coll100 =
|
||||||
(mca_coll_base_component_1_1_0_t *) component;
|
(mca_coll_base_component_1_1_0_t *) component;
|
||||||
|
|
||||||
return query_1_1_0(coll100, comm, priority, module);
|
return query_1_1_0(coll100, comm, priority, module);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unknown coll API version -- return error */
|
/* Unknown coll API version -- return error */
|
||||||
|
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -378,13 +373,13 @@ static int query_1_1_0(const mca_coll_base_component_1_1_0_t *component,
|
|||||||
{
|
{
|
||||||
mca_coll_base_module_1_1_0_t *ret;
|
mca_coll_base_module_1_1_0_t *ret;
|
||||||
|
|
||||||
/* There's currently no need for conversion */
|
/* There's currently no need for conversion */
|
||||||
|
|
||||||
ret = component->collm_comm_query(comm, priority);
|
ret = component->collm_comm_query(comm, priority);
|
||||||
if (NULL != ret) {
|
if (NULL != ret) {
|
||||||
*module = ret;
|
*module = ret;
|
||||||
return OMPI_SUCCESS;
|
return OMPI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OMPI_ERROR;
|
return OMPI_ERROR;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user