Skip to main content

Submitting Jobs via SLURM

Last updated: May 12, 2026Latest Frontend Version: 2.16.17

Prerequisites

Access Level:

User, Sub-admin, Admin, Super-admin

Requirements

  • A tiCrypt VM configured as a SLURM submit host (managed by a system administrator)
  • The VM image must have SLURM installed and running
  • Submission permissions on the relevant partition
  • Data and scripts staged within the tiCrypt project directory

Overview

tiCrypt integrates with SLURM (Simple Linux Utility for Resource Management) for scheduling compute jobs on secure infrastructure. Jobs are submitted from within a tiCrypt virtual machine, either through the in-browser terminal or an RDP session.

Both sbatch (batch submission) and srun (direct execution, including interactive sessions) are supported.

info

The script and program names used in the examples below (analysis.sh, run_analysis.py, qc_cohort.R) are illustrative. The workload command may be any program callable from the shell: Python, R, compiled binaries, shell pipelines, Stata, MATLAB, etc.

Verify SLURM Availability

Before submitting jobs, confirm that SLURM is available on the VM:

sinfo

If this command returns partition and node information, the VM is correctly configured for job submission.

Job Script Structure

A job script has two parts: a block of #SBATCH directives followed by the shell commands to execute.

#!/bin/bash
#SBATCH --job-name=my_job
#SBATCH --output=logs/%x_%j.out
#SBATCH --error=logs/%x_%j.err
#SBATCH --time=01:00:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=16G
#SBATCH --partition=secure

echo "Running on $(hostname)"

Submit the script:

sbatch myjob.sh

%x expands to the job name and %j to the job ID. The logs/ directory must exist before submission.

Examples

A minimal script that confirms successful submission and execution on a compute node.

#!/bin/bash
#SBATCH --job-name=hello
#SBATCH --output=hello_%j.out
#SBATCH --time=00:05:00
#SBATCH --mem=1G

echo "Hello from $(hostname)"
echo "Job ID: $SLURM_JOB_ID"
date

Job Arrays

Availability

Job arrays are scheduled for support in June 2026. The example below is provided for reference and will not function in current tiCrypt deployments.

Job arrays execute the same script across multiple inputs in parallel.

#!/bin/bash
#SBATCH --job-name=array_job
#SBATCH --array=1-50
#SBATCH --output=logs/%x_%A_%a.out
#SBATCH --error=logs/%x_%A_%a.err
#SBATCH --time=01:00:00
#SBATCH --cpus-per-task=2
#SBATCH --mem=8G
#SBATCH --partition=secure

INPUT=$(sed -n "${SLURM_ARRAY_TASK_ID}p" /project/myteam/inputs.txt)

python /project/myteam/scripts/process_one.py --input "${INPUT}"

%A represents the array job ID and %a the task index. To limit concurrently running tasks, append %N to the array range (e.g., --array=1-50%5 permits at most five tasks at once).

Inline Submission with sbatch --wrap

For single-command jobs, the script file can be omitted:

sbatch --wrap="echo \"Date: $(date)\"; echo \"Hostname: \$(hostname)\""

Unescaped expressions like $(date) are evaluated on the submit host before the job is queued. Escaped expressions like \$(hostname) are evaluated on the compute node at execution time.

Combine --wrap with resource directives:

sbatch \
--job-name=quick_test \
--time=00:30:00 \
--cpus-per-task=4 \
--mem=8G \
--partition=secure \
--wrap="python /project/myteam/scripts/sanity_check.py"

Direct Execution with srun

srun runs a command directly under SLURM without a script file. It is suited to short commands, interactive sessions, and launching steps from within a job script.

Run a single command on a compute node:

srun --time=00:30:00 --cpus-per-task=4 --mem=8G --partition=secure \
python /project/myteam/scripts/sanity_check.py

Open an interactive shell on a compute node:

srun --pty --time=01:00:00 --cpus-per-task=4 --mem=16G --partition=secure bash

The shell exits and the allocation is released when you type exit.

Use srun inside an sbatch script to launch job steps:

#!/bin/bash
#SBATCH --job-name=stepped_job
#SBATCH --time=02:00:00
#SBATCH --ntasks=4
#SBATCH --mem=16G
#SBATCH --partition=secure

srun --ntasks=1 python /project/myteam/scripts/step_a.py
srun --ntasks=1 python /project/myteam/scripts/step_b.py

GPU Workloads

Availability

GPU support is scheduled for Q4 2026. GPU resource requests (--gres=gpu:N) are not available in current tiCrypt deployments. This section will be updated when the feature is released.

Resource Directives Reference

The following flags apply to both sbatch (as #SBATCH directives or command-line options) and srun.

DirectiveDescription
--timeMaximum wall-clock time (HH:MM:SS). Jobs exceeding this limit are terminated.
--cpus-per-taskNumber of CPU cores allocated per task.
--ntasksNumber of parallel tasks. Set to 1 for non-MPI workloads.
--memTotal memory allocation (suffix G or M). Jobs exceeding this limit are terminated.
--partitionTarget partition. Available partitions are determined by the tiCrypt deployment.

After a job completes, use sacct to review actual resource consumption and refine future requests.

Monitoring and Managing Jobs

squeue --me # List your queued and running jobs
scontrol show job <JOBID> # View detailed job information
scancel <JOBID> # Cancel a specific job
scancel --me # Cancel all your jobs
sacct -j <JOBID> --format=JobID,JobName,State,Elapsed,MaxRSS,ExitCode

Workflow Summary

  1. Compose a job script with #SBATCH directives and the workload command.
  2. Submit the script with sbatch <script>.sh, or run a command directly with srun.
  3. Monitor active jobs with squeue --me.
  4. Review completed jobs with sacct.

The directive block stays the same across job types. Only the workload command changes.