diff --git a/modules/core/util/src/util.cpp b/modules/core/util/src/util.cpp index ea76a08be..9d4c01a3d 100644 --- a/modules/core/util/src/util.cpp +++ b/modules/core/util/src/util.cpp @@ -28,7 +28,10 @@ int ppc::util::GetNumThreads() { return 1; } -constexpr std::array kMpiEnvVars = { +// List of environment variables that signal the application is running under +// an MPI launcher. The array size must match the number of entries to avoid +// looking up empty environment variable names. +constexpr std::array kMpiEnvVars = { "OMPI_COMM_WORLD_SIZE", "OMPI_UNIVERSE_SIZE", "PMI_SIZE", "PMI_RANK", "PMI_FD", "HYDRA_CONTROL_FD", "PMIX_RANK", "SLURM_PROCID", "MSMPI_RANK", "MSMPI_LOCALRANK"};