From a25cc3e0807d76c9acaa1840d4c7e53408523cfd Mon Sep 17 00:00:00 2001 From: Michael <m.langguth@fz-juelich.de> Date: Wed, 19 May 2021 08:30:20 +0200 Subject: [PATCH] Changes to create_env.sh: Only check modules when creating new virtual environment, load postprocessing modules and stick to them when building/actiating virtual env. --- .../env_setup/create_env.sh | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/video_prediction_tools/env_setup/create_env.sh b/video_prediction_tools/env_setup/create_env.sh index 1a5ce054..c78a1894 100755 --- a/video_prediction_tools/env_setup/create_env.sh +++ b/video_prediction_tools/env_setup/create_env.sh @@ -63,27 +63,27 @@ else ENV_EXIST=0 fi -# add personal email-address to Batch-scripts -if [[ "${HOST_NAME}" == hdfml* || "${HOST_NAME}" == *juwels* ]]; then - if [[ "${HOST_NAME}" == jwlogin2[1-4]* ]]; then - # on Juwels Booster, we are in a container environment -> loading modules is not possible - echo "***** Note for Juwels Booster! *****" - echo "Already checked the required modules?" - echo "To do so, run 'source modules_train.sh' after exiting the singularity." - echo "***** Note for Juwels Booster! *****" - else - # load modules and check for their availability - echo "***** Checking modules required during the workflow... *****" - source ${ENV_SETUP_DIR}/modules_preprocess.sh purge - source ${ENV_SETUP_DIR}/modules_train.sh purge - source ${ENV_SETUP_DIR}/modules_postprocess.sh - fi -else - # unset PYTHONPATH on every other machine that is not a known HPC-system - unset PYTHONPATH -fi - +# Create fresh virtual environment or just activate the existing one if [[ "$ENV_EXIST" == 0 ]]; then + # Check modules first + if [[ "${HOST_NAME}" == hdfml* || "${HOST_NAME}" == *juwels* ]]; then + if [[ "${HOST_NAME}" == jwlogin2[1-4]* ]]; then + # on Juwels Booster, we are in a container environment -> loading modules is not possible + echo "***** Note for Juwels Booster! *****" + echo "Already checked the required modules?" + echo "To do so, run 'source modules_train.sh' after exiting the singularity." + echo "***** Note for Juwels Booster! *****" + else + # load modules and check for their availability + echo "***** Checking modules required during the workflow... *****" + source ${ENV_SETUP_DIR}/modules_preprocess.sh purge + source ${ENV_SETUP_DIR}/modules_train.sh purge + source ${ENV_SETUP_DIR}/modules_postprocess.sh + fi + else + # unset PYTHONPATH on every other machine that is not a known HPC-system + unset PYTHONPATH + fi # Activate virtual environment and install additional Python packages. echo "Configuring and activating virtual environment on ${HOST_NAME}" @@ -143,7 +143,8 @@ if [[ "$ENV_EXIST" == 0 ]]; then fi info_str="Virtual environment ${ENV_DIR} has been set up successfully." elif [[ "$ENV_EXIST" == 1 ]]; then - # activating virtual env is suifficient + # loading modules of postprocessing and activating virtual env are suifficient + source ${ENV_SETUP_DIR}/modules_postprocess.sh source ${ENV_DIR}/bin/activate info_str="Virtual environment ${ENV_DIR} has been activated successfully." fi @@ -158,6 +159,6 @@ echo "Make use of config_runscript.py to generate customized runscripts of the w echo "******************************************** NOTE ********************************************" # finally clean up loaded modules (if we are not on Juwels) -if [[ "${HOST_NAME}" == *hdfml* || "${HOST_NAME}" == *juwels* ]] && [[ "${HOST_NAME}" != jwlogin2[1-4]* ]]; then - module --force purge -fi +#if [[ "${HOST_NAME}" == *hdfml* || "${HOST_NAME}" == *juwels* ]] && [[ "${HOST_NAME}" != jwlogin2[1-4]* ]]; then +# module --force purge +#fi -- GitLab