Skip to content

Commit 6e15ab6

Browse files
authored
Default to testing with only a single device. (#2221)
1 parent 25fd692 commit 6e15ab6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/runtests.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if do_help
3434
--list List all available tests.
3535
--quickfail Fail the entire run as soon as a single test errored.
3636
--jobs=N Launch `N` processes to perform tests (default: Sys.CPU_THREADS).
37-
--gpu=1,2,... Which GPUs to use (comma-separated list of indices, default: all)
37+
--gpu=0,1,... Comma-separated list of GPUs to use (default: 0)
3838
--sanitize[=tool] Run the tests under `compute-sanitizer`.
3939
4040
Remaining arguments filter the tests that will be executed.""")
@@ -145,10 +145,11 @@ gpus = if do_gpu_list
145145
gpu_entry(CuDevice(id))
146146
end
147147
else
148-
# find all GPUs
149-
map(gpu_entry, devices())
148+
# pick the first non-exclusive GPU
149+
entries = map(gpu_entry, devices())
150+
filter!(entry->entry.compute_mode != CUDA.CU_COMPUTEMODE_PROHIBITED, entries)
151+
first(entries, 1)
150152
end
151-
filter!(gpu->gpu.compute_mode != CUDA.CU_COMPUTEMODE_PROHIBITED, gpus)
152153
@info("Testing using device " * join(map(gpu->"$(gpu.id) ($(gpu.name))", gpus), ", ", " and ") *
153154
". To change this, specify the `--gpus` argument to the tests, or set the `CUDA_VISIBLE_DEVICES` environment variable.")
154155
ENV["CUDA_VISIBLE_DEVICES"] = join(map(gpu->gpu.uuid, gpus), ",")

0 commit comments

Comments
 (0)