> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Why does my exclusive Slurm job use only one CPU core?

`srun --exclusive` gives your job the whole node, but when the same `srun` command also starts the job step and you set `--ntasks`, Slurm limits the step to the CPUs those tasks request. With `--ntasks=1`, the step has one task, and Slurm allocates one CPU per task by default, so the step runs on a single core and every other core on the node sits idle. CPU-heavy work in the step, such as compiling code or reading and writing data, slows down to what one core can do.

To give the step every CPU on the node, remove `--ntasks=1` or add `--cpus-per-task`.

## What you see

A job started with a command like the following runs slowly, and tools such as `top` show one core busy while the rest are idle:

```bash theme={"system"}
srun --nodes=1 --ntasks=1 --exclusive --pty /bin/bash
```

`scontrol show job` shows that the job holds every CPU on the node (`AllocTRES=cpu=128` on an H100 node) and requested one CPU per task (`CPUs/Task=1`, `ReqTRES=cpu=1`). These fields describe the job, not the step, and they don't change after you remove `--ntasks=1`. To see what the step can use, check its CPU affinity inside the job. It lists only the two hardware threads of a single core instead of the whole node:

```bash theme={"system"}
# Show the CPUs the current shell can run on.
grep Cpus_allowed_list /proc/self/status
```

```text title="Example output" theme={"system"}
Cpus_allowed_list:	0,64
```

## How to fix it

Choose one of the following options:

* **Remove `--ntasks=1`.** This is the simplest fix. Without it, the step can use every CPU in the node allocation.

  ```bash theme={"system"}
  srun --nodes=1 --exclusive --pty /bin/bash
  ```

* **Set `--cpus-per-task` to the node's CPU count.** Use this option if your workflow requires `--ntasks=1`. Replace `[CPU-COUNT]` with the value of `CPUTot` from `scontrol show node [NODE]`, for example `128` on an H100 node:

  ```bash theme={"system"}
  srun --nodes=1 --ntasks=1 --cpus-per-task=[CPU-COUNT] --exclusive --pty /bin/bash
  ```

After you apply either option, run `grep Cpus_allowed_list /proc/self/status` again inside the job. The list should cover every CPU on the node, for example `0-127`.

Don't use `nproc` to check the result. If `OMP_NUM_THREADS` is set in the job environment, `nproc` reports that value instead of the CPUs the step can run on. For more information, see [Verify the binding worked](/products/sunk/optimize_workloads/cpu-binding-numa-affinity#verify-the-binding-worked).

For the full behavior of these options, see [`--exclusive`](https://slurm.schedmd.com/srun.html#OPT_exclusive) and [`--cpus-per-task`](https://slurm.schedmd.com/srun.html#OPT_cpus-per-task) in the Slurm `srun` documentation.

<Badge stroke shape="pill" color="blue" size="md">[Workload Scheduling](/support/sunk/tags/workload-scheduling)</Badge>
