Skip to content

Commit

Permalink
Merge pull request #23 from stigrj/slurm-examples
Browse files Browse the repository at this point in the history
update slurm examples with more specific allocation of resources
  • Loading branch information
bast committed Sep 19, 2017
2 parents de36433 + b2266f9 commit 989ff16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions jobs/files/slurm-MPI-OMP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#SBATCH --job-name=example

# we ask for 2 MPI tasks with 20 cores each
#SBATCH --ntasks=2
#SBATCH --cpus-per-task=20
# we ask for 4 MPI tasks with 10 cores each
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=2
#SBATCH --cpus-per-task=10

# run for five minutes
# d-hh:mm:ss
Expand Down Expand Up @@ -39,7 +40,7 @@ cp ${SLURM_SUBMIT_DIR}/my_binary.x ${SCRATCH_DIRECTORY}
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}

# we execute the job and time it
time ./my_binary.x > my_output
time mpirun -np $SLURM_NTASKS ./my_binary.x > my_output

# after the job is done we copy our output back to $SLURM_SUBMIT_DIR
cp ${SCRATCH_DIRECTORY}/my_output ${SLURM_SUBMIT_DIR}
Expand Down
2 changes: 1 addition & 1 deletion jobs/files/slurm-MPI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cd ${SCRATCH_DIRECTORY}
cp ${SLURM_SUBMIT_DIR}/my_binary.x ${SCRATCH_DIRECTORY}

# we execute the job and time it
time mpirun ./my_binary.x > my_output
time mpirun -np $SLURM_NTASKS ./my_binary.x > my_output

# after the job is done we copy our output back to $SLURM_SUBMIT_DIR
cp ${SCRATCH_DIRECTORY}/my_output ${SLURM_SUBMIT_DIR}
Expand Down
7 changes: 4 additions & 3 deletions jobs/files/slurm-OMP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

#SBATCH --job-name=example

# we ask for 1 node with 20 cores
# we ask for 1 task with 20 cores
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=20
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=20

# run for five minutes
# d-hh:mm:ss
Expand Down Expand Up @@ -36,7 +37,7 @@ cd ${SCRATCH_DIRECTORY}
cp ${SLURM_SUBMIT_DIR}/my_binary.x ${SCRATCH_DIRECTORY}

# we set OMP_NUM_THREADS to the number of available cores
export OMP_NUM_THREADS=${SLURM_TASKS_PER_NODE}
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}

# we execute the job and time it
time ./my_binary.x > my_output
Expand Down

0 comments on commit 989ff16

Please sign in to comment.