Batch File Examples
Basic Boilerplate for every job submission script, with module load command - Copy and paste it into a text editor
This example is a: 1 node, 2 core, 16GB ram, MATLAB R2022a job on the general nodes (partition)
#!/bin/bash
#SBATCH --partition=general
#SBATCH --nodes=1 # Run all processes on a single node(single server is our only option)
#SBATCH --ntasks=1 # Run a single task (this is your job you are submitting)
#SBATCH --cpus-per-task=2 # Number of CPU cores per task (this allocates 2 CPU cores for the job)
#SBATCH --mem-per-cpu=8gb # Memory (i.e. RAM) per CPU * CPUs per task, in this case 16GB total.
#SBATCH --job-name=test-job
#SBATCH --output=test-job.%j.out
#SBATCH --mail-type=BEGIN,END
#SBATCH --mail-user=yourUsername@ucsd.edu
module purge
module load matlab/R2022a
matlab -nodisplay -nosplash -r for_loop
Simple R submission Script - Copy and paste it into a text editor
Module load Commands are used to load the specific software versions needed to run code(other than the default install)
The below example has the paths left in as an example. You will need to change them to reflect your needs.
#!/bin/bash
#SBATCH -partition=general
#SBATCH --nodes=1 # Run all processes on a single node(single server is our only option)
#SBATCH --ntasks=1 # Run a single task (this is your job you are submitting)
#SBATCH --cpus-per-task=2 # Number of CPU cores per task (this allocates 2 CPU cores for the job)
#SBATCH --mem-per-cpu=8gb # Memory (i.e. RAM) per CPU * CPUs per task, in this case 16GB total.
#SBATCH --job-name=test-job
#SBATCH --output=test-job.%j.out
#SBATCH --mail-type=BEGIN,END
#SBATCH --mail-user=yourUsername@ucsd.edu
#Load Modules
module load R/4.3.0
#call and Run the R Script
Rscript /home/sscf-todd/Documents/TeenTechXS/MCS_Code/4_3_1_b_Run_On_Cluster_2nd_per_mcs.R