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
28using AdvancedHMC
39using AdvancedHMC: DualValue, PhasePoint
410using CUDA
@@ -22,31 +28,24 @@ using CUDA
2228 samples, stats = sample (hamiltonian, proposal, θ₀, n_samples)
2329end
2430
25- #=
26- Broken! See https://github.com/JuliaTesting/ReTest.jl/issues/50
2731@testset " PhasePoint GPU" begin
2832 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
5049
5150 z1 = init_z1 ()
5251 z2 = init_z2 ()
@@ -55,4 +54,3 @@ Broken! See https://github.com/JuliaTesting/ReTest.jl/issues/50
5554 @test z1. ℓκ. value == z2. ℓκ. value
5655 end
5756end
58- =#
0 commit comments