deepspeedai / deepspeedai/DeepSpeed
no slot '4' specified on local host - trying to use 4 gpus on a node with 8 gpus while another user is using the other 4 gpus
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 43.1k
- Forks
- 5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 112
Description
I am running a DeepSpeed training job on SLURM, requesting 4 GPUs on a shared node. SLURM correctly assigns my job GPUs 4,5,6,7, but DeepSpeed remaps them to 0,1,2,3, causing conflicts with another user’s job.
Error Message:
ValueError: No slot '4' specified on host 'localhost'
DeepSpeed misinterprets the physical GPU IDs as local device indices, leading to an out-of-range error. nvidia-smi confirms that my job is running on the wrong GPUs (0-3) instead of the assigned GPUs (4-7), causing resource conflicts.
SLURM Script Configuration:
#SBATCH --gres=gpu:h100:4
#SBATCH --mem=300G
#SBATCH --cpus-per-task=48
Before launching DeepSpeed, I set:
export CUDA_VISIBLE_DEVICES="$SLURM_JOB_GPUS"
echo "CUDA_VISIBLE_DEVICES: $CUDA_VISIBLE_DEVICES"
However, DeepSpeed still ignores this setting and remaps GPUs.
Troubleshooting Attempts:
-
Remapping
SLURM_JOB_GPUSto a Zero‐Indexed Listexport CUDA_VISIBLE_DEVICES=$(seq -s, 0 $((num_gpus - 1)))❌ Failure: DeepSpeed still assigned GPUs 0,1,2,3, conflicting with another user's job.
-
Setting
CUDA_VISIBLE_DEVICESDirectly toSLURM_JOB_GPUSexport CUDA_VISIBLE_DEVICES="$SLURM_JOB_GPUS"❌ Failure: DeepSpeed detected
CUDA_VISIBLE_DEVICES=4,5,6,7but ignored it, using--include=localhost:0,1,2,3instead. -
Explicitly Passing a Zero‐Indexed
--includeFlagdeepspeed --include=localhost:0,1,2,3❌ Failure: DeepSpeed still reassigned
CUDA_VISIBLE_DEVICES=0,1,2,3. -
Unsetting
SLURM_JOB_GPUSand Removing--includeunset SLURM_JOB_GPUS deepspeed --master_port $MASTER_PORT train.py --deepspeed ./scripts/config.json❌ Failure: DeepSpeed again reassigned
CUDA_VISIBLE_DEVICES=0,1,2,3.
Final Observations:
-
DeepSpeed Overrides
CUDA_VISIBLE_DEVICES
Even when explicitly set, DeepSpeed overridesCUDA_VISIBLE_DEVICESif any of the following flags are used:
--include,--exclude,--num_gpus,--num_nodes. -
DeepSpeed Reassigns GPUs Internally
DeepSpeed assumes GPUs should always be indexed 0,1,2,3, regardless of SLURM's physical GPU assignment, causing a mismatch. -
nvidia-smiConfirms GPU Conflict
My job (psy_llava) is running on the same GPUs as another job (python), despite SLURM allocating different GPUs. -
No Known Fix Has Worked
Every attempted fix (including removing--include) has failed to prevent DeepSpeed from overridingCUDA_VISIBLE_DEVICES.
This suggests a deeper issue with DeepSpeed's GPU initialization in SLURM-managed environments.
Seeking Help:
- How can I force DeepSpeed to respect SLURM’s GPU allocation and prevent it from overriding
CUDA_VISIBLE_DEVICES? - Are there any known DeepSpeed settings to prevent it from remapping GPUs?
- Is there a recommended way to ensure that DeepSpeed only runs on the GPUs explicitly assigned by SLURM?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the deepspeed launcher invocation and reproduce the SLURM setup using SLURM_JOB_GPUS, CUDA_VISIBLE_DEVICES, and --include. Trace how the launcher selects local devices and compare that with the reported No slot '4' error. Done means the job uses only SLURM-assigned GPUs without remapping or conflicts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, shell
- Domain
- devops, distributed-systems, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100