message: Clean allocation for build jobs
diff: @@ -110,6 +110,16 @@ stages:
  before_script:
  - module load gcc/4.9.3
  +.if_srun_alloc_for_make: &if_srun_alloc_for_make |
  + if [[ "${MPIEXEC}" == "srun" ]]
  + then
  + export JOB_ID=$(squeue -h --name=${MFEM_ALLOC_NAME} --format=%A)
  + [[ -n "JOB_ID" ]] && export JOB_ID="--jobid=${JOB_ID}"
  + RESOURCES="--extra-node-info=1:${MAKE_PAR}:1 --cpus-per-task=${MAKE_PAR} --ntasks=1"
  + # Allocation prefix:
  + export EXEC_PREFIX="srun ${JOB_ID} ${RESOURCES}"
  + fi
  +
  # Build of dependencies and mfem:
  # if on quartz, uses a subpart of preallocated resources
  # Note: Those jobs don't rely on MFEM repository, hence the use of
  @@ -123,12 +133,7 @@ stages:
  - cd ${BUILD_ROOT}/tpls
  - mkdir -p ${BUILD_PATH}
  - make clean
  - - |
  - if [[ "${MPIEXEC}" == "srun" ]]
  - then
  - export JOB_ID=$(squeue -h --name=${MFEM_ALLOC_NAME} --format=%A)
  - export EXEC_PREFIX="srun --jobid=${JOB_ID} --extra-node-info=1:${MAKE_PAR}:1 --cpus-per-task=${MAKE_PAR} --ntasks=1"
  - fi
  + - *if_srun_alloc_for_make
  - ${EXEC_PREFIX} make -j ${MAKE_PAR} hypre PREFIX=${BUILD_PATH}/hypre/src/ BUILD_DIR=${BUILD_PATH} LOG_DIR=${BUILD_PATH}
  .build_metis:
  @@ -139,12 +144,7 @@ stages:
  script:
  - cd ${BUILD_ROOT}/tpls
  - mkdir -p ${BUILD_PATH}
  - - |
  - if [[ "${MPIEXEC}" == "srun" ]]
  - then
  - export JOB_ID=$(squeue -h --name=${MFEM_ALLOC_NAME} --format=%A)
  - export EXEC_PREFIX="srun --jobid=${JOB_ID} --extra-node-info=1:${MAKE_PAR}:1 --cpus-per-task=${MAKE_PAR} --ntasks=1"
  - fi
  + - *if_srun_alloc_for_make
  - ${EXEC_PREFIX} make -j ${MAKE_PAR} ${METIS} PREFIX=${BUILD_PATH}/ BUILD_DIR=${BUILD_PATH} LOG_DIR=${BUILD_PATH} CC=${CC} CXX=${CXX}
  # Building MFEM
  @@ -157,13 +157,7 @@ stages:
  - cd ..
  - cp -r mfem ${BUILD_PATH}/mfem_${MFEM_USE_MPI}_${MFEM_DEBUG}
  - cd ${BUILD_PATH}/mfem_${MFEM_USE_MPI}_${MFEM_DEBUG}
  - - echo "${TOOLCHAIN} == $(which c++) ?"
  - - |
  - if [[ "${MPIEXEC}" == "srun" ]]
  - then
  - export JOB_ID=$(squeue -h --name=${MFEM_ALLOC_NAME} --format=%A)
  - export EXEC_PREFIX="srun --jobid=${JOB_ID} --extra-node-info=1:${MAKE_PAR}:1 --cpus-per-task=${MAKE_PAR} --ntasks=1"
  - fi
  + - *if_srun_alloc_for_make
  - make config CXX=${CXX} MPICXX=mpicxx MFEM_USE_MPI=${MFEM_USE_MPI} MFEM_DEBUG=${MFEM_DEBUG} MFEM_MPIEXEC="${EXEC_PREFIX}" MFEM_MPIEXEC_NP=${MPIEXEC_NP}
  - ${EXEC_PREFIX} make -j ${MAKE_PAR} all
  