Add MPICH HPC environment detection
Default MPICH builds use the Hydra process manager (mpiexec) which sets PMI_RANK in the application environment. Update GetUniquePathFromEnv() test accordingly. Signed-off-by: Ken Raffenetti <raffenet@mcs.anl.gov>
This commit is contained in:
parent
1d2654f3a0
commit
c41eb9e8b5
|
@ -249,6 +249,12 @@ static std::tuple<bool, const char*, const char*> QueryHPCEnvironment() {
|
||||||
return {true, "", ""};
|
return {true, "", ""};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for Hydra process manager (MPICH)
|
||||||
|
envval = getenv("PMI_RANK");
|
||||||
|
if (envval != nullptr && *envval != 0) {
|
||||||
|
return {false, ".rank-", envval};
|
||||||
|
}
|
||||||
|
|
||||||
// No HPC environment was detected
|
// No HPC environment was detected
|
||||||
return {false, "", ""};
|
return {false, "", ""};
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,11 +181,38 @@ void testOMPI() {
|
||||||
EXPECT_EQ(expectedPath, GetTestPath());
|
EXPECT_EQ(expectedPath, GetTestPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MPICH is another type of MPI environment that we detect. We
|
||||||
|
// expect .rank-${PMI_RANK} to be appended when we detect this
|
||||||
|
// environment.
|
||||||
|
void testMPICH() {
|
||||||
|
WithEnv rank("PMI_RANK", "5");
|
||||||
|
WithEnv withTestVar(TEST_VAR, TEST_VAL);
|
||||||
|
|
||||||
|
const auto expectedParent = TEST_VAL ".rank-5";
|
||||||
|
const auto expectedChild = AppendPID(expectedParent);
|
||||||
|
|
||||||
|
// Test parent case (will set the child flag)
|
||||||
|
EXPECT_EQ(expectedParent, GetTestPath());
|
||||||
|
|
||||||
|
// Test child case
|
||||||
|
EXPECT_EQ(expectedChild, GetTestPath());
|
||||||
|
|
||||||
|
withTestVar.Reset();
|
||||||
|
WithEnv withForced(TEST_VAR "_USE_PID", "1");
|
||||||
|
|
||||||
|
// Test parent case (will set the child flag)
|
||||||
|
EXPECT_EQ(expectedChild, GetTestPath());
|
||||||
|
|
||||||
|
// Test child case
|
||||||
|
EXPECT_EQ(expectedChild, GetTestPath());
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
testDefault();
|
testDefault();
|
||||||
testPMIx();
|
testPMIx();
|
||||||
testSlurm();
|
testSlurm();
|
||||||
testOMPI();
|
testOMPI();
|
||||||
|
testMPICH();
|
||||||
|
|
||||||
printf("PASS\n");
|
printf("PASS\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue