Connect the SLURM cluster

This page finishes a cluster install. The installer already wrote the shared folders, listened on the network with login on, and asked the SLURM questions. What remains is authorizing the SSH key on the login node and running a test job, and that usually takes just a few minutes.

How the pieces fit

A quick picture first, so the rest of the page makes sense. The website runs on one machine, the web server. It connects over SSH to a SLURM login node and runs sbatch, squeue, and scancel there. Jobs run on the compute nodes, read and write the shared filesystem, and call the website back over HTTP at web.webhost.

The SSH connection is made as the account that runs the website: the service account on an administrator install, your own login on a regular-account install. Without linked users, sbatch also runs as that account and every job file is owned by it. With linked users (administrator installs only), the service account uses a small helper on the login node to run sbatch as the person who owns the project.

Host

What is there

Web server

The website, config.toml, the SSH key for the account that runs the website. sbatch is not needed here.

Login node(s)

sbatch on slurm.path. The account that runs the website can log in with the web server’s key. For linked users: the helper, the users group, and the sudoers drop-in from Request for the HPC team. Every address behind slurm.host needs them.

Compute nodes

The shared data and executables folders mounted at the same paths as on the web server, the scratch folder, and Apptainer. No helper.

Shared filesystem

PYP_SHARED_DATA and PYP_SHARED_EXEC, both at the same mount point on every machine above. On an administrator install the shared data folder is owned by the service account and the shared programs folder by an administrator; on a regular-account install both are owned by your login.

1. Check what the installer wrote

Let’s start by looking at what’s already in place. Run these three commands and see what they print:

cd ~/nextPYP
./nextpyp config get slurm.host
./nextpyp config get web.webhost
./nextpyp config get slurm.key
sudo nextpyp config get slurm.host
sudo nextpyp config get web.webhost
sudo nextpyp config get slurm.key

web.webhost is the URL of the website from a compute node. With remote access on a private network it is http:// plus the web server’s hostname and :8080. Behind the reverse proxy it is https:// plus the domain, with no port.

Tip

web.host and web.webhost look alike but do different jobs. web.host is the address the website binds to on the web server (0.0.0.0 for the network). web.webhost is the URL that jobs on the compute nodes use to connect back to it. If you changed the port with web.port, use that port in web.webhost.

If a value is empty, no problem: set it under Changing SLURM settings later and come back here.

2. Authorize the SSH key on the login node

The website needs an SSH key that the login node accepts without a password. You may already have one.

If the installer knew the login host (PYP_SLURM_HOST), it already created an ed25519 key for the account that runs the website, recorded the login node in known_hosts, and wrote slurm.key. It also added the public key to that account’s own authorized_keys on the web server. When the account’s home folder is on the shared filesystem and the login node reads ~/.ssh/authorized_keys from that same home, the login node already sees that key and needs no ssh-copy-id.

Otherwise create a key, then install the public key on the login node and test the connection. On a cluster with a central login system, SSO, or AuthorizedKeysCommand (keys stored in LDAP or another directory), ssh-copy-id into ~/.ssh/authorized_keys may have no effect. Ask your IT staff how to register an SSH public key for the service account (or your login, on a regular-account install) in that system, then re-run the ssh -o BatchMode=yes … sbatch --version check below.

ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
ssh-copy-id -i ~/.ssh/id_ed25519.pub "$USER"@slurm-login.myorganization.org
ssh -o BatchMode=yes "$USER"@slurm-login.myorganization.org sbatch --version

Note

Port 8080 is not opened by a regular-account install. Open it yourself if the machine filters it, or ask an administrator; compute nodes must reach the website on that port.

nextpyp is the default account name; the home directory is whatever getent passwd nextpyp shows.

sudo -u nextpyp -H ssh-keygen -t ed25519 -N "" -f ~nextpyp/.ssh/id_ed25519
sudo -u nextpyp -H ssh-copy-id -i ~nextpyp/.ssh/id_ed25519.pub nextpyp@slurm-login.myorganization.org
sudo -u nextpyp -H ssh -o BatchMode=yes nextpyp@slurm-login.myorganization.org sbatch --version

The sbatch --version command must print the SLURM version without asking for anything. If it asks for a password or a passphrase, the key isn’t set up yet, so fix that before moving on.

Note

RSA, ECDSA, and Ed25519 keys all work with nextPYP’s SSH client, so use whichever type your site prefers. The default for slurm.key is ~/.ssh/id_rsa; if your key is somewhere else (the installer’s own key is id_ed25519), set slurm.key to its path. slurm.user changes the account used on the login node; the default is the account that runs the website.

3. Test the configuration

After nextpyp restart, open the website, click your username in the upper right corner, and open the administration page (or change the URL to end in /#/admin). On the PYP tab, click PYP/WebRPC Ping. That submits a short job to the cluster and waits for the result. A pong response means the configuration works, and you’re done with the hard part.

If you see an error, a timeout, or no response, don’t worry. Look in this order:

  1. nextpyp logs micromon on the web server (with sudo on an administrator install): SSH errors appear here.

  2. shared/log on the shared filesystem: the job’s own output. A job that started but cannot reach the website logs the address it tried, which is web.webhost.

  3. nextpyp doctor: checks the helper and its sudo rule, that compute nodes can reach web.webhost, and the GPU settings. It does not look at known_hosts; the installer records the login host’s key when it creates the SSH key, and says so.

See troubleshooting for more.

GPUs on the compute nodes

nextpyp start passes GPU flags into the container when it finds a device:

  • NVIDIA (--nv): when nvidia-smi is on PATH, /dev/nvidia0 exists, or /proc/driver/nvidia exists. The installer records PYP_NV=true in install.env. Force with PYP_NV=true (or on); leave off with PYP_NV=false (or off).

  • AMD (--rocm): when rocm-smi is on PATH, /dev/kfd exists, or an AMD /dev/dri/renderD* node exists. The installer records PYP_ROCM=true. Force with PYP_ROCM=true; leave off with PYP_ROCM=false.

A cluster login node with no GPU device keeps today’s --nv on GPU jobs until PYP_ROCM=true is set; with both set, GPU jobs receive both flags.

Tip

Not sure the GPUs are visible from inside the container? nextpyp doctor --smoke runs nvidia-smi inside the compute container, and on an AMD machine checks that /dev/kfd is visible. When the NVIDIA check fails it prints PROBLEM: The compute container did not see the GPU.

Next: run jobs as each user

Your cluster is connected. Jobs now run there as the account that runs the website. On an administrator install, to run them as the person who owns the project, with their quotas and file permissions, continue with Run jobs as each OS user. That page covers the helper and sudoers drop-in on the login nodes, which is the part to hand to the cluster administrators as Request for the HPC team.

Changing SLURM settings later

Set or change web.webhost and the [slurm] keys by hand

Run these as the administrator who installed nextPYP, with sudo on an administrator install, or as ./nextpyp from the install folder on a regular-account install:

sudo nextpyp config set web.webhost http://nextpyp.internal.myorganization.org:8080
sudo nextpyp config set slurm.host slurm-login.myorganization.org
sudo nextpyp config set slurm.path /usr/bin
sudo nextpyp config set slurm.templatesDir /opt/nextpyp/templates
sudo nextpyp restart
slurm.host

The login node, as the web server reaches it. Omit it only when the web server itself runs sbatch (the installer’s PYP_SLURM_LOCAL=true). If slurm.host is a round-robin name, every address behind it needs the same files.

slurm.path

The folder that contains sbatch on the login node. SSH is non-interactive, so the login node’s shell startup files do not put sbatch on PATH. /usr/bin is the default.

slurm.templatesDir

The folder of SLURM submission templates. ./install places templates/default.peb in the install directory and the installer’s [slurm] section points there. The folder should be readable, not writable, by the account that runs the website. An install that does not have the file can download it from https://nextpyp.app/files/pyp/<version>/default.peb. Templates are how you add site-specific sbatch options, like an account or a QOS your site requires.

More than one login node, a different SSH user or port, and the other [slurm] keys are in the configuration reference. nextpyp config set accepts the keys that nextpyp config show lists, including slurm.key, slurm.port, and slurm.userSwitch; the rest, such as [[slurm.login]], are set with nextpyp config edit.

A workstation install keeps everything under one local storage folder that the compute nodes cannot see. To use a cluster from an existing workstation install, first move the shared folders onto a filesystem the nodes mount (Moving to another server), then set the values above. Otherwise install again with the Compute cluster tab on Install nextPYP.