Skip to content

Commit 69200e6

Browse files
committed
plm/alps: fix usage of cray wlm_detect methods
Turns out there are some cases where the Cray wlm_detect_get_active may return NULL, in which case fallback to wlm_detect_get_default method is suggested. Make use of the fallback to avoid segfaults under some circumstances in the ALPS plm selection method. Signed-off-by: Howard Pritchard <[email protected]>
1 parent 8ff1d09 commit 69200e6

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

orte/mca/plm/alps/plm_alps_component.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,25 @@ static int orte_plm_alps_component_query(mca_base_module_t **module, int *priori
139139
{
140140
#if CRAY_WLM_DETECT
141141
char slurm[]="SLURM";
142+
char *wlm_detected = NULL;
142143

143-
if(!strcmp(slurm,wlm_detect_get_active())) {
144+
wlm_detected = wlm_detect_get_active();
145+
146+
/*
147+
* The content of wlm_detected.h indicates wlm_detect_get_active
148+
* may return NULL upon failure. Resort to the suggested plan
149+
* B in that event.
150+
*/
151+
152+
if (NULL == wlm_detected) {
153+
wlm_detected = (char *)wlm_detect_get_default();
154+
OPAL_OUTPUT_VERBOSE((10, orte_plm_base_framework.framework_output,
155+
"%s plm:alps: wlm_detect_get_active returned NULL, using %s",
156+
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), wlm_detected));
157+
158+
}
159+
160+
if((NULL != wlm_detected) && !strcmp(slurm, wlm_detected)) {
144161
mca_plm_alps_using_aprun = false;
145162
}
146163
#endif

0 commit comments

Comments
 (0)