# How to run more than 2 parallel process

**URL:** <https://discuss.ray.io/t/how-to-run-more-than-2-parallel-process/4175>\
**Category:** Ray Core\
**Created:** [November 18, 2021, 2:47pm UTC](https://discuss.ray.io/t/how-to-run-more-than-2-parallel-process/4175 "2021-11-18T14:47:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xanthan](https://avatars.discourse-cdn.com/v4/letter/x/dfb087/32.png) [@xanthan](https://discuss.ray.io/u/xanthan)\
**Post date:** [November 18, 2021, 2:47pm UTC](https://discuss.ray.io/t/how-to-run-more-than-2-parallel-process/4175/1 "2021-11-18T14:47:05Z")

</div>

Hello Community!! I’m very new to Ray and I tried the basic example available on Github, on Google Colab and its GPU. I edited the code a bit to notice its working. Here the code:

```auto
#EXAMPLE OF RAY
import ray
ray.init()
import time
@ray.remote
def f(x):
    print(f"With Process {x}")
    time.sleep(10)
    return x * x

futures = [f.remote(i) for i in range(4)]
print(futures)
print(ray.get(futures))
ray.shutdown()

```

I noticed that at one particular time, only **two** parallel processes were running and others were waiting for them to finish.

I’m trying to run more than 2 parallel process.

Can anyone please give me a clue how to do it? Thanks in advance!!

---

<div class="post-metadata">

**Author:** ![samrogers226](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/samrogers226/32/580_2.png) [@samrogers226](https://discuss.ray.io/u/samrogers226)\
**Post date:** [November 18, 2021, 7:35pm UTC](https://discuss.ray.io/t/how-to-run-more-than-2-parallel-process/4175/2 "2021-11-18T19:35:48Z")

</div>

Hi @xanthan,

What does your dev environment look like? It is possible that you don’t have enough physical cores on your machine.

Try, setting it to 4 by using `ray.init(num_cpus=4)` (more info [here](https://docs.ray.io/en/latest/auto_examples/testing-tips.html#local-mode-tips))

Or, try reducing the cpu requirements for the task by using `@ray.remote(num_cpus=0.5)` - by default each task requires 1 cpu. More info [here](https://docs.ray.io/en/latest/package-ref.html?highlight=%40ray.remote#ray-remote).

Hope this helps!

---

<div class="post-metadata">

**Author:** ![xanthan](https://avatars.discourse-cdn.com/v4/letter/x/dfb087/32.png) [@xanthan](https://discuss.ray.io/u/xanthan)\
**Post date:** [November 19, 2021, 5:35am UTC](https://discuss.ray.io/t/how-to-run-more-than-2-parallel-process/4175/3 "2021-11-19T05:35:18Z")

</div>

hello @samrogers226 ,

> [@samrogers226](#):
>
> What does your dev environment look like?

I’m running the code on Google Colab.

> [@samrogers226](#):
>
> Try, setting it to 4 by using `ray.init(num_cpus=4)` (more info [here](https://docs.ray.io/en/latest/auto_examples/testing-tips.html#local-mode-tips))

I’m trying to run it on a GPU on Colab. But I still tried your code with `num_gpus` instead of `num_cpus` but it doesn’t seem to work

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [November 23, 2021, 3:34pm UTC](https://discuss.ray.io/t/how-to-run-more-than-2-parallel-process/4175/4 "2021-11-23T15:34:00Z")

</div>

@xanthan I believe we addressed this together in the slack channel. Would you mind sharing the conclusion?
