A.7. Cray, SLURM, and ALPS

An alternate scheduler in the Cray Linux Environment is SLURM. In this environment, you typically write a batch script and submit it with the sbatch command. The script invokes the ALPS tool aprun to launch your binary across the cluster.

The same considerations as outlined in Section A.6, “Cray, Torque PBS, and ALPS” apply to parameters for the aprun and sample command.

[Note]Note

Sample file replacement token %r does not expand to a meaningful value on this platform. Please use %h-%p instead.

The proper way to launch a Freja sampling in a Cray Linux Environment with SLURM and ALPS is to create a batch file:

my-job.sbatch:

    #!/bin/bash -l
    #
    #SBATCH --job-name="my-job"
    #SBATCH --time=00:05:00
    #SBATCH --nodes=2
    #SBATCH --ntasks-per-node=32
    #SBATCH --mem-per-cpu=1024
    #SBATCH --output=my-job.%j.o
    #SBATCH --error=my-job.%j.e
    #======START=====
    module load slurm

    # set PATH to include the Freja bin directory
    PATH=$PATH:installation_directory/bin

    echo "The current job ID is $SLURM_JOB_ID"
    echo "Running on $SLURM_NNODES nodes"
    echo "Using $SLURM_NTASKS_PER_NODE tasks per node"
    echo "A total of $SLURM_NPROCS tasks is used"
    aprun -b -n $SLURM_NPROCS sample -g 1 -o my-job-samplefiles/%h-%p.smp \
          -r ./my-job arg1 arg 2
    #=====END====

and invoke this script using:

$ sbatch my-job.sbatch

Sample files appear in directory my-job-samplefiles.