Before running Mathematica jobs on Maxwell, please consult Mathematica License Server for the proper Mathematica License Server to use. For example: if you are a user of Eur.XFEL facilities or Eur.XFEL staff please set the license server:
mkdir -p $HOME/.Mathematica/Licensing/ echo '!exfllic01.desy.de' > $HOME/.Mathematica/Licensing/mathpass # to verify math11.1 Mathematica 11.1.0 Kernel for Linux x86 (64-bit) Copyright 1988-2017 Wolfram Research, Inc. In[1]:= $LicenseServer Out[1]= exfllic01.desy.de
A very primitive sample mathematica job might look like this:
#SBATCH --time=0-00:10:00 #SBATCH --nodes=1 #SBATCH --partition=allcpu #SBATCH --job-name=mathematica # set the environment export LD_PRELOAD="" source /etc/profile.d/modules.sh module load mathematica # use only physical cores export nprocs=$((`/usr/bin/nproc` / 2)) # exfel license server has only 32 SubKernel Licenses if [[ "$group" == "exfel" && $nprocs -gt 32 ]]; then nprocs=32 fi # run a trivial job math -noprompt -run '<<math-trivial.m' exit
This allows to use launch as many kernels as cores available on the compute node. A very trivial sample (math-trivial.m):
tmp = Environment["nprocs"] nprocs = FromDigits[tmp] LaunchKernels[nprocs] Do[Pause[1];f[i],{i,nprocs}] // AbsoluteTiming >> "math-trivial.out" ParallelDo[Pause[1];f[i],{i,nprocs}] // AbsoluteTiming >>> "math-trivial.out" Quit[]