# Train with RLlib using multiple CPU with slrum

**URL:** <https://discuss.ray.io/t/train-with-rllib-using-multiple-cpu-with-slrum/7931>\
**Category:** Configure Algorithm, Training, Evaluation, Scaling\
**Created:** [October 18, 2022, 2:42pm UTC](https://discuss.ray.io/t/train-with-rllib-using-multiple-cpu-with-slrum/7931 "2022-10-18T14:42:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrigoo](https://avatars.discourse-cdn.com/v4/letter/g/a8b319/32.png) [@gabrigoo](https://discuss.ray.io/u/gabrigoo)\
**Post date:** [October 18, 2022, 2:42pm UTC](https://discuss.ray.io/t/train-with-rllib-using-multiple-cpu-with-slrum/7931/1 "2022-10-18T14:42:18Z")

</div>

Hello,

I have been trying to use a cluster to train some of my RL environments a bit faster than on my 8 cores computer.

I am using slrum to decide on the resources I need for the training, i.e.

_srun --partition=short --export=ALL --nodes=1 --ntasks=1 --cpus-per-task=8 --mem=100G --time=00:30:00 --pty /bin/bash_

This usually assigns me 48 cores; therefore, I would expect a big increase in training speed compared to my 8 cores computer. However, the opposite happens when training becomes extremely slow.

These are the configurations I am using for ray:

config[‘framework’] = ‘tf2’  
config[‘eager\_tracing’] = True  
config[‘num\_workers’] = num\_processes #from multiprocessing.cpu\_count()  
config[‘num\_cpus\_per\_worker’] = 0  
config[‘seed’] = seed  
config[‘log\_level’] = ‘ERROR’

with

ray.init(num\_cpus=multiprocessing.cpu\_count(), ignore\_reinit\_error=True, log\_to\_driver=False)

For reference I am using a PPO trainer

---

<div class="post-metadata">

**Author:** ![arturn](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/arturn/32/2096_2.png) [@arturn](https://discuss.ray.io/u/arturn)\
**Post date:** [November 30, 2022, 7:54pm UTC](https://discuss.ray.io/t/train-with-rllib-using-multiple-cpu-with-slrum/7931/2 "2022-11-30T19:54:05Z")

</div>

`num_cpus_per_worker` should be 1, otherwise all workers will share the CPU of the driver and make things super slow.
