Skip to content

Instantly share code, notes, and snippets.

@wkerzendorf
Created February 12, 2020 16:15
Show Gist options
  • Save wkerzendorf/71cae173fdb866e911995e881e216fa4 to your computer and use it in GitHub Desktop.
Save wkerzendorf/71cae173fdb866e911995e881e216fa4 to your computer and use it in GitHub Desktop.
run-dalek-jobarray.sbatch
#!/bin/bash
#SBATCH --job-name=dalek-jobarray
#SBATCH --nodes=1
#SBATCH --cpus-per-task=20
#SBATCH --mem=40GB
#SBATCH --time=02:00:00
#SBATCH --array=0-300
### ACTIVATING CONDA ####
module purge
export PATH=/mnt/home/wkerzend/ls15/miniconda/bin:$PATH
. /mnt/home/wkerzend/ls15/miniconda/etc/profile.d/conda.sh
conda activate tardis
hash -r
########
GRID_FNAME=grid1_v2_log_uniform_params_11feb20_part1.h5
TASKS_PER_PARALLEL_RUN=20
PARALLEL_BATCH_PER_RUN=5
TOTAL_RUN=$(( $TASKS_PER_PARALLEL_RUN * $PARALLEL_BATCH_PER_RUN ))
BATCH_START_ID=$(( $SLURM_ARRAY_TASK_ID * $TOTAL_RUN ))
echo "SINGLE JOB ARRAY STARTING AT $BATCH_START_ID"
for ((PARALLEL_BATCH_START=BATCH_START_ID; PARALLEL_BATCH_START < BATCH_START_ID + TOTAL_RUN; PARALLEL_BATCH_START+=TASKS_PER_PARALLEL_RUN))
do
echo "PARALLEL BATCH STARTING AT $PARALLEL_BATCH_START"
for ((parameter_set_id=PARALLEL_BATCH_START; parameter_set_id < PARALLEL_BATCH_START + TASKS_PER_PARALLEL_RUN; parameter_set_id++))
do
echo "PARALLEL EXECUTING $parameter_set_id"
/mnt/home/wkerzend/ls15/miniconda/envs/tardis/bin/python temp_radius_uabundance_runner.py $GRID_FNAME $parameter_set_id log_uniform_v2_data dalek_hesma_grid1_v2.yml&
done
wait
echo "PARALLEL DONE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment