The slots keyword lets you schedule jobs on the host with the fewest free slots first. This feature is useful for people who want to pack sequential jobs onto hosts with the least slots first, ensuring that more hosts will be available to run parallel jobs. slots (unused slots) is supported in the select[] and order[] sections of the resource requirement string.
slots is the number of unused slots on the host defined according to these values from bhosts for the host:
slots (Unused slots) = MAX – NJOBS
where NJOBS = RUN + SSUSP + USUSP + RSV
maxslots is the maximum number of slots that can be used on a host according to the value from bhosts for the host.
maxslots (max slot) = MAX
where MAX is the value of the “MAX” column that is displayed by bhosts
maxslots is supported in the select[], order[] and same[] sections of the resource requirement string.
You can specify slots in the order string. In the following example for reversed slots based ordering, hostA and hostB have 20 total slots each. There are currently no jobs in cluster. Then,
job1: bsub -n 10 sleep 10000 - runs on hostA
job2: bsub -n 1 sleep 10000 - might run on hostB
job3: bsub -n 20 sleep 10000 - will pend
If job2 runs on hostB, we can get a situation where job3, a large parallel job, never has a chance to run because neither host has 20 slots available. Essentially, job2 blocks job3 from running. However, with order[-slots]:
job1: bsub -n 10 -R “order[-slots]” sleep 10000 - runs on hostA
job2: bsub -n 1 -R “order[-slots]” sleep 10000 - will run on hostA
job3: bsub -n 20 -R “order[-slots]” sleep 10000 - will run on hostB
With reversed slots based ordering, job2 will run on hostA because hostA has the least available slots at this time (10 available versus 20 available for hostB). This allows job3 to run on hostB.
You can also specify maxslots in the order string. In the following example for reversed order on maxslots, hostA has 20 total slots, but hostB only has 10 slots in total, and currently no jobs in the cluster. Then,
job1: bsub -n 10 sleep 10000 - might run on hostA
job2: bsub -n 20 sleep 10000 - will pend
After job1 runs, both hostA and hostB have 10 available slots. Thus, job2 will pend (this is true with or without order[-slots]). However, with order[-maxslots]:
job1: bsub -n 10 -R “order[-maxslots]” sleep 10000 - will run on hostB
job2: bsub -n 20 -R “order[-maxslots]” sleep 10000 - will run on hostA
With reversed maxslots based order, job1 will run on hostB because it has fewer total slots than hostA. This saves hostA for the larger parallel job like job2.
You can have the combined effect of reverse ordering with slots and maxslots by using order[-slots:maxslots].