Skip to content

Run on a cluster (SLURM)

Goal: process a whole cohort on a SLURM cluster, one job per scan.

  1. Install QSMxT in your home directory on the cluster, with the same one-line command as on a laptop (Install). No administrator is needed.

  2. Convert and check the data (on a login node or a small interactive job):

    Terminal window
    qsmxt dicom-convert /data/dicoms study/bids
    qsmxt validate study/bids
  3. Write and submit the jobs. --account is the SLURM account to charge:

    Terminal window
    qsmxt slurm study/bids --account myaccount --submit

    Any qsmxt run option works here too, for example --config pipeline_config.toml to use settings you tried on one subject first.

In the TUI, set the Execution tab to SLURM, fill in the account, and run.

squeue -u $USER shows one job per scan and one aggregation job, which waits until every scan’s job has finished. When it is done, the output looks the same as a local qsmxt run: maps under derivatives/qsmxt/sub-*/anat/, methods.md at the top. Each scan’s log is derivatives/qsmxt/logs/<run>.log; SLURM’s own output is beside the job scripts in derivatives/qsmxt/slurm/.

  1. Read its log in derivatives/qsmxt/logs/, and fix the cause.
  2. Submit that scan’s job again: sbatch derivatives/qsmxt/slurm/qsmxt_<run>.sh. Steps that already finished are not repeated.
  3. Then submit the aggregation job yourself: sbatch derivatives/qsmxt/slurm/qsmxt_aggregate.sh.
  • --partition and --time (default 2 hours per job).
  • --mem: memory per job in GB. By default each job asks for an estimate from its scan’s size.
  • Without --submit, the scripts are written but not submitted; submit them later with bash derivatives/qsmxt/slurm/submit.sh.

Every option is in Command line.

qsmxt slurm checks the settings, and every scan against them, before it writes anything, so a bad setting is reported once rather than by every job. It writes the resolved settings to derivatives/qsmxt/pipeline_config.toml, and the jobs to derivatives/qsmxt/slurm/:

  • One job per scan (qsmxt_<run>.sh) runs qsmxt run --no-dataset-steps --include <run>: that scan’s pipeline and nothing else.
  • One aggregation job (qsmxt_aggregate.sh) starts once every scan’s job has succeeded (--dependency=afterok). It runs qsmxt aggregate, which does what a local qsmxt run does after its scans: multi-orientation reconstruction, the dataset’s tables and figures, methods.md, the provenance records, the combined qsmxt.log, and --clean-intermediates if you asked for it. It refuses a scan that has not finished under the same settings, and names it.

The result is the dataset a local qsmxt run makes. Each job asks for memory estimated from its scan’s size; the aggregation job is sized for the largest multi-orientation group. A job that is requeued or restarted carries on from its last finished step.