From 290c4b6b55b1ae9d3f9cf7866415de862f9435be Mon Sep 17 00:00:00 2001 From: Nesterov Alexander Date: Fri, 20 Jun 2025 16:04:40 +0200 Subject: [PATCH] Fix MPI environment variable list size --- modules/core/util/src/util.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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"};