Skip to content

Commit 5297f31

Browse files
authored
Choose parallel tests based on CPUs, not threads. (#1842)
1 parent 1aa3e6b commit 5297f31

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/runtests.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,20 @@ if do_help
4444
--list List all available tests.
4545
--thorough Don't allow skipping tests that are not supported.
4646
--quickfail Fail the entire run as soon as a single test errored.
47-
--jobs=N Launch `N` processes to perform tests (default: Threads.nthreads()).
47+
--jobs=N Launch `N` processes to perform tests (default: Sys.CPU_THREADS).
4848
--gpus=N Expose `N` GPUs to test processes (default: 1).
4949
--sanitize[=tool] Run the tests under `compute-sanitizer`.
5050
--snoop=FILE Snoop on compiled methods and save to `FILE`.
5151
5252
Remaining arguments filter the tests that will be executed.""")
5353
exit(0)
5454
end
55-
set_jobs, jobs = extract_flag!(ARGS, "--jobs", Threads.nthreads())
55+
set_jobs, jobs = extract_flag!(ARGS, "--jobs", Sys.CPU_THREADS)
5656
do_sanitize, sanitize_tool = extract_flag!(ARGS, "--sanitize", "memcheck")
5757
do_snoop, snoop_path = extract_flag!(ARGS, "--snoop")
5858
do_thorough, _ = extract_flag!(ARGS, "--thorough")
5959
do_quickfail, _ = extract_flag!(ARGS, "--quickfail")
6060

61-
if !set_jobs && jobs == 1
62-
@warn """You are running the CUDA.jl test suite with only a single thread; this will take a long time.
63-
Consider launching Julia with `--threads auto` to run tests in parallel."""
64-
end
65-
6661
include("setup.jl") # make sure everything is precompiled
6762
_, gpus = extract_flag!(ARGS, "--gpus", ndevices())
6863

@@ -180,6 +175,8 @@ picks = reverse(candidates[end-gpus+1:end]) # best GPU first
180175
ENV["CUDA_VISIBLE_DEVICES"] = join(map(pick->"$(pick.mig ? "MIG" : "GPU")-$(pick.uuid)", picks), ",")
181176
@info "Testing using $(length(picks)) device(s): " * join(map(pick->"$(pick.id). $(pick.name) (UUID $(pick.uuid))", picks), ", ")
182177

178+
@info "Running $jobs tests in parallel. If this is too many, specify the `--jobs` argument to the tests, or set the JULIA_CPU_THREADS environment variable."
179+
183180
# determine tests to skip
184181
skip_tests = []
185182
has_cusolvermg() || push!(skip_tests, "cusolver/multigpu")

0 commit comments

Comments
 (0)