# SLURM manager: one node with multiple tasks

**URL:** <https://discourse.julialang.org/t/slurm-manager-one-node-with-multiple-tasks/124173>\
**Category:** General Usage\
**Tags:** slurm\
**Created:** [December 25, 2024, 9:53pm UTC](https://discourse.julialang.org/t/slurm-manager-one-node-with-multiple-tasks/124173 "2024-12-25T21:53:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kerim/32/37844_2.png) [@kerim](https://discourse.julialang.org/u/kerim)\
**Post date:** [December 25, 2024, 9:53pm UTC](https://discourse.julialang.org/t/slurm-manager-one-node-with-multiple-tasks/124173/1 "2024-12-25T21:53:10Z")

</div>

Hi,

I have access to a single node with many 24 cores. I want Julia to treat that node as 4 workers with 6 cores per each worker.

My attempt is:

```julia
using Distributed, ClusterManagers

addprocs(SlurmManager(1), nodes=1, ntasks_per_node=4, cpus_per_task=6)

@info "STARTED"

hosts = []
pids = []
for i in workers()
	host, pid = fetch(@spawnat i (gethostname(), getpid()))
    @info "host: $host"
    @info "pid: $pid"
	push!(hosts, host)
	push!(pids, pid)
end

# The Slurm resource allocation is released when all the workers have
# exited
for i in workers()
	rmprocs(i)
end

```

but I can see that only one worker is running.

Maybe I do something wrong?

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [December 26, 2024, 6:43pm UTC](https://discourse.julialang.org/t/slurm-manager-one-node-with-multiple-tasks/124173/2 "2024-12-26T18:43:53Z")

</div>

I would think you need to submit four separate,6 core jobs.  
Or one 24 core job.

If I am not understanding the aim please make it a bit more clear what you want to achieve

---

<div class="post-metadata">

**Author:** ![kerim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kerim/32/37844_2.png) [@kerim](https://discourse.julialang.org/u/kerim)\
**Post date:** [December 28, 2024, 11:45am UTC](https://discourse.julialang.org/t/slurm-manager-one-node-with-multiple-tasks/124173/3 "2024-12-28T11:45:25Z")

</div>

Hi,

Thank you for response.

After several days of playng with Distributed I have found that there is at least two options to work with SLURM:

1. [ClusterManagers.jl](https://github.com/JuliaParallel/ClusterManagers.jl) package that implements `SRUN`
2. [SlurmClusterManager.jl](https://github.com/kleinhenz/SlurmClusterManager.jl/tree/master) package that works with `SBATCH` i.e. we create sbatch script file and julia script.

With `ClusterManagers` the biggest problem was is that there was only one minute to allocate all nodes otherwise an error appear. I couldn’t overcome this so I stopped working with it. Also we can’t use `SRUN --export` argument as Julia treats `export` as directive instead of an argument to a function.

And with `SlurmClusterManager` everything looks good to me except information about progress from workers get written to file very rare. I don’t know why and how but the output file gets updated maybe once in hour even if the output information comes ones in 5 seconds probably. That disappoints me because it is hard to see the progress but can’t find a workaround yet.

> [@johnh](#):
>
> If I am not understanding the aim please make it a bit more clear what you want to achieve

I can say that with `SlurmClusterManager` I solve my initial task with `run.sbatch` script like:

```julia
#!/bin/bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4
#SBATCH --cpus-per-task=6

julia my_script.jl

```
