From 4e8db09c7bcb6569e1f5ecfc8c019040081e7a67 Mon Sep 17 00:00:00 2001 From: Felix Kleinert <f.kleinert@fz-juelich.de> Date: Tue, 7 Apr 2020 16:54:47 +0200 Subject: [PATCH] add script that creates batch scripts --- create_runscripts_HPC.sh | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 create_runscripts_HPC.sh diff --git a/create_runscripts_HPC.sh b/create_runscripts_HPC.sh new file mode 100755 index 00000000..21a60bc0 --- /dev/null +++ b/create_runscripts_HPC.sh @@ -0,0 +1,74 @@ +#!/bin/csh -x + +echo "############################################################" +echo "# #" +echo "# user interaction required #" +echo "# #" +echo "############################################################" + +echo "This script creates the HPC batch scripts to run mlt on compute nodes (gpus and develgpus)." +echo "You can modify the created run scripts afterwards if needed." + + +budget='' +while [[ $budget == '' ]] +do + read -p "Enter project budget for --account flag: " budget +done + +email=`jutil user show -o json | grep email | cut -f2 -d':' | cut -f1 -d',' | cut -f2 -d'"'` +read -p "Enter e-mail address for --mail-user (default: ${email}): " new_email + +if [[ -z "$new_email" ]]; then + new_email=$email +fi + +cat <<EOT > run_develgpus.bash +#!/bin/bash -x +#SBATCH --account=${budget} +#SBATCH --nodes=1 +#SBATCH --output=mlt-out.%j +#SBATCH --error=mlt-err.%j +#SBATCH --time=02:00:00 +#SBATCH --partition=develgpus +#SBATCH --gres=gpu:2 +#SBATCH --mail-type=ALL +#SBATCH --mail-user=${email} + +source mlt_modules.sh +source venv/bin/activate + +export PYTHONPATH=\${PWD}/venv/lib/python3.6/site-packages:\${PYTHONPATH} + +srun python run.py +EOT + +echo "Created runscript: run_develgpus.bash" + +cat <<EOT > run_gpus.bash +#!/bin/bash -x +#SBATCH --account=${budget} +#SBATCH --nodes=1 +#SBATCH --output=mlt-out.%j +#SBATCH --error=mlt-err.%j +#SBATCH --time=16:00:00 +#SBATCH --partition=gpus +#SBATCH --gres=gpu:4 +#SBATCH --mail-type=ALL +#SBATCH --mail-user=${email} + +source mlt_modules.sh +source venv/bin/activate + +export PYTHONPATH=\${PWD}/venv/lib/python3.6/site-packages:\${PYTHONPATH} + +srun python run.py +EOT + +echo "Created runscript: run_gpus.bash" + +echo "You have to run the the following command on a login node to download data:" +echo " \`python run.py'" +echo "Please execute the following command to check if the setup went well:" +echo " \`sbatch run_develgpus.bash'" + -- GitLab