Skip to content

Slurm job template for using nmm

This guide describes how to create a template file that uses nmm .

Prerequisites

  1. Familiarity with submit_slurm_job
  2. Familiarity with simple template files

nmm template file

Below is a simple template file that can be used to submit NONMEM jobs to slurm with nmm .

slurm-job.tmpl
#!/bin/bash
#SBATCH --job-name="{{job_name}}"
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task={{ncpu}}
#SBATCH --partition={{partition}}
#SBATCH --account={{project_name}}
{{nmm_exe_path}} -c {{config_toml_path}} run

The template file uses the whisker package to fill in variables according to the Mustache templating standard . When submit_slurm_job is called, it reads the template file and injects both the default values provided to the template and any values passed in via the slurm_template_opts argument. Variables in the template file are denoted with double curly brackets, such as {{ injected_variable }}, and these placeholders are replaced with the respective values when submit_slurm_job runs.

Here’s an example of a filled-in template file after calling submit_slurm_job(mod):

1001.sh
#!/bin/bash
#SBATCH --job-name="1001-nonmem-run"
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --partition=cpu2mem4gb
#SBATCH --account=slurmtools
/usr/local/bin/nmm -c /cluster-data/user-homes/user/Packages/slurmtools/model/nonmem/1001.toml run

Understanding the template file

This template file only uses the nmm binary location and the NONMEM model config toml file. The toml file sets the configuration of the nmm and is explained in the generate_nmm_config reference

Next steps

Let’s add some notifications to our job submission so we can see when it’s started and ended