Skip to content

Submitting COMSOL Jobs With Slurm

This script is an example of launching individual COMSOL jobs on the Kennesaw State HPC Cluster.

Submission Script

This script is adapted from the COMSOL Knowledge Blog post: How to Run Simulations in Batch Mode from the Command Line. This version will run across four nodes, with four processors per node; you can adjust those values as needed. Make sure to change netid@kennesaw.edu and account_name in the script to the correct values for your job:

run_comsol.slurm
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

#SBATCH --export="ALL"
#SBATCH --nodes=4
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --job-name="COMSOL_Job"
#SBATCH --partition="defq"
#SBATCH --mail-type="BEGIN,END,FAIL"
#SBATCH --mail-user="netid@kennesaw.edu " (1)
#SBATCH --account="account_name" (2)

module load COMSOL

cd ${SLURM_SUBMIT_DIR}

srun comsol batch -mpirmk pbs -alivetime 15 -recover \
    -inputfile "${FILE}" -outputfile "${FILE}.out" \
    -batchlog  "${FILE}.log"
  1. 🙋‍♂️ Make sure to change netid@kennesaw.edu on this line to your KSU email address or you won't receive emails when the job starts and stops.
  2. 🙋‍♂️ Make sure to change account_name on this line to the VHPC billing account your job should be charged to.

Usage

Assuming you saved the Slurm script from above as run_comsol.slurm, and the name of your COMSOL file is my_comsol.mph, you can submit your COMSOL job with the following command:

[barney@vhpc ~]$ sbatch --export=ALL,FILE=${PWD}/my_comsol.mph run_comsol.slurm