From 101c802db8f2dfe1620008596a11c026a8400437 Mon Sep 17 00:00:00 2001 From: Hans Pabst Date: Tue, 24 Sep 2024 16:23:20 +0200 Subject: [PATCH] Support CHECK/PROLOG/EPILOG, removed WAIT. --- config/cp2k/run.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/config/cp2k/run.sh b/config/cp2k/run.sh index dac9c0b..ecc7426 100755 --- a/config/cp2k/run.sh +++ b/config/cp2k/run.sh @@ -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 @@ -226,8 +228,25 @@ echo echo "${RUN}" | xargs echo -# finally evaluate/run -if [ "${WAIT}" ] && [ "0" != "$((0/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