Skip to content

Commit 1cf8f1b

Browse files
Allowing PSM2 to get its TransportKey from PMIx
Author: Ralph Castain <[email protected]> Signed-off-by: Marisa Roman <[email protected]>
1 parent b0c8c7f commit 1cf8f1b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

ompi/mca/mtl/psm2/mtl_psm2.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* reserved.
1717
* Copyright (c) 2016 Research Organization for Information Science
1818
* and Technology (RIST). All rights reserved.
19+
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
20+
*
1921
* $COPYRIGHT$
2022
*
2123
* Additional copyrights may follow
@@ -101,7 +103,20 @@ int ompi_mtl_psm2_module_init(int local_rank, int num_local_procs) {
101103
char env_string[256];
102104
int rc;
103105

104-
generated_key = getenv("OMPI_MCA_orte_precondition_transports");
106+
opal_process_name_t pname;
107+
108+
generated_key = NULL;
109+
pname.jobid = opal_process_info.my_name.jobid;
110+
pname.vpid = OPAL_VPID_WILDCARD;
111+
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_CREDENTIAL, &pname,
112+
(char**)&generated_key, PMIX_STRING);
113+
114+
char *tmp_key;
115+
if (PMIX_SUCCESS != rc || NULL == generated_key) {
116+
if (NULL != (tmp_key = getenv("OMPI_MCA_orte_precondition_transports"))) {
117+
generated_key = strdup(tmp_key);
118+
}
119+
}
105120
memset(uu, 0, sizeof(psm2_uuid_t));
106121

107122
if (!generated_key || (strlen(generated_key) != 33) ||
@@ -111,10 +126,13 @@ int ompi_mtl_psm2_module_init(int local_rank, int num_local_procs) {
111126
"no uuid present", true,
112127
generated_key ? "could not be parsed from" :
113128
"not present in", ompi_process_info.nodename);
129+
free(generated_key);
114130
return OMPI_ERROR;
115131

116132
}
117133

134+
free(generated_key);
135+
118136
/* Handle our own errors for opening endpoints */
119137
psm2_error_register_handler(ompi_mtl_psm2.ep, ompi_mtl_psm2_errhandler);
120138

0 commit comments

Comments
 (0)