slurm is ignoring the --distribution=cyclic flag in my sbatch file and using the 'block' distribution method instead - slurm

I would like to distribute my job evenly across multiple nodes and have specified the --distribution=cyclic in my sbatch file, but slurm ignores that and uses the block distribution instead.
Before, the tasks were distributing evenly across the nodes. From reading the docs, this is what I expect the default behavior to be, unless otherwise specified in slurm.conf.
Starting today, the tasks are clustering on the first node with only one task on each of the other nodes. I've obviously changed something in the config, but can't figure out where to fix it. I did make a change to the image for the compute nodes and rebooted them today.
When I try to stop the slurmctld on the head node, it is restarted immediately by my Bright Cluster Manager monitor. Not sure if this is preventing configuration updates or not.
I've investigated the slurm.conf file but it looks OK. I've tried both SelectTypeParameters=CR_Core and CR_CPU but get the same result.
To try and work around this I added the --distribution=cyclic to my sbatch file, but slurm is still allocation using the 'block' method. But adding this to the sbatch should not be necessary, at leas according to my understanding of the docs.
Here are the relevant lines from slurm.conf and my sbatch script:
# RESOURCES
SelectType=select/cons_res
SelectTypeParameters=CR_Core
# Node Description
NodeName=DEFAULT Sockets=2 CoresPerSocket=20 ThreadsPerCore=1
# Scheduler
SchedulerType=sched/backfill
#SBATCH --ntasks=12
#SBATCH --nodes=3
#SBATCH --distribution=cyclic:cyclic
I would expect the tasks to be distributed evenly between the nodes, with 4 tasks on each of the 3 nodes.
Here is how the tasks are actually getting distributed:
NODELIST STATE CPUS(A/I/O/T) MEMORY TMP_DISK REASON
compute001 mixed 10/30/0/40 192006 2038 none
compute002 mixed 1/39/0/40 192006 2038 none
compute003 mixed 1/39/0/40 192006 2038 none
compute004 idle 0/40/0/40 192006 2038 none

According to https://slurm.schedmd.com/sbatch.html, the distribution flag is only useful for srun:
Specify alternate distribution methods for remote processes. In sbatch, this only sets environment variables that will be used by subsequent srun requests.
(As to why it's like this… I have no idea. But it does appear it's by design.)
Depending on your configuration, you may be able to approximate what you want by setting SelectType=cons_res or cons_tres and SelectTypeParameters=CR_LLN. If either of these parameters changed recently, that might be the reason the behavior changed, as well.

I managed to manually distribute my processes across the nodes by modifying the sbatch file to limit the number of tasks assigned to each node:
#SBATCH --ntasks=12
#SBATCH --nodes=3
#SBATCH --tasks-per-node=4
This results in the expected distribution of the tasks across the nodes:
NODELIST STATE CPUS(A/I/O/T) MEMORY TMP_DISK REASON
compute001 mixed 4/36/0/40 192027 2038 none
compute002 mixed 4/36/0/40 192027 2038 none
compute003 mixed 4/36/0/40 192027 2038 none
compute004 idle 0/40/0/40 192027 2038 none

Related

How to create a batch script, which submitts several jobs and allocates each of the this jobs on a separate node?

I am new to HPC and SLURM especially, and i ran into some troubles.
I was provided with acces to a HPC cluster with 32 CPUs on each node. In order to do the needed calculations I made 12 Python multiprocessing Scripts, where each Script uses excactly 32 CPU's.
How, instead of starting each Script manually in the interactive modus ( which is also an option btw. but it takes a lot of time) I decided to write a Batch Script in order to start all my 12 Scripts automatically.
//SCRIPT//
#!/bin/bash
#SBATCH --job-name=job_name
#SBATCH --partition=partition
#SBATCH --nodes=1
#SBATCH --time=47:59:59
#SBATCH --export=NONE
#SBATCH --array=1-12
module switch env env/system-gcc
module load python/3.8.5
source /home/user/env/bin/activate
python3.8 $HOME/Script_directory/Script$SLURM_ARRAY_TASK_ID.py
exit
//UNSCRIPT//
But as far as i understand, this script would start all of the Jobs from the Array on the same node and thus the underlying python scripts might start a "fight" for the available CPU's and thus slow down.
How should i modify my bash file in Order to start each task from the array on a separate node?
Thanks in advance!
This script will start 12 independent jobs, possibly on 12 distinct nodes at the same time, or all 12 in sequence on the same node or any other combination depending on the load of the cluster.
Each job will run the corresponding Script$SLURM_ARRAY_TASK_ID.py script. There will be no competition for resources.
Note that if nodes are shared in the cluster, you would add the --exclusive parameter to request whole nodes with their 32 CPUs.

Cores assigned to SLURM job

Let's say I want to submit a slurm job just assigning the total amount of tasks (--ntasks=someNumber), without specifying the number of nodes and the tasks per node. Is there a way to know within the launched slurm script how many cores are assigned by slurm for each of the reserved nodes? I need to know this info to properly create a machinefile for the program I'm launching, that must be structured like this:
node02:7
node06:14
node09:3
Once the job is launched, the only way I figured out to see what cores have been allocated on the nodes is using the command:
scontrol show jobid -dd
In its output the abovementioned info is stored (together with plenty of other details).
Is there a better way to get this info?
The way the srun documentation illustrates creating a machine file is by running srun hostname. To get the output you want you could run
srun hostname -s | sort | uniq -c | awk '{print $2":"$1}' > $MACHINEFILE
You should check the documentation of your program to see if it accepts a machine file with repetitions rather than a suffix count. If so you can simplify the command as
srun hostname -s > $MACHINEFILE
And of course the first step is actually to make sure you indeed need a machine file in the first place as many parallel programs/libraries have Slurm support and can gather the needed information from the environment variables setup by Slurm upon job start.

SLURM: Changing the maximum number of simultaneously running tasks for a running array job

I have set of an array job as follows:
sbatch --array=1:100%5 ...
which will limit the number of simultaneously running tasks to 5. The job is now running, and I would like to change this number to 10 (i.e. I wish I'd run sbatch --array=1:100%10 ...).
The documentation on array jobs mentions that you can use scontrol to change options after the job has started. Unfortunately, it's not clear what this option's variable name is, and I don't think it is listed in the documentation of the sbatch command here.
Any pointers well received.
You can change the array throttling limit with the following command:
scontrol update ArrayTaskThrottle=<count> JobId=<jobID>

SLURM job taking up entire node when using just one GPU

I am submitting multiple jobs to a SLURM queue. Each job uses 1 GPU. We have 4 GPUs per node. However once a job is running, it takes up the entire node, leaving 3 GPUs idle. Is there any way to avoid this, so that I can send multiple jobs to one node, using one GPU each?
My script looks like this:
#SLURM --gres=gpu:1
#SLURM --ntasks-per-node 1
#SLURM -p ghp-queue
myprog.exe
I was also unable to run multiple jobs on different GPUs. What helped was adding OverSubscribe=FORCE to the partition configuration in slurm.conf, like this:
PartitionName=compute Nodes=ALL ... OverSubscribe=FORCE
After that, I was able to run four jobs with --gres=gpu:1, and each one took a different GPU (a fifth job is queued, as expected).

Requesting specific nodes with TORQUE qsub?

There's a cluster with TORQUE qsub installed. I want to send a job, but I want to make sure that it runs on one of a specific set of nodes.
Is it possible to request a list of possible nodes in qsub, so that the job is sent to one of the nodes in the requested set, never to a node outside the set?
Using just TORQUE, the way to do this is to add a feature (or property) to each of the nodes in the set and add the feature as part of the job request. For example:
#nodes file entry
node01 fast np=32
# line in job script to request 2 'fast' nodes with 16 execution slots on each
#PBS -l nodes=2:fast:ppn=16
Depending on which scheduler you're using there may be easier ways to accomplish this task.

Resources