Slurm Interactive Shell - salloc
  1. Connect to the cluster via SSH
    1. Using Windows PowerShell or Command Prompt
      1. Enter the following in the terminal:

        ssh <user>@10.0.246.100

        Note: replace the <user> with your HLI username.

      2. When prompted, enter your HLI password
        If you have successfully logged in, you should see something similar:

    2. Using a SSH client (PuTTY)
      1. Open the SSH client and enter the IP address (10.0.246.100) in the “Host Name (or IP Address)” field, then click the “Open” button or press the “Enter” key

      2. Then enter your HLI username and password when prompted.
        If you have successfully logged in, you should see something similar:* Moving forward we will be only using and showing diagrams with PowerShell.
  2. Allocating Compute Resources

Before starting an analysis, running a script or interacting with the cluster, we need to reserve computer resources (CPUs, memory, time, etc.) on the cluster. This will ensure that the analysis pipeline or interactive sessions with the cluster will have enough resources to complete the task and do not monopolize limited shared computer resources.

Interactive sessions are great for testing and finalizing your analysis pipeline, but not for reproducibility and batch workflows.

We will use the “salloc” command, there are lots of other parameters that we can set but for now we will use the following:

– On the login node

salloc –node=1 –ntasks-per-node=1 –mem=4G –time=1:00:00

Let us explain the above parameters:

nodes: requested a minimum of compute nodes be allocated to this job

ntasks-per-node: request that ntasks be invoked on each node

mem: specify the real memory required per node

time: set a limit on the total run time of the job allocation

– After salloc successfully allocates resources, you will see the output indicating allocation.

– Then, in the same terminal, launch your interactive shell:

srun –pty bash -i

– You are now on a compute node. You can execute commands here.

hostname

– Output will show the name of the computer node

– When finished, exit the interactive shell

exit

– Then, exit the salloc session

exit

The “squeue” command will show information about jobs located in the Slurm scheduling queue. After “salloc” you can do a squeue command and it will show the resource allocation:

  1. Interactive and Non-interactive Job Submissions
    1. Preparing a script to run interactive mode:Create a file with the following content in the directory using a text editor of your choice. You can name it whatever you want, in this example it is called inter_test1.sh

       

      #!/bin/bash
      echo “—System Information—“
      echo “Hostname: $(hostname)”
      echo “Kernel Version: $(uname -r)”
      echo “Uptime: $(uptime -p)”
      echo “Current User: $(whoami)”
      echo “—————————“

      – To run the script


      bash inter_test1.sh

    2. Preparing a script for non-interactive job submission:

      For non-interactive job submission we do not need to do a “salloc” to request computer resources because it will be in the script file also know as a sbatch file. We will just use the “sbatch” command.You will see the same parameters that we used in the “salloc” command, in the top section (known as slurm directives section or SBATCH header lines) on the sbatch file.

      Create a file with the following content in the current directory using a text editor of your choice. You can name it whatever you want, in this example it is called non_inter_test1.sh

      #!/bin/bash
      #SBATCH –job-name=non_inter_test1    # Job name
      #SBATCH -o %N.%J.out                               # STDOUT
      #SBATCH -e %N.%j.err                                # STDERR
      #SBATCH –nodes=1                                    # number of nodes
      #SBATCH –cpus-per-task=1
      #SBATCH –mem=4G

      echo “— System Information —“
      sleep 10
      echo “Hostname: $(hostname)”
      sleep 10
      echo “Kernel Version: $(uname -r)”
      sleep 10
      echo “Uptime: $(uptime -p)”
      sleep 10
      echo “Current User: $(whoami)”
      sleep 10
      echo “—————————“

      – We will use the sbatch command to submit the job to the cluster

      sbatch non_inter_test.sh

      After  asuccessful submission, the job id will be displayed. You can use this job id to monitor the job’s status, check logs and job info, etc.

      – Check job status with “squeue”

      squeue