#!/bin/bash EXECUTABLE='/home/araim1/scripting-case-study/src/report_time' # This function writes a SLURM script. We can call it with different parameter # settings to create different experiments function write_script { STUDY_NAME=$(printf 'study_n%05d' ${N}) DIR_NAME=$(printf '%s/n%03dppn%d' ${STUDY_NAME} ${NODES} ${NPERNODE}) if [ -d $DIR_NAME ] ; then echo "$DIR_NAME already exists, skipping..." return 0 else echo "Creating job $DIR_NAME" fi mkdir -p $DIR_NAME cat << _EOF_ > ${DIR_NAME}/run.slurm #!/bin/bash #SBATCH --job-name=test_study #SBATCH --output=slurm.out #SBATCH --error=slurm.err #SBATCH --partition=batch #SBATCH --nodes=${NODES} #SBATCH --ntasks-per-node=${NPERNODE} srun ./report_time ${N} _EOF_ chmod 775 ${DIR_NAME}/run.slurm ln -s ${EXECUTABLE} ${DIR_NAME}/ } # For each problem size, we'll run the experiment with 1, 2, 4, and 8 processors # on 1, 2, 4, ..., 32 nodes for N in 1024 2048 4096 do for NPERNODE in 1 2 4 8 do for NODES in 1 2 4 8 16 32 do write_script done done done