Question About MKL on Slurm Cluster

,

Hello,

I am using Julia on an HPC that uses Lmod and Slurm.

I wanted to try using MKL for some calculations since I have access to nodes with intel CPUs. I followed the instructions here. At the top of my script the first package I bring in is MKL.jl.

But I noticed that under modules on the cluster (I did module avail mkl) that there are several versions of MKL listed. Do I need to be explicitly using these in my batch script? Or do they get loaded automatically since I submitted the job to a node with an intel CPU? Hopefully that makes sense.

What I mean is, in my batch script should I have

#SBATCH directives...

module purge
module load mkl

MKL_NUM_THREADS=$SLURM_NTASKS julia main.jl

Then in my Julia script I have

# main.jl
using MKL, other packages...

# calculations....

Or is the module load mkl unnecessary?

Julia brings its own version of MKL so loading the cluster’s module does not affect Julia in any way. So you can just remove the load of the cluster’s module.

You can check the setup on Julia side with

using MKL, LinearAlgebra
BLAS.get_config()
2 Likes