1
- using ReTest
1
+ using Pkg
2
+ Pkg. activate (@__DIR__ )
3
+ Pkg. develop (; path= joinpath (@__DIR__ , " .." , " .." ))
4
+
5
+ include (joinpath (@__DIR__ , " .." , " common.jl" ))
6
+
7
+ using Test
2
8
using AdvancedHMC
3
9
using AdvancedHMC: DualValue, PhasePoint
4
10
using CUDA
@@ -22,31 +28,24 @@ using CUDA
22
28
samples, stats = sample (hamiltonian, proposal, θ₀, n_samples)
23
29
end
24
30
25
- #=
26
- Broken! See https://github.com/JuliaTesting/ReTest.jl/issues/50
27
31
@testset " PhasePoint GPU" begin
28
32
for T in [Float32, Float64]
29
- init_z1() = PhasePoint(
30
- CuArray([T(NaN) T(NaN)]),
31
- CuArray([T(NaN) T(NaN)]),
32
- DualValue(CuArray(zeros(T, 2)), CuArray(zeros(T, 1, 2))),
33
- DualValue(CuArray(zeros(T, 2)), CuArray(zeros(T, 1, 2))),
34
- )
35
- init_z2() = PhasePoint(
36
- CuArray([T(Inf) T(Inf)]),
37
- CuArray([T(Inf) T(Inf)]),
38
- DualValue(CuArray(zeros(T, 2)), CuArray(zeros(T, 1, 2))),
39
- DualValue(CuArray(zeros(T, 2)), CuArray(zeros(T, 1, 2))),
40
- )
41
-
42
- @test_logs (
43
- :warn,
44
- "The current proposal will be rejected due to numerical error(s).",
45
- ) init_z1()
46
- @test_logs (
47
- :warn,
48
- "The current proposal will be rejected due to numerical error(s).",
49
- ) init_z2()
33
+ function init_z1 ()
34
+ return PhasePoint (
35
+ CuArray ([T (NaN ) T (NaN )]),
36
+ CuArray ([T (NaN ) T (NaN )]),
37
+ DualValue (CuArray (zeros (T, 2 )), CuArray (zeros (T, 1 , 2 ))),
38
+ DualValue (CuArray (zeros (T, 2 )), CuArray (zeros (T, 1 , 2 ))),
39
+ )
40
+ end
41
+ function init_z2 ()
42
+ return PhasePoint (
43
+ CuArray ([T (Inf ) T (Inf )]),
44
+ CuArray ([T (Inf ) T (Inf )]),
45
+ DualValue (CuArray (zeros (T, 2 )), CuArray (zeros (T, 1 , 2 ))),
46
+ DualValue (CuArray (zeros (T, 2 )), CuArray (zeros (T, 1 , 2 ))),
47
+ )
48
+ end
50
49
51
50
z1 = init_z1 ()
52
51
z2 = init_z2 ()
@@ -55,4 +54,3 @@ Broken! See https://github.com/JuliaTesting/ReTest.jl/issues/50
55
54
@test z1. ℓκ. value == z2. ℓκ. value
56
55
end
57
56
end
58
- =#
0 commit comments