I have a mathematica *.wl file set up, such that there are a couple of parameters defined in the beginning, and, when run, it produces a few outputs. I can run this script on a Slurm-run HPC cluster and everything works fine.

Now to my question: I want to launch this *.wl script several times, each time with slightly different parameters defined in the beginning. And run the same script (with different initial parameters) in parallel. Running this file in parallel is no problem, however, how can I write a sbatch script such that the parameters in the beginning of the *.wl file are changed each time?

  • 1
    $\begingroup$ Why not pass them as command line in your slurm script? That can be parsed out on the Mathematica side. This is what I do with my Mathematica jobs on my local neighborhood HPC. $\endgroup$ – b3m2a1 May 29 '19 at 1:56
  • $\begingroup$ How would that work explicitly? $\endgroup$ – Nils May 29 '19 at 2:43
  • $\begingroup$ Use $CommandLine or whatever. Then when you call stuff in srun you can just supply different args just like calling a python script or similar. $\endgroup$ – b3m2a1 May 29 '19 at 2:45
  • $\begingroup$ I use Mathematica's built-in parallelizaton for this (ParallelTable and such). Let me know if you need some guidance on how to set this up on a cluster. $\endgroup$ – Szabolcs May 29 '19 at 8:18
  • $\begingroup$ Some guidance would be fantastic! $\endgroup$ – Nils May 29 '19 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.