Last active
August 2, 2018 15:02
-
-
Save bretonics/1dc5d0926aefa7787ebf48a0bad5316b to your computer and use it in GitHub Desktop.
Template file for Sun Grid Engine (SGE) job submissions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -l | |
# template.qsub - Template file for Sun Grid Engine (SGE) job submissions | |
# Andrés Bretón, http://andresbreton.com | |
# Template from https://gist.github.com/bretonics/1dc5d0926aefa7787ebf48a0bad5316b | |
#------------------------------------------------------------------------------- | |
# ENVIRONMENTAL VARIABLES AVAILABLE | |
# JOB_ID Current job ID | |
# JOB_NAME Current job name | |
# NSLOTS The number of slots (threads or processors) requested by a job | |
# HOSTNAME Name of execution host | |
# SGE_TASK_ID Array Job task index number | |
# SGE_TASK_STEPSIZE The step size of the array job specification | |
# SGE_TASK_FIRST The index number of the first array job task | |
# SGE_TASK_LAST The index number of the last array job task | |
# TMPDIR The absolute path to the job's temporary working directory | |
#------------------------------------------------------------------------------- | |
# COMPUTING DIRECTIVES | |
# Specify hard time limit for the job | |
# The job will be aborted if it runs longer than this time | |
# The default time is 12 hours | |
#$ -l h_rt=24:00:00 | |
# Memory | |
# Request a node with at least 32 of memory (4 cores x 8GB per core = 32GB total) | |
#$ -l mem_total=32G # Request a node that has at least 16G of total memory | |
#$ -l mem_per_core=8G # Request a node with at least 8 GB of memory per core | |
# Request a parallel environment with four cores | |
#$ -pe omp 4 | |
# Request MPI jobs | |
# The SCC has 2 sets of nodes dedicated to run MPI jobs | |
# One set has 16-core nodes with 128 GB each | |
# The other set of nodes has 28-core nodes with 256 GB each | |
#$ -pe mpi_28_tasks_per_node 224 # 8 nodes with 28 core each | |
# Request GPU jobs | |
#$ -pe omp 4 # Request 4 CPUs | |
# Request 1 GPU (the number of GPUs needed should be divided by the number of CPUs requested above) | |
#$ -l gpus=0.25 | |
# Specify the minimum GPU compute capability | |
#$ -l gpu_c=3.5 | |
# Request my job to run on Buy-in Compute group hardware my_project has access to | |
#$ -l buyin | |
#------------------------------------------------------------------------------- | |
# ACTION DIRECTIVES | |
# Set SCC project | |
#$ -P project_name | |
# Job name | |
#$ -N job_name | |
# Stdout output | |
#$ -o "${JOB_NAME}/${JOB_NAME}_stdout.qlog" | |
# Stderr output | |
#$ -e "${JOB_NAME}/${JOB_NAME}_stderr.qlog" | |
# Merge the error and output streams into a single file | |
#$ -j y | |
# Specify the output file name | |
#$ -o "${JOB_NAME}/$JOB_NAME.qlog" | |
# Send an email (by default no email is sent). The possible values are - | |
# job begins (b), ends (e), is aborted (a), is suspended (s), or never (n) – default | |
#$ -m beasn | |
# Email adress to send email | |
#$ -M user_email | |
# All current environment variables should be exported to the batch job | |
#$ -V | |
# Set the runtime environment variable env to value | |
#$ -v env=value | |
# Setup job dependency list | |
# job_list is a comma separated list of job ids and/or job names which must complete before this job can run | |
#$ -hold_jid job_list | |
# Run in current directory | |
#$ -cwd | |
#------------------------------------------------------------------------------- | |
# JOB | |
# Load modules | |
modules=() | |
module load ${modules[@]} | |
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# Save environment to file | |
env > "${JOB_NAME}/${JOB_NAME}.env" | |
# Keep track of information related to the current job | |
echo "# ================================================================================" | |
echo "# JOB NAME: $JOB_NAME" | |
echo "# USER: $USER" | |
echo "# PWD: $(pwd)" | |
echo "# HOST: $HOSTNAME" | |
echo "# JOB ID: $JOB_ID" | |
echo "# TASK ID: $SGE_TASK_ID" | |
echo "# START: $(date)" | |
printf "\n\n# " | |
module list | |
echo "# ================================================================================" | |
echo "" | |
echo "" | |
echo "" | |
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# CALLS | |
cmd="" | |
echo "#--------------------------------------------------------------------------------" | |
echo "# Running :" | |
echo "# $cmd" | |
echo "#--------------------------------------------------------------------------------" | |
echo "" | |
echo "" | |
$cmd | |
echo "# ================================================================================" | |
echo "" | |
echo "" | |
cmd="" | |
echo "#--------------------------------------------------------------------------------" | |
echo "# Running :" | |
echo "# $cmd" | |
echo "#--------------------------------------------------------------------------------" | |
echo "" | |
echo "" | |
$cmd | |
echo "# ================================================================================" | |
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# End job message | |
echo "" | |
echo "" | |
echo "" | |
echo "# ================================================================================" | |
echo "# End: $(date)" | |
echo "# User: $USER" | |
echo "# Cores/Threads: $NSLOTS" | |
echo "# Temporary Directory: $TMPDIR" | |
echo "# ================================================================================" | |
echo "" | |
echo "" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment