Skip to content

Commit 90e6014

Browse files
authored
Fix MPI environment variable list size (#455)
## Summary - fix MPI environment variable list size in util.cpp - document the array and ensure no empty entries ## Testing - `pytest -q` *(no tests found)* ------ https://chatgpt.com/codex/tasks/task_e_68555dc14d648333b32dad97a979606a
1 parent f6a8c83 commit 90e6014

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

modules/core/util/src/util.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ int ppc::util::GetNumThreads() {
2828
return 1;
2929
}
3030

31-
constexpr std::array<std::string_view, 13> kMpiEnvVars = {
31+
// List of environment variables that signal the application is running under
32+
// an MPI launcher. The array size must match the number of entries to avoid
33+
// looking up empty environment variable names.
34+
constexpr std::array<std::string_view, 10> kMpiEnvVars = {
3235
"OMPI_COMM_WORLD_SIZE", "OMPI_UNIVERSE_SIZE", "PMI_SIZE", "PMI_RANK", "PMI_FD",
3336
"HYDRA_CONTROL_FD", "PMIX_RANK", "SLURM_PROCID", "MSMPI_RANK", "MSMPI_LOCALRANK"};
3437

0 commit comments

Comments
 (0)