1
1
using ForwardDiff, Test, Random
2
+ using Pkg
3
+
4
+ const GROUP = get (ENV , " GROUP" , " All" )
5
+
6
+ function activate_gpu_env ()
7
+ Pkg. activate (" gpu" )
8
+ Pkg. develop (PackageSpec (path = dirname (@__DIR__ )))
9
+ Pkg. instantiate ()
10
+ end
2
11
3
12
SEED = trunc (Int, time ())
4
13
println (" ##### Random.seed!($SEED ), on VERSION == $VERSION " )
5
14
Random. seed! (SEED)
6
15
7
- @testset " ForwardDiff.jl" begin
8
- t0 = time ()
9
- @testset " Partials" begin
10
- println (" ##### Testing Partials..." )
11
- t = @elapsed include (" PartialsTest.jl" )
12
- println (" ##### done (took $t seconds)." )
13
- end
14
- @testset " Dual" begin
15
- println (" ##### Testing Dual..." )
16
- t = @elapsed include (" DualTest.jl" )
17
- println (" ##### done (took $t seconds)." )
18
- end
19
- @testset " Derivatives" begin
20
- println (" ##### Testing derivative functionality..." )
21
- t = @elapsed include (" DerivativeTest.jl" )
22
- println (" ##### done (took $t seconds)." )
23
- end
24
- @testset " Gradients" begin
25
- println (" ##### Testing gradient functionality..." )
26
- t = @elapsed include (" GradientTest.jl" )
27
- println (" ##### done (took $t seconds)." )
16
+ if GROUP == " All" || GROUP == " Core"
17
+ @testset " ForwardDiff.jl" begin
18
+ t0 = time ()
19
+ @testset " Partials" begin
20
+ println (" ##### Testing Partials..." )
21
+ t = @elapsed include (" PartialsTest.jl" )
22
+ println (" ##### done (took $t seconds)." )
23
+ end
24
+ @testset " Dual" begin
25
+ println (" ##### Testing Dual..." )
26
+ t = @elapsed include (" DualTest.jl" )
27
+ println (" ##### done (took $t seconds)." )
28
+ end
29
+ @testset " Derivatives" begin
30
+ println (" ##### Testing derivative functionality..." )
31
+ t = @elapsed include (" DerivativeTest.jl" )
32
+ println (" ##### done (took $t seconds)." )
33
+ end
34
+ @testset " Gradients" begin
35
+ println (" ##### Testing gradient functionality..." )
36
+ t = @elapsed include (" GradientTest.jl" )
37
+ println (" ##### done (took $t seconds)." )
38
+ end
39
+ @testset " Jacobians" begin
40
+ println (" ##### Testing jacobian functionality..." )
41
+ t = @elapsed include (" JacobianTest.jl" )
42
+ println (" ##### done (took $t seconds)." )
43
+ end
44
+ @testset " Hessians" begin
45
+ println (" ##### Testing hessian functionality..." )
46
+ t = @elapsed include (" HessianTest.jl" )
47
+ println (" ##### done (took $t seconds)." )
48
+ end
49
+ @testset " Perturbation Confusion" begin
50
+ println (" ##### Testing perturbation confusion functionality..." )
51
+ t = @elapsed include (" ConfusionTest.jl" )
52
+ println (" ##### done (took $t seconds)." )
53
+ end
54
+ @testset " Miscellaneous" begin
55
+ println (" ##### Testing miscellaneous functionality..." )
56
+ t = @elapsed include (" MiscTest.jl" )
57
+ println (" ##### done (took $t seconds)." )
58
+ end
59
+ @testset " Allocations" begin
60
+ println (" ##### Testing allocations..." )
61
+ t = @elapsed include (" AllocationsTest.jl" )
62
+ println (" ##### done (took $t seconds)." )
63
+ end
64
+ println (" ##### Running all ForwardDiff tests took $(time () - t0) seconds." )
28
65
end
29
- @testset " Jacobians" begin
30
- println (" ##### Testing jacobian functionality..." )
31
- t = @elapsed include (" JacobianTest.jl" )
32
- println (" ##### done (took $t seconds)." )
66
+ elseif GROUP == " CUDA"
67
+ @testset " ForwardDiff.jl CUDA" begin
68
+ activate_gpu_env ()
69
+ @testset " CUDA Gradients" begin
70
+ println (" ##### Testing CUDA gradients..." )
71
+ t = @elapsed include (" CUDAGradientTest.jl" )
72
+ println (" ##### done (took $t seconds)." )
73
+ end
74
+ @testset " CUDA Jacobians" begin
75
+ println (" ##### Testing CUDA Jacobians..." )
76
+ t = @elapsed include (" CUDAJacobianTest.jl" )
77
+ println (" ##### done (took $t seconds)." )
78
+ end
33
79
end
34
- @testset " Hessians" begin
35
- println (" ##### Testing hessian functionality..." )
36
- t = @elapsed include (" HessianTest.jl" )
37
- println (" ##### done (took $t seconds)." )
38
- end
39
- @testset " Perturbation Confusion" begin
40
- println (" ##### Testing perturbation confusion functionality..." )
41
- t = @elapsed include (" ConfusionTest.jl" )
42
- println (" ##### done (took $t seconds)." )
43
- end
44
- @testset " Miscellaneous" begin
45
- println (" ##### Testing miscellaneous functionality..." )
46
- t = @elapsed include (" MiscTest.jl" )
47
- println (" ##### done (took $t seconds)." )
48
- end
49
- @testset " Allocations" begin
50
- println (" ##### Testing allocations..." )
51
- t = @elapsed include (" AllocationsTest.jl" )
52
- println (" ##### done (took $t seconds)." )
53
- end
54
- println (" ##### Running all ForwardDiff tests took $(time () - t0) seconds." )
55
- end
80
+ end
0 commit comments