#!/bin/bash #SBATCH --cpus-per-task=1 #SBATCH --mem-per-cpu=[MEMORY_NEEDED_FOR_JOB] #SBATCH --partition=[PARTITION/QUEUE] #SBATCH --time=[DAYS]-[HOURS]:[MINUTES]:[SECONDS] #SBATCH --job-name=[JOBNAME] #SBATCH --mail-user=[USERNAME]@memphis.edu #SBATCH --output=[STDOUT].out #SBATCH --error=[STDERR].err #SBATCH --array=[BEGIN]-[END] ################################################# # [SOMETHING] # #-----------------------------------------------# # Please replace anything in [] brackes with # # what you want. # # Example: # # #SBATCH --partition=[PARTITION/QUEUE] # # Becomes: # # #SBATCH --partition=computeq # ################################################# ################################################# # --array=[BEGIN]-[END] # #-----------------------------------------------# # This is the essential option for an array job.# # [BEGIN] and [END] are the range of values that# # $SLURM_ARRAY_TASK_ID will take. Each array # # task id will be its own job. The total number # # of array task ids is included in the variable # # $SLURM_ARRAY_TASK_COUNT. # ################################################# # --partition=[PARTITION/QUEUE] # #-----------------------------------------------# # computeq: 40 cores, 192 GB mem # # shortq: 40 cores, 192 GB mem, 2 day timelimit # # bigmemq: 40 cores, 768-1536 GB mem # # gpuq: 40 cores, 192 GB mem, 2 v100 GPUs # ################################################# # --time=[DAYS]-[HOURS]:[MINUTES]:[SECONDS] # #-----------------------------------------------# # Total time you allocate for your job. It will # # be killed after this time. If you need an # # extension contact hpcadmins@memphis.edu # ################################################# # --job-name=[JOBNAME] # #-----------------------------------------------# # Your jobname when you run 'squeue'. # ################################################# # --mail-user=[USERNAME]@memphis.edu # #-----------------------------------------------# # It will mail you with certain statuses. # ################################################# # --mail-type=[MAIL_OPTIONS] # # --output=[STDOUT].out # # --error=[STDERR].err # #-----------------------------------------------# # Run 'man sbatch' to see options. # ################################################# # --mem-per-cpu=[MEMORY_NEEDED_FOR_JOB] # #-----------------------------------------------# # Default is 1024. It is in megabytes (MB). If # # you need more, put it here. If you job fails # # check [STDERR].err to confirm that it was out # # of memory. This is per CPU. # ################################################# ################################################# # SLURM_SUBMIT_DIR # #-----------------------------------------------# # Usually you want to go to the directory # # that 'sbatch slurmSubmitSerial.sh' was called.# # SLURM_SUBMIT_DIR is an environment variable # # that defines that directory. Otherwise, HOME # # is default (/home/[USERNAME]/). # ################################################# cd $SLURM_SUBMIT_DIR ################################################# # modules # #-----------------------------------------------# # Any modules you need can be found with # # 'module avail'. If you compile something with # # a particular compiler using a module, you # # probably want to call that module here. # ################################################# #module load [MODULE] ################################################# # SLURM_JOB_ID # #-----------------------------------------------# # You can use SLURM_JOB_ID environment variable # # to get the current jobId. # #'squeue -u [USERNAME]' lists user jobs with # # jobId in the left column. # ################################################# echo "$SLURM_JOB_ID" ################################################# # Run your executable here. You could use # # $SLURM_ARRAY_TASK_ID to index files, values, # # or arguments for your executable. # ################################################# #[EXECUTABLE] [OPTIONS] echo "Task Id: $SLURM_ARRAY_TASK_ID of $SLURM_ARRAY_TASK_COUNT" ################################################# # value array indexing using: # # --array=0-2 # ################################################# val=( 99.7 102.3 97.1 ) echo "Station: ${val[$SLURM_ARRAY_TASK_ID]}" ################################################# # file indexing using: # # --array=0-2 # ################################################# echo "First" > file_0.txt echo "Second" > file_1.txt echo "Third" > file_2.txt cat file_${SLURM_ARRAY_TASK_ID}.txt