# Run Pkg.test with several processors

**URL:** <https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917>\
**Category:** Julia at Scale\
**Created:** [November 6, 2017, 9:14pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917 "2017-11-06T21:14:33Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [November 6, 2017, 9:14pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/1 "2017-11-06T21:14:33Z")

</div>

I have tests that use several processors. If I run `julia -p 4` and then `Pkg.test` I only get `1` as a `worker`.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [November 7, 2017, 6:55am UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/2 "2017-11-07T06:55:45Z")

</div>

For now, you have to handroll your parallellization (see [https://github.com/JuliaStats/Distributions.jl/blob/master/test/runtests.jl](https://github.com/JuliaStats/Distributions.jl/blob/master/test/runtests.jl)). There’s been some work towards exposing the test infrastructure that Base uses to run the tests to packages, but it isn’t ready yet (and might not happen).

---

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [October 12, 2018, 1:26pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/3 "2018-10-12T13:26:49Z")

</div>

Looking at either the link you provide or my CPU load, it does not seem that the tests run in parallel?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 12, 2018, 2:25pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/4 "2018-10-12T14:25:36Z")

</div>

Sorry, what is your question?

---

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [October 12, 2018, 2:30pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/5 "2018-10-12T14:30:26Z")

</div>

If the link is correct? I guess the link is supposed to point to a test suite that runs in parallel? Was there maybe an old version of Distributions, with parallel test suite?

---

<div class="post-metadata">

**Author:** ![Wikunia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wikunia/32/2180_2.png) [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Post date:** [October 12, 2018, 2:34pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/6 "2018-10-12T14:34:46Z")

</div>

You can have a look at our solver:  
[https://github.com/lanl-ansi/Juniper.jl](https://github.com/lanl-ansi/Juniper.jl)

Unfortunately currently only properly working in julia v0.6 but that part should be the same

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 12, 2018, 2:40pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/7 "2018-10-12T14:40:52Z")

</div>

> [@jw3126](#):
>
> Looking at either the link you provide or my CPU load, it does not seem that the tests run in parallel?

Yeah, it was removed in [no parallel · JuliaStats/Distributions.jl@84d6b39 · GitHub](https://github.com/JuliaStats/Distributions.jl/commit/84d6b39c3ccb014b6753909a4e1ef60f9339edbb#diff-fce720c43af3c52c862fd7451c7374b8). I should have linked to the file at a specific commmit.

---

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [October 12, 2018, 2:42pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/8 "2018-10-12T14:42:27Z")

</div>

Do you know why it was removed? Is it fragile, does it produce bad error messages? I experimented with similar things as in `Distributions.jl`, but it was always fragile.

---

<div class="post-metadata">

**Author:** ![jw3126](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jw3126/32/3086_2.png) [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Post date:** [October 12, 2018, 2:43pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/9 "2018-10-12T14:43:44Z")

</div>

Okay thanks. I am looking for something different however. Very much like the situation in `Distributions.jl`. Run many `include("test_foo.jl")` in parallel.

---

<div class="post-metadata">

**Author:** ![felipenoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felipenoris/32/553_2.png) [@felipenoris](https://discourse.julialang.org/u/felipenoris)\
**Post date:** [March 9, 2020, 8:08pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/10 "2020-03-09T20:08:34Z")

</div>

As of Julia v1.3 , is there any example on running test sets in parallel, maybe with multi-threading?

---

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [June 5, 2020, 3:49am UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/11 "2020-06-05T03:49:47Z")

</div>

On my machine, running

```julia
cd("$your_pkg_path")
c:\bin\Julia-1.3.1\bin\julia -p auto -e "include(raw\"test\runtests.jl\")"

```

leads to those ressources usage

BEFORE EXE

 ![before](https://global.discourse-cdn.com/julialang/original/3X/0/8/087fa7cb635fa362fea89e88737bdf9408307557.jpeg)

and

DURING EXE

 ![during](https://global.discourse-cdn.com/julialang/original/3X/e/3/e30a393c1de5fcf15721243d9a7c32d5377274ec.jpeg)

It seems test run on all my available cores.  
That’s left to tell how we can repro it inside the atom IDE…

---

<div class="post-metadata">

**Author:** ![danielsoutar](https://avatars.discourse-cdn.com/v4/letter/d/e480ec/32.png) [@danielsoutar](https://discourse.julialang.org/u/danielsoutar)\
**Post date:** [January 4, 2022, 5:20pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/12 "2022-01-04T17:20:51Z")

</div>

Following on from @felipenoris 's question, is there an update on this for Julia 1.6 or 1.7?

---

<div class="post-metadata">

**Author:** ![Sheemon7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sheemon7/32/10277_2.png) [@Sheemon7](https://discourse.julialang.org/u/Sheemon7)\
**Post date:** [February 26, 2022, 9:54am UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/13 "2022-02-26T09:54:43Z")

</div>

It would be nice to have an option to run tests in parallel with interface similar to how precompilation is done from 1.6 onwards.

---

<div class="post-metadata">

**Author:** ![xtalax](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xtalax/32/35293_2.png) [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Post date:** [March 30, 2022, 12:46pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/14 "2022-03-30T12:46:09Z")

</div>

Strong agree, would speed up my iteration a lot.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [February 28, 2023, 10:09pm UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/15 "2023-02-28T22:09:02Z")

</div>

Same here

---

<div class="post-metadata">

**Author:** ![xgdgsc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xgdgsc/32/608_2.png) [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Post date:** [August 21, 2023, 8:42am UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/16 "2023-08-21T08:42:57Z")

</div>

Any usable solution now?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [August 21, 2023, 9:48am UTC](https://discourse.julialang.org/t/run-pkg-test-with-several-processors/6917/17 "2023-08-21T09:48:50Z")

</div>

ReTest.jl or TestItemRunner.jl are two working solutions
