Skip to content

Commit

Permalink
Support CHECK/PROLOG/EPILOG, removed WAIT.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp committed Sep 24, 2024
1 parent 4a618d0 commit 101c802
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions config/cp2k/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ fi

if [ -e "${ROOT}/mynodes.sh" ]; then
HOSTS=$("${ROOT}/mynodes.sh" 2>/dev/null | tr -s '\n ' ',' | sed 's/^\(..*[^,]\),*$/\1/')
elif [ "${SLURM_NODELIST}" ] && command -v scontrol >/dev/null; then
HOSTS=$(scontrol show hostnames 2>/dev/null | tr -s '\n ' ',' | sed 's/^\(..*[^,]\),*$/\1/')
else
HOSTS=${HOSTS:-localhost}
fi
Expand Down Expand Up @@ -226,8 +228,25 @@ echo
echo "${RUN}" | xargs
echo

# finally evaluate/run
if [ "${WAIT}" ] && [ "0" != "$((0<WAIT))" ] && command -v sleep >/dev/null; then
sleep "${WAIT}"
# prolog
PROLOG=${PROLOG:-${CHECK}}
if [ "${PROLOG}" ] && [ "0" != "${PROLOG}" ] && [ "${HOSTS}" ]; then
echo "*** PROLOG ***"
if command -v clinfo >/dev/null; then
mpirun -host "${HOSTS}" -np ${NUMNODES} clinfo -l
fi
echo "**************"
fi

# evaluate/run job
eval "${RUN}"

# epilog
EPILOG=${EPILOG:-${CHECK}}
if [ "${EPILOG}" ] && [ "0" != "${EPILOG}" ] && [ "${HOSTS}" ]; then
echo "*** EPILOG ***"
if command -v clinfo >/dev/null; then
mpirun -host "${HOSTS}" -np ${NUMNODES} clinfo -l
fi
echo "**************"
fi

0 comments on commit 101c802

Please sign in to comment.