Skip to content

CI: run POT3D validation with MPI rank 4 as well #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 38 additions & 27 deletions tests/pot3d/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,47 @@ MPIEXEC=${CONDA_PREFIX}/bin/mpiexec
cp ${POT3D_HOME}/testsuite/${TEST}/input/* ${POT3D_HOME}/testsuite/${TEST}/run/
cd ${POT3D_HOME}/testsuite/${TEST}/run

echo "Running POT3D with 1 MPI rank..."
${MPIEXEC} -np 1 ${POT3D_HOME}/bin/pot3d 1> pot3d.log 2>pot3d.err
echo "Done!"

runtime=($(tail -n 5 timing.out | head -n 1))
echo "Wall clock time: ${runtime[6]} seconds"
echo " "

#Validate run:
${POT3D_HOME}/scripts/pot3d_validation.sh pot3d.out ${POT3D_HOME}/testsuite/${TEST}/validation/pot3d.out
if [ $? -ne 0 ]; then
echo "Validation failed for 1 MPI rank. Exiting..."
# detect MPI implementation
MPI_VERSION=$($MPIEXEC --version 2>&1)
if echo "$MPI_VERSION" | grep -q "Open MPI"; then
MPI_TYPE="openmpi"
elif echo "$MPI_VERSION" | grep -q "MPICH"; then
MPI_TYPE="mpich"
else
# we don't yet support other MPI implementations
# like intel MPI etc.0
echo -e "${RED}Unknown MPI implementation!${NC}"
exit 1
fi

rm pot3d.log pot3d.out timing.out
echo " "
echo "Running POT3D with 2 MPI ranks..."
${MPIEXEC} -np 2 ${POT3D_HOME}/bin/pot3d 1> pot3d.log 2>pot3d.err
echo "Done!"
for np in 1 2 4; do
rm -rf pot3d.log pot3d.out timing.out

runtime=($(tail -n 5 timing.out | head -n 1))
echo "Wall clock time: ${runtime[6]} seconds"
echo " "
# set MPIEXEC_ARGS based on MPI type and number of ranks
# `--oversubscribe` isn't needed with Open MPI when running
# with 1 or 2 ranks
if [[ "$MPI_TYPE" == "openmpi" && $np -gt 2 ]]; then
MPIEXEC_ARGS="--oversubscribe"
else
MPIEXEC_ARGS=""
fi

#Validate run:
${POT3D_HOME}/scripts/pot3d_validation.sh pot3d.out ${POT3D_HOME}/testsuite/${TEST}/validation/pot3d.out
if [ $? -ne 0 ]; then
echo "Validation failed for 2 MPI rank. Exiting..."
exit 1
fi
echo " "
echo "Running POT3D with $np MPI rank..."

${MPIEXEC} -np ${np} ${MPIEXEC_ARGS} ${POT3D_HOME}/bin/pot3d 1> pot3d.log 2>pot3d.err
echo "Done!"

runtime=($(tail -n 5 timing.out | head -n 1))
echo "Wall clock time: ${runtime[6]} seconds"
echo " "

#Validate run:
${POT3D_HOME}/scripts/pot3d_validation.sh pot3d.out ${POT3D_HOME}/testsuite/${TEST}/validation/pot3d.out
if [ $? -ne 0 ]; then
echo "Validation failed for $np MPI rank. Exiting..."
exit 1
fi
echo ""
done

echo "Done!"