@@ -13,8 +13,9 @@ import ReverseDiff as RD # used in `pooling.jl`
13
13
14
14
DocMeta. setdocmeta! (NNlib, :DocTestSetup , :(using NNlib, UnicodePlots); recursive= true )
15
15
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
18
19
19
20
const rng = StableRNG (123 )
20
21
include (" test_utils.jl" )
@@ -49,138 +50,109 @@ function nnlib_testsuite(Backend; skip_tests = Set{String}())
49
50
end
50
51
end
51
52
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
57
54
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 )
66
59
end
67
- else
68
- @info " Skipping CUDA tests, set NNLIB_TEST_CUDA=true to run them."
69
- end
70
60
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)
89
62
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" )
99
66
end
100
- else
101
- @info " Skipping CUDA tests, set NNLIB_TEST_CUDA=true to run them"
102
- end
103
67
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" )
119
70
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
127
71
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
132
75
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
136
80
137
- @testset " Batched Multiplication " begin
138
- include (" batchedmul .jl" )
139
- end
81
+ @testset " CTC Loss " begin
82
+ include (" ctc .jl" )
83
+ end
140
84
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
145
88
146
- @testset " CTC Loss " begin
147
- include (" ctc .jl" )
148
- end
89
+ @testset " Fold/Unfold " begin
90
+ include (" fold .jl" )
91
+ end
149
92
150
- @testset " Dropout " begin
151
- include (" dropout .jl" )
152
- end
93
+ @testset " Inference " begin
94
+ include (" inference .jl" )
95
+ end
153
96
154
- @testset " Fold/Unfold " begin
155
- include (" fold .jl" )
156
- end
97
+ @testset " Pooling " begin
98
+ include (" pooling .jl" )
99
+ end
157
100
158
- @testset " Inference " begin
159
- include (" inference .jl" )
160
- end
101
+ @testset " Padding " begin
102
+ include (" padding .jl" )
103
+ end
161
104
162
- @testset " Pooling " begin
163
- include (" pooling .jl" )
164
- end
105
+ @testset " Softmax " begin
106
+ include (" softmax .jl" )
107
+ end
165
108
166
- @testset " Padding " begin
167
- include (" padding .jl" )
168
- end
109
+ @testset " Utilities " begin
110
+ include (" utils .jl" )
111
+ end
169
112
170
- @testset " Softmax " begin
171
- include (" softmax .jl" )
172
- end
113
+ @testset " Grid Sampling " begin
114
+ include (" sampling .jl" )
115
+ end
173
116
174
- @testset " Utilities" begin
175
- include (" utils.jl" )
117
+ @testset " Functions" begin
118
+ include (" functions.jl" )
119
+ end
176
120
end
121
+ else
122
+ @info " Skipping CPU tests, set NNLIB_TEST_CPU=true to run them."
123
+ end
177
124
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" )))
181
130
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."
184
154
end
155
+ else
156
+ @info " Skipping AMDGPU tests, set NNLIB_TEST_AMDGPU=true to run them."
185
157
end
186
158
end
0 commit comments