# Are julia -p x and addprocs(x) equivalent?

**URL:** <https://discourse.julialang.org/t/are-julia-p-x-and-addprocs-x-equivalent/86554>\
**Category:** Performance\
**Tags:** parallel, multithreading, distributed\
**Created:** [August 30, 2022, 3:04pm UTC](https://discourse.julialang.org/t/are-julia-p-x-and-addprocs-x-equivalent/86554 "2022-08-30T15:04:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![structural](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@structural](https://discourse.julialang.org/u/structural)\
**Post date:** [August 30, 2022, 3:04pm UTC](https://discourse.julialang.org/t/are-julia-p-x-and-addprocs-x-equivalent/86554/1 "2022-08-30T15:04:42Z")

</div>

I want to use multiple threads on multiple workers. Will the two sets of commands produce equivalent results?

```julia
export JULIA_NUM_THREADS=20
julia
addprocs(12)

```

```julia
export JULIA_NUM_THREADS=20
julia -p 12

```

---

<div class="post-metadata">

**Author:** ![Ashlin\_Harris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashlin_harris/32/210166_2.png) [@Ashlin\_Harris](https://discourse.julialang.org/u/Ashlin_Harris)\
**Post date:** [August 30, 2022, 7:08pm UTC](https://discourse.julialang.org/t/are-julia-p-x-and-addprocs-x-equivalent/86554/2 "2022-08-30T19:08:52Z")

</div>

Yes, I believe those are two ways to add 12 workers to the main process. You can check `nprocs()` to be sure.
