Skip to content

Commit 353153e

Browse files
authored
Merge pull request #10289 from ggouaillardet/topic/no_pmix_but
runtime: warn before using singleton mode
2 parents 967e567 + a061961 commit 353153e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

ompi/runtime/help-mpi-runtime.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,7 @@ PMIx_Init failed for the following reason:
118118
Open MPI requires access to a local PMIx server to execute. Please ensure
119119
that either you are operating in a PMIx-enabled environment, or use "mpirun"
120120
to execute the job.
121+
#
122+
[no-pmix-but]
123+
No PMIx server was reachable, but a PMI1/2 or SLURM environment was detected.
124+
Open MPI will start %d singletons

ompi/runtime/ompi_rte.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,23 @@ int ompi_rte_init(int *pargc, char ***pargv)
569569
/* if we get PMIX_ERR_UNREACH indicating that we cannot reach the
570570
* server, then we assume we are operating as a singleton */
571571
if (PMIX_ERR_UNREACH == ret) {
572+
/* if we are in a PMI or SLURM environment with two tasks or more,
573+
* we probably do not want to start singletons */
574+
char *size_str = getenv("PMI_SIZE");
575+
if (NULL == size_str) {
576+
size_str = getenv("SLURM_NPROCS");
577+
}
578+
int size = (NULL != size_str)?atoi(size_str):1;
579+
if (1 < size) {
580+
char *rank_str = getenv("PMI_RANK");
581+
if (NULL == rank_str) {
582+
rank_str = getenv("SLURM_PROCID");
583+
}
584+
int rank = (NULL != rank_str)?atoi(rank_str):0;
585+
if (0 == rank) {
586+
opal_show_help("help-mpi-runtime.txt", "no-pmix-but", false, size);
587+
}
588+
}
572589
ompi_singleton = true;
573590
} else {
574591
/* we cannot run - this could be due to being direct launched

0 commit comments

Comments
 (0)