University of Pretoria
Operational / Internal Site

COMSOL simulations with SLURM

A total of 10 COMSOL CKL and 2 COMSOL FNL licenses are available for use on the cluster.

Below are SLURM templates for various types of COMSOL simulations. Please use the smallest feasible values for the simulation so that our cluster usage can be optimised. COMSOL is also available in a limited interactive mode (see bottom of page).

Note: In the templates, there are various parameters you should change to reflect your simulation requirements. These parameters are indicated with <CHANGETHIS> tag. For example:

#SBATCH --mail-user=<CHANGETHIS>

Moderate size multi-CPU COMSOL simulation: 1 CKL license

This template is suitable for large simulations that require more memory than is available on desktop computers and would typically run more than an hour on a lab computer. A single task is defined that will be allocated 4 CPU cores.

Typically values for –mem-per-cpu are 2000 (for 2G) or 4000 (for 4G) for larger simulations.

comsol.slurm
#!/bin/bash
#SBATCH --output=<CHANGETHIS>.log
#SBATCH --job-name=<CHANGETHIS>
#SBATCH --cpus-per-task=4
#SBATCH --mem-per-cpu=<CHANGETHIS>
#SBATCH --licenses=comsolckl:1
#SBATCH --time=<CHANGETHIS>
#SBATCH --mail-type=END
#SBATCH --mail-user=<CHANGETHIS>
 
# Run COMSOL model simulation
MODEL=<CHANGETHIS>
srun comsol batch -inputfile $MODEL.mph -outputfile $MODEL\_out.mph -np 4 -ckl

Maximum size multi-CPU COMSOL simulation: 1 CKL license

This template, for a model with name comsol_max, is suitable for very large simulations that would require days to run on a desktop computer. A single task is defined that will be allocated 12 CPU cores.

Typically values for –mem-per-cpu are 2000 (for 2G) or 2500 (for 2.5) for larger simulations.

comsol_max.slurm
#!/bin/bash
#SBATCH --output=<CHANGETHIS>.log
#SBATCH --job-name=<CHANGETHIS>
#SBATCH --cpus-per-task=12
#SBATCH --mem-per-cpu=<CHANGETHIS>
#SBATCH --licenses=comsolckl:1
#SBATCH --time=<CHANGETHIS>
#SBATCH --mail-type=END
#SBATCH --mail-user=<CHANGETHIS>
 
# Run COMSOL model simulation
MODEL=<CHANGETHIS>
srun comsol batch -inputfile $MODEL.mph -outputfile $MODEL\_out.mph -np 12 -ckl

Maximum size multi-CPU COMSOL simulation: 1 FNL license

This template, for a model with name comsol_fnl, is suitable for very large simulations that would require days to run on a desktop computer. A single task is defined that will be allocated 12 CPU cores.

Typically values for –mem-per-cpu are 2000 (for 2G) or 2500 (for 2.5) for larger simulations.

comsol_fnl.slurm
#!/bin/bash
#SBATCH --output=<CHANGETHIS>.log
#SBATCH --job-name=<CHANGETHIS>
#SBATCH --cpus-per-task=12
#SBATCH --mem-per-cpu=<CHANGETHIS>
#SBATCH --licenses=comsolfnl:1
#SBATCH --time=<CHANGETHIS>
#SBATCH --mail-type=END
#SBATCH --mail-user=<CHANGETHIS>
 
# Run COMSOL model simulation
MODEL=<CHANGETHIS>
srun comsol batch -inputfile $MODEL.mph -outputfile $MODEL\_out.mph -np 12

Interactive COMSOL: 1 CKL license

For the creation of large models it is sometime necessary to run COMSOL in interactive mode on the cluster. To do so, simply run comsol after logging in on the head node. This will start a single CPU session with 12GB of memory with the COMSOL CKL license. Note that it will take about 30 to 50 seconds for the session to be allocated on the cluster and for COMSOL to start. Note furthermore that the session has a hard time limit of 4 hours and will also terminate after 20 minutes of inactivity.

Do not use the interactive session for simulations.

For the X11 graphics to be handled correctly, this assumes you have a X11 server installed on your computer and that you logged in with X11 forwarding enabled.