Skip to content

Commit 181e883

Browse files
committed
mca/pml: Ensure MTL initializes before BTL
Move cm before ob1 during pml selection to ensure MTL initialization occurs before BTL initialization. This addresses non-deterministic component ordering caused by filesystem discovery that could result in ob1 listed before cm. This allows BTL to reuse MTL's fabric and domain. Signed-off-by: Jessie Yang <[email protected]>
1 parent fe33997 commit 181e883

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

ompi/mca/pml/base/pml_base_select.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,27 @@ int mca_pml_base_select(bool enable_progress_threads,
7272
{
7373
int i, priority = 0, best_priority = -1, ret = 0;
7474
opal_list_item_t *item = NULL;
75-
mca_base_component_list_item_t *cli = NULL;
75+
mca_base_component_list_item_t *cli = NULL, *cm_cli = NULL, *ob1_cli = NULL;
7676
mca_pml_base_component_t *component = NULL, *best_component = NULL;
7777
mca_pml_base_module_t *module = NULL, *best_module = NULL;
7878
opal_list_t opened;
7979
opened_component_t *om = NULL;
8080
bool found_pml;
8181

82+
/* Move cm before ob1 so MTL initializes before BTL */
83+
OPAL_LIST_FOREACH(cli, &ompi_pml_base_framework.framework_components, mca_base_component_list_item_t) {
84+
mca_pml_base_component_t *comp = (mca_pml_base_component_t *) cli->cli_component;
85+
if (0 == strcmp(comp->pmlm_version.mca_component_name, "cm")) {
86+
cm_cli = cli;
87+
} else if (0 == strcmp(comp->pmlm_version.mca_component_name, "ob1")) {
88+
ob1_cli = cli;
89+
}
90+
}
91+
if (cm_cli && ob1_cli) {
92+
opal_list_remove_item(&ompi_pml_base_framework.framework_components, &cm_cli->super);
93+
opal_list_prepend(&ompi_pml_base_framework.framework_components, &cm_cli->super);
94+
}
95+
8296
/* Traverse the list of available components; call their init
8397
functions. */
8498

0 commit comments

Comments
 (0)