Skip to content

Unclear docs on settings threads on workers #109

@jishnub

Description

@jishnub

The interactive use section seems to suggest that the following would work:
Using

using ParallelTestRunner
using MyPackage

testsuite = Dict("threads"=>:(@show Threads.nthreads()))
args = parse_args(ARGS)
runtests(MyPackage, args; testsuite)

and calling

julia> Pkg.test("MyPackage", julia_args=`--threads=4`)

one should be able to enable multiple threads on the workers. However, this doesn't seem to be the case.

Running 1 tests in parallel. If this is too many, specify the `--jobs=N` argument to the tests, or set the `JULIA_CPU_THREADS` environment variable.
               │          │ ──────────────── CPU ──────────────── │
Test  (Worker) │ Time (s) │ GC (s) │ GC % │ Alloc (MB) │ RSS (MB) │
threads    (1) │     0.170.000.05.20409.45 │

Output generated during execution of 'threads':
[ Threads.nthreads() = 1

Test Summary: | Total   Time
  Overall     |     0  11.1s
    SUCCESS
     Testing MyPackage tests passed 

What does work is creating a custom worker using addworker(; exeflags = ["--threads=4"]), but ideally I don't want to create a worker per test. Is there a way to pass the number of threads to the default workers? It seems

push!(env, "JULIA_NUM_THREADS" => "1")
sets the number of threads to 1, and
wrkr = p = addworker(; init_worker_code, io_ctx.color)
doesn't pass exeflags. I would appreciate pointers on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions