Skip to content

Instantly share code, notes, and snippets.

@tskisner
Created May 29, 2016 16:11
Show Gist options
  • Save tskisner/b8b0400b6312eb74b5504657f74b867a to your computer and use it in GitHub Desktop.
Save tskisner/b8b0400b6312eb74b5504657f74b867a to your computer and use it in GitHub Desktop.
Example slurm script for bgs-sims.py
#!/bin/bash -l
#SBATCH --partition=debug
#SBATCH --account=desi
#SBATCH --nodes=1
#SBATCH --time=00:30:00
#SBATCH --job-name=bgs-sims
#SBATCH --output=bgs-sims_%j.log
#SBATCH --export=NONE
# --------- Environment setup ----------
# Setup your environment from scratch here.
# For example, source the DESI startup scripts,
# load any modules needed, etc.
#source /project/projectdirs/desi/software/modules/desi_environment.sh
#OR manually...
# hpcports gnu
# module load desideps-hpcp
# export PATH=${PATH}:<blah>/bin
# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<blah>/lib
# export PYTHONPATH=${PYTHONPATH}:<blah>/lib/python2.7/site-packages
# etc...
# --------------------------------------
# The physical cores we have- ignore hyperthreads.
node_cores=0
if [ ${NERSC_HOST} = edison ]; then
node_cores=24
else
node_cores=32
fi
# this *MUST* match the "SBATCH --nodes" parameter above
nodes=1
# if you are using an MPI app, you could set this to numbers
# greater than 1, like 8, 4, etc.
node_proc=1
# ----- Choose only one of these ------
# This assumes we want to use every core
#core_per_proc=$(( node_cores / node_proc ))
# This restricts the number cores per process
core_per_proc=8
# -------------------------------------
procs=$(( nodes * node_proc ))
run="srun --export=ALL --cpu_bind=no -n ${procs} -N ${nodes} -c ${core_per_proc}"
ex="python ${HOME}/bgs-sims/bgs-sims.py"
time ${run} ${ex} --sim 4 --nproc ${core_per_proc} --zfind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment