Skip to content

Commit 83df642

Browse files
Simplify runtests.jl (#531)
* cl/test * reinstate cpu tests on CUDA worker
1 parent 1b30040 commit 83df642

File tree

4 files changed

+110
-136
lines changed

4 files changed

+110
-136
lines changed

.buildkite/pipeline.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ steps:
1414
queue: "juliagpu"
1515
cuda: "*"
1616
env:
17-
NNLIB_TEST_CUDA: true
17+
NNLIB_TEST_CUDA: "true"
18+
NNLIB_TEST_CPU: "false"
1819
if: build.message !~ /\[skip tests\]/
19-
timeout_in_minutes: 60
20+
timeout_in_minutes: 180
2021
matrix:
2122
setup:
2223
julia:
@@ -47,10 +48,11 @@ steps:
4748
JULIA_AMDGPU_CORE_MUST_LOAD: "1"
4849
JULIA_AMDGPU_HIP_MUST_LOAD: "1"
4950
JULIA_AMDGPU_DISABLE_ARTIFACTS: "1"
50-
NNLIB_TEST_AMDGPU: true
51+
NNLIB_TEST_AMDGPU: "true"
52+
NNLIB_TEST_CPU: "true" # Could be useful to uncover multithreading related issues
53+
# Buildkite workers have more threads.
5154
JULIA_NUM_THREADS: 4
5255

53-
5456
- label: "Benchmarks"
5557
plugins:
5658
- JuliaCI/julia#v1:

Project.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,23 @@ GPUArraysCore = "0.1"
3535
KernelAbstractions = "0.9.2"
3636
Requires = "1.0"
3737
julia = "1.9"
38+
39+
[extras]
40+
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
41+
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
42+
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
43+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
44+
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
45+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
46+
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
47+
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
48+
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
49+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
50+
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
51+
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
52+
cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd"
53+
54+
[targets]
55+
test = ["AMDGPU", "CUDA", "ChainRulesTestUtils", "Documenter",
56+
"FiniteDifferences", "ForwardDiff", "Logging", "ReverseDiff",
57+
"StableRNGs", "Test", "UnicodePlots", "Zygote", "cuDNN"]

test/Project.toml

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/runtests.jl

Lines changed: 84 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import ReverseDiff as RD # used in `pooling.jl`
1313

1414
DocMeta.setdocmeta!(NNlib, :DocTestSetup, :(using NNlib, UnicodePlots); recursive=true)
1515

16-
ENV["NNLIB_TEST_CUDA"] = true # uncomment to run CUDA tests
17-
# ENV["NNLIB_TEST_AMDGPU"] = true # uncomment to run AMDGPU tests
16+
# ENV["NNLIB_TEST_CUDA"] = "true" # uncomment to run CUDA tests
17+
# ENV["NNLIB_TEST_AMDGPU"] = "true" # uncomment to run AMDGPU tests
18+
# ENV["NNLIB_TEST_CPU"] = "false" # uncomment to skip CPU tests
1819

1920
const rng = StableRNG(123)
2021
include("test_utils.jl")
@@ -49,138 +50,109 @@ function nnlib_testsuite(Backend; skip_tests = Set{String}())
4950
end
5051
end
5152

52-
@testset "NNlib.jl" verbose=true begin
53-
@testset verbose=true "Test Suite" begin
54-
@testset "CPU" begin
55-
nnlib_testsuite(CPU)
56-
end
53+
@testset verbose=true "NNlib.jl" begin
5754

58-
if get(ENV, "NNLIB_TEST_CUDA", "false") == "true"
59-
using CUDA
60-
if CUDA.functional()
61-
@testset "CUDABackend" begin
62-
nnlib_testsuite(CUDABackend; skip_tests=Set(("Scatter", "Gather")))
63-
end
64-
else
65-
@info "CUDA.jl is not functional. Skipping test suite for CUDABackend."
55+
if get(ENV, "NNLIB_TEST_CPU", "true") == "true"
56+
@testset "CPU" begin
57+
@testset "Doctests" begin
58+
doctest(NNlib, manual=false)
6659
end
67-
else
68-
@info "Skipping CUDA tests, set NNLIB_TEST_CUDA=true to run them."
69-
end
7060

71-
if get(ENV, "NNLIB_TEST_AMDGPU", "false") == "true"
72-
import Pkg
73-
test_info = Pkg.project()
74-
Pkg.develop("AMDGPU")
75-
76-
using AMDGPU
77-
if AMDGPU.functional()
78-
@testset "ROCBackend" begin
79-
nnlib_testsuite(ROCBackend)
80-
AMDGPU.synchronize(; blocking=false)
81-
end
82-
else
83-
@info "AMDGPU.jl is not functional. Skipping test suite for ROCBackend."
84-
end
85-
else
86-
@info "Skipping AMDGPU tests, set NNLIB_TEST_AMDGPU=true to run them."
87-
end
88-
end
61+
nnlib_testsuite(CPU)
8962

90-
@testset verbose=true "Tests" begin
91-
if get(ENV, "NNLIB_TEST_CUDA", "false") == "true"
92-
using CUDA
93-
if CUDA.functional()
94-
@testset "CUDA" begin
95-
include("ext_cuda/runtests.jl")
96-
end
97-
else
98-
@info "Insufficient version or CUDA not found; Skipping CUDA tests"
63+
@testset "Activation Functions" begin
64+
include("activations.jl")
65+
include("bias_act.jl")
9966
end
100-
else
101-
@info "Skipping CUDA tests, set NNLIB_TEST_CUDA=true to run them"
102-
end
10367

104-
if get(ENV, "NNLIB_TEST_AMDGPU", "false") == "true"
105-
import Pkg
106-
test_info = Pkg.project()
107-
Pkg.develop("AMDGPU")
108-
109-
using AMDGPU
110-
AMDGPU.versioninfo()
111-
if AMDGPU.functional() && AMDGPU.functional(:MIOpen)
112-
@show AMDGPU.MIOpen.version()
113-
@testset "AMDGPU" begin
114-
include("ext_amdgpu/runtests.jl")
115-
AMDGPU.synchronize(; blocking=false)
116-
end
117-
else
118-
@info "AMDGPU.jl package is not functional. Skipping AMDGPU tests."
68+
@testset "Attention" begin
69+
include("attention.jl")
11970
end
120-
else
121-
@info "Skipping AMDGPU tests, set NNLIB_TEST_AMDGPU=true to run them."
122-
end
123-
124-
@testset "Doctests" begin
125-
doctest(NNlib, manual=false)
126-
end
12771

128-
@testset "Activation Functions" begin
129-
include("activations.jl")
130-
include("bias_act.jl")
131-
end
72+
@testset "Batched Multiplication" begin
73+
include("batchedmul.jl")
74+
end
13275

133-
@testset "Attention" begin
134-
include("attention.jl")
135-
end
76+
@testset "Convolution" begin
77+
include("conv.jl")
78+
include("conv_bias_act.jl")
79+
end
13680

137-
@testset "Batched Multiplication" begin
138-
include("batchedmul.jl")
139-
end
81+
@testset "CTC Loss" begin
82+
include("ctc.jl")
83+
end
14084

141-
@testset "Convolution" begin
142-
include("conv.jl")
143-
include("conv_bias_act.jl")
144-
end
85+
@testset "Dropout" begin
86+
include("dropout.jl")
87+
end
14588

146-
@testset "CTC Loss" begin
147-
include("ctc.jl")
148-
end
89+
@testset "Fold/Unfold" begin
90+
include("fold.jl")
91+
end
14992

150-
@testset "Dropout" begin
151-
include("dropout.jl")
152-
end
93+
@testset "Inference" begin
94+
include("inference.jl")
95+
end
15396

154-
@testset "Fold/Unfold" begin
155-
include("fold.jl")
156-
end
97+
@testset "Pooling" begin
98+
include("pooling.jl")
99+
end
157100

158-
@testset "Inference" begin
159-
include("inference.jl")
160-
end
101+
@testset "Padding" begin
102+
include("padding.jl")
103+
end
161104

162-
@testset "Pooling" begin
163-
include("pooling.jl")
164-
end
105+
@testset "Softmax" begin
106+
include("softmax.jl")
107+
end
165108

166-
@testset "Padding" begin
167-
include("padding.jl")
168-
end
109+
@testset "Utilities" begin
110+
include("utils.jl")
111+
end
169112

170-
@testset "Softmax" begin
171-
include("softmax.jl")
172-
end
113+
@testset "Grid Sampling" begin
114+
include("sampling.jl")
115+
end
173116

174-
@testset "Utilities" begin
175-
include("utils.jl")
117+
@testset "Functions" begin
118+
include("functions.jl")
119+
end
176120
end
121+
else
122+
@info "Skipping CPU tests, set NNLIB_TEST_CPU=true to run them."
123+
end
177124

178-
@testset "Grid Sampling" begin
179-
include("sampling.jl")
180-
end
125+
if get(ENV, "NNLIB_TEST_CUDA", "false") == "true"
126+
using CUDA
127+
if CUDA.functional()
128+
@testset "CUDA" begin
129+
nnlib_testsuite(CUDABackend; skip_tests=Set(("Scatter", "Gather")))
181130

182-
@testset "Functions" begin
183-
include("functions.jl")
131+
include("ext_cuda/runtests.jl")
132+
end
133+
else
134+
@info "Insufficient version or CUDA not found; Skipping CUDA tests"
135+
end
136+
else
137+
@info "Skipping CUDA tests, set NNLIB_TEST_CUDA=true to run them"
138+
end
139+
140+
if get(ENV, "NNLIB_TEST_AMDGPU", "false") == "true"
141+
using AMDGPU
142+
AMDGPU.versioninfo()
143+
if AMDGPU.functional() && AMDGPU.functional(:MIOpen)
144+
@show AMDGPU.MIOpen.version()
145+
@testset "AMDGPU" begin
146+
nnlib_testsuite(ROCBackend)
147+
AMDGPU.synchronize(; blocking=false)
148+
149+
include("ext_amdgpu/runtests.jl")
150+
AMDGPU.synchronize(; blocking=false)
151+
end
152+
else
153+
@info "AMDGPU.jl package is not functional. Skipping AMDGPU tests."
184154
end
155+
else
156+
@info "Skipping AMDGPU tests, set NNLIB_TEST_AMDGPU=true to run them."
185157
end
186158
end

0 commit comments

Comments
 (0)