Comsol/Batch
You need to submit your COMSOL jobs through the batch system. For a single processor calculation a typical command could look like
sbatch [Slurm options] --wrap="comsol batch -inputfile infile.mph -outputfile outfile.mph"
Here you need to replace [Slurm options] with Slurm parameters for the resource requirements of the job. Please find a documentation about the parameters of sbatch on the wiki page about the batch system.
For using the COMSOLBATCH licenses, you would need to add the -usebatchlic option:
sbatch [Slurm options] --wrap="comsol batch -usebatchlic -inputfile infile.mph -outputfile outfile.mph"
For parallel jobs using shared memory, you can specify the number of cores to be used with the -np option of COMSOL:
sbatch --ntasks=1 --cpus-per-task=4 [Slurm options] --wrap="comsol batch -np 4 -inputfile infile.mph -outputfile outfile.mph"
Please make sure that the --ntaks= option of sbatch and the -np option of COSMOL always have the same value. Please be careful to not use the -clustersimple option for shared memory jobs as this would make COMSOL start MPI processes instead of using threads.
If you plan to run parallel COMSOL jobs, then we strongly recommend to first do a small scaling study to find out the sweet spot for the parallel efficiency of your model. Since COMSOL can be strongly memory bound, the sweet spot might be to use 4 cores (see scaling study below).
Parallel jobs using distributed memory
If you would like to run COMSOL in distributed memory mode, then you need to add the -mpibootstrap slurm option to your COMSOL command:
sbatch --ntasks=4 [Slurm options] --wrap="comsol batch -mpibootstrap slurm -inputfile infile.mph -outputfile outfile.mph"
Please be careful to not mix the -mpibootstrap slurm option with the -np option as this will start too many threads. The -mpibootstrap slurm option will tell COMSOL to get the required MPI information like hostnames etc. directly from the batch system.
If you plan to run parallel COMSOL jobs, then we strongly recommend to first do a small scaling study to find out the sweet spot for the parallel efficiency of your model. Since COMSOL can be strongly memory bound, the sweet spot might be to use 4 cores (see scaling study below).