Skip to content

coll/han: set as default except if processes are consecutive across nodes #10963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ompi/mca/coll/han/coll_han.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ typedef struct mca_coll_han_component_t {

/** MCA parameter: Priority of this component */
int han_priority;
/** MCA parameter: Priority penalty for sequential process distribution */
int han_priority_penalty;
/* whether output the log message */
int han_output;
int han_output_verbose; /* activation level of coll han verbosity */
Expand Down
10 changes: 9 additions & 1 deletion ompi/mca/coll/han/coll_han_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static int han_register(void)
TOPO_LVL_T topo_lvl;
COMPONENT_T component;

cs->han_priority = 0;
cs->han_priority = 35;
(void) mca_base_component_var_register(c, "priority", "Priority of the HAN coll component",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
Expand All @@ -261,6 +261,14 @@ static int han_register(void)
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY, &cs->han_output_verbose);

cs->han_priority_penalty = 10;
(void) mca_base_component_var_register(c, "priority_penalty",
"Priority reduction of the HAN component "
"for linear process distributions",
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
OPAL_INFO_LVL_9,
MCA_BASE_VAR_SCOPE_READONLY, &cs->han_priority_penalty);

cs->han_bcast_segsize = 65536;
(void) mca_base_component_var_register(c, "bcast_segsize",
"segment size for bcast",
Expand Down
43 changes: 43 additions & 0 deletions ompi/mca/coll/han/coll_han_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,45 @@ int mca_coll_han_init_query(bool enable_progress_threads,
return OMPI_SUCCESS;
}

/**
* check whether all ranks on our node are consecutive
* and exchange that information with our peers
*/
static bool proc_ranks_consecutive(struct ompi_communicator_t * comm)
{
int last_rank = -1;
int num_jumps = 0;
for (int i = 0 ; i < comm->c_local_group->grp_proc_count ; ++i) {
ompi_proc_t *proc = NULL;
proc = ompi_group_get_proc_ptr_raw (comm->c_local_group, i);
if (ompi_proc_is_sentinel (proc)) {
/* non-local proc */
continue;
}
if (!OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags)) {
/* non-local proc */
continue;
}
if ((last_rank + 1) != i) {
num_jumps++;
}
last_rank = i;
}

/* the module is not used in the recursive-doubling implementation */
ompi_coll_base_allreduce_intra_recursivedoubling(MPI_IN_PLACE,
&num_jumps, 1, MPI_INT,
MPI_MAX, comm,
NULL /* module */);

/* if there is more than one jump in the rank sequence the ranks are not consecutive
* one jump in ranks may stem from the first rank on the node (on all but the first node) */
if (num_jumps > 1) {
return false;
}

return true;
}

/*
* Invoked when there's a new communicator that has been created.
Expand Down Expand Up @@ -203,6 +242,10 @@ mca_coll_han_comm_query(struct ompi_communicator_t * comm, int *priority)
/* Get the priority level attached to this module. If priority is less
* than or equal to 0, then the module is unavailable. */
*priority = mca_coll_han_component.han_priority;
/* reduce priority if the rank distribution is linear across nodes */
if (proc_ranks_consecutive(comm)) {
*priority -= mca_coll_han_component.han_priority_penalty;
}
if (mca_coll_han_component.han_priority < 0) {
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
"coll:han:comm_query (%s/%s): priority too low; disqualifying myself",
Expand Down