Skip to content

Commit 8ae1003

Browse files
authored
Try to get the Mooncake & Enzyme tests to consistently pass (#293)
* Actually seed the RNG properly for reproducible tests * Wrapper for eig_vals to prevent FD related resorting explosions * Add explanatory comment * Handle eigval sorting for trunctol * Make the new trunctol stuff Mooncake safe
1 parent d5dd6fa commit 8ae1003

18 files changed

Lines changed: 152 additions & 79 deletions

File tree

‎test/testsuite/ad_utils.jl‎

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,57 @@ test in-place Hermitian eigendecomposition rules via Mooncake's non-primitive AD
5959
"""
6060
eigh!_wrapper(f!, A, alg) = (F = f!(project_hermitian!(A), alg); MatrixAlgebraKit.zero!(A); F)
6161

62+
"""
63+
eig_vals_wrapper(f, A, alg)
64+
65+
Wrapper that sorts the eigenvalues returned by `f(A, alg)` by modulus and then by imaginary part.
66+
LAPACK's ordering of the eigenvalues can change discontinuously under small perturbations of
67+
`A`, which breaks finite-difference checks. The ordering imposed here is smooth for matrices
68+
built with `make_eig_matrix`, whose eigenvalues have distinct moduli up to conjugate pairs.
69+
"""
70+
eig_vals_wrapper(f, A, alg) = sort_eigvals(f(A, alg))
71+
72+
"""
73+
eig_vals!_wrapper(f!, A, alg)
74+
75+
In-place variant of [`eig_vals_wrapper`](@ref), which zeros `A` after calling `f!`.
76+
"""
77+
eig_vals!_wrapper(f!, A, alg) = sort_eigvals(call_and_zero!(f!, A, alg))
78+
79+
"""
80+
eig_trunc_wrapper(f, A, alg)
81+
82+
Wrapper that sorts the eigenpairs returned by `f(A, alg)` (`(D, V)` or `(D, V, ϵ)`) by
83+
modulus and then by imaginary part of the eigenvalues. Truncation by value keeps the retained
84+
eigenpairs in LAPACK's ordering, which can change discontinuously under small perturbations
85+
of `A` and breaks finite-difference checks; see [`eig_vals_wrapper`](@ref).
86+
"""
87+
eig_trunc_wrapper(f, A, alg) = sort_eig_trunc(f(A, alg))
88+
89+
"""
90+
eig_trunc!_wrapper(f!, A, alg)
91+
92+
In-place variant of [`eig_trunc_wrapper`](@ref), which zeros `A` after calling `f!`.
93+
"""
94+
eig_trunc!_wrapper(f!, A, alg) = sort_eig_trunc(call_and_zero!(f!, A, alg))
95+
96+
# sortperm is used here because Mooncake CAN differentiate that on CUDA,
97+
# but CANNOT differentiate sort
98+
eigvals_sortperm(D) = sortperm(collect(D); by = λ -> (abs(λ), imag(λ)))
99+
sort_eigvals(D) = D[eigvals_sortperm(D)]
100+
101+
# reorder `(D, V, rest...)` (or its tangent) by the permutation `p` of the eigenvalues
102+
permute_eigpairs(DV, p) = (Diagonal(diagview(DV[1])[p]), permute_columns(DV[2], p), Base.tail(Base.tail(DV))...)
103+
104+
# equivalent to `V[:, p]`, but written with linear indexing because Mooncake CAN differentiate
105+
# that on CUDA, but CANNOT differentiate `V[:, p]`
106+
function permute_columns(V, p)
107+
m = size(V, 1)
108+
lin = vec((1:m) .+ m .* (p' .- 1))
109+
return reshape(vec(V)[lin], m, length(p))
110+
end
111+
sort_eig_trunc(DV) = permute_eigpairs(DV, eigvals_sortperm(diagview(DV[1])))
112+
62113
"""
63114
qr_gauge_invariant_wrapper(f, A, alg, r)
64115
@@ -149,11 +200,27 @@ function stabilize_eigvals!(D::AbstractVector)
149200
n = maximum(p)
150201
# rescale eigenvalues so that they lie on distinct radii in the complex plane
151202
# that are chosen randomly in non-overlapping intervals [10 * k/n, 10 * (k+0.5)/n)] for k=1,...,n
152-
radii = 10 .* ((1:n) .+ rand(real(eltype(D)), n) ./ 2) ./ n
203+
radii = 10 .* ((1:n) .+ rand(rng, real(eltype(D)), n) ./ 2) ./ n
153204
hD = sign.(collect(D)) .* radii[p]
154205
copyto!(D, hD)
155206
return D
156207
end
208+
"""
209+
midgap_tol(vals)
210+
211+
Return a truncation tolerance halfway across the widest gap between consecutive values of
212+
`abs.(vals)`, restricted to the middle half so that truncation keeps a nontrivial subset.
213+
This keeps the number of retained values fixed under the perturbations used by
214+
finite-difference checks.
215+
"""
216+
function midgap_tol(vals)
217+
s = sort!(collect(abs.(vals)))
218+
n = length(s)
219+
gaps = (max(1, n ÷ 4)):(min(n - 1, (3n) ÷ 4))
220+
_, i = findmax(i -> s[i + 1] - s[i], gaps)
221+
return (s[gaps[i]] + s[gaps[i] + 1]) / 2
222+
end
223+
157224
function make_eig_matrix(T, sz)
158225
A = instantiate_matrix(T, sz)
159226
D, V = eig_full(A)

‎test/testsuite/chainrules.jl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ function test_chainrules_eigh(
442442
@test isequal(ΔDVtrunc, ΔDVtrunc_copy)
443443
end
444444
D, ΔD = ad_eigh_vals_setup(A / 2)
445-
truncalg = TruncatedAlgorithm(alg, trunctol(; atol = maximum(abs, D) / 2))
445+
truncalg = TruncatedAlgorithm(alg, trunctol(; atol = midgap_tol(eigh_vals(A))))
446446
DV, DVtrunc, ΔDV, ΔDVtrunc = ad_eigh_trunc_setup(A, truncalg)
447447
ind = MatrixAlgebraKit.findtruncated(diagview(DV[1]), truncalg.trunc)
448448
ot = (ΔDVtrunc..., zero(real(T)))
@@ -601,7 +601,7 @@ function test_chainrules_svd(
601601
@test isequal(ΔUSVᴴtrunc, ΔUSVᴴtrunc_copy)
602602
end
603603
S, ΔS = ad_svd_vals_setup(A)
604-
truncalg = TruncatedAlgorithm(alg, trunctol(atol = S[1, 1] / 2))
604+
truncalg = TruncatedAlgorithm(alg, trunctol(atol = midgap_tol(S)))
605605
USVᴴ, _, ΔUSVᴴ, ΔUSVᴴtrunc = ad_svd_trunc_setup(A, truncalg)
606606
ot = (ΔUSVᴴtrunc..., zero(real(T)))
607607
ot_copy = deepcopy(ot)
@@ -625,7 +625,7 @@ function test_chainrules_svd(
625625
dA1 = MatrixAlgebraKit.svd_pullback!(zero(A), A, USVᴴ, ΔUSVᴴtrunc, ind)
626626
dA2 = MatrixAlgebraKit.svd_trunc_pullback!(zero(A), A, (Utrunc, Strunc, Vᴴtrunc), ΔUSVᴴtrunc)
627627
@test isapprox(dA1, dA2; atol = atol, rtol = rtol)
628-
trunc = trunctol(; atol = S[1, 1] / 2)
628+
trunc = truncalg.trunc
629629
ind = MatrixAlgebraKit.findtruncated(diagview(S), trunc)
630630
ot = (ΔUSVᴴtrunc..., zero(real(T)))
631631
ot_copy = deepcopy(ot)

‎test/testsuite/enzyme/eig.jl‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Test the Enzyme foward- and reverse-mode AD rule for `eig_full` and its in-place
1919
"""
2020
function test_enzyme_eig_full(
2121
T, sz;
22-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
22+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
2323
fdm = enzyme_fdm(T)
2424
)
2525
return @testset "eig_full: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -40,17 +40,17 @@ Test the Enzyme forward- and reverse-mode AD rule for `eig_vals` and its in-plac
4040
"""
4141
function test_enzyme_eig_vals(
4242
T, sz;
43-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
43+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
4444
fdm = enzyme_fdm(T)
4545
)
4646
return @testset "eig_vals: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
4747
A = make_eig_matrix(T, sz)
4848
alg = MatrixAlgebraKit.select_algorithm(eig_vals, A)
4949
D, ΔD = ad_eig_vals_setup(A)
50-
test_reverse(eig_vals, RT, (A, TA), (alg, Const); atol, rtol, output_tangent = ΔD, fdm)
51-
test_reverse(call_and_zero!, RT, (eig_vals!, Const), (copy(A), TA), (alg, Const); atol, rtol, output_tangent = ΔD, fdm)
52-
test_forward(eig_vals, RT, (A, TA), (alg, Const); atol, rtol, fdm)
53-
test_forward(call_and_zero!, RT, (eig_vals!, Const), (copy(A), TA), (alg, Const); atol, rtol, fdm)
50+
test_reverse(eig_vals_wrapper, RT, (eig_vals, Const), (A, TA), (alg, Const); atol, rtol, output_tangent = ΔD, fdm)
51+
test_reverse(eig_vals!_wrapper, RT, (eig_vals!, Const), (copy(A), TA), (alg, Const); atol, rtol, output_tangent = ΔD, fdm)
52+
test_forward(eig_vals_wrapper, RT, (eig_vals, Const), (A, TA), (alg, Const); atol, rtol, fdm)
53+
test_forward(eig_vals!_wrapper, RT, (eig_vals!, Const), (copy(A), TA), (alg, Const); atol, rtol, fdm)
5454
end
5555
end
5656

@@ -62,7 +62,7 @@ in-place variants, over a range of truncation ranks and a tolerance-based trunca
6262
"""
6363
function test_enzyme_eig_trunc(
6464
T, sz;
65-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
65+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
6666
fdm = enzyme_fdm(T)
6767
)
6868
return @testset "eig_trunc reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -83,14 +83,16 @@ function test_enzyme_eig_trunc(
8383
@testset "trunctol" begin
8484
A = make_eig_matrix(T, sz)
8585
D = eig_vals(A)
86-
trunc = trunctol(atol = maximum(abs, D) / 2; by = abs)
86+
trunc = trunctol(atol = midgap_tol(D); by = abs)
8787
truncalg = TruncatedAlgorithm(alg, trunc)
88-
DV, _, ΔDV, ΔDVtrunc = ad_eig_trunc_setup(A, truncalg)
89-
test_reverse(eig_trunc_no_error, RT, (A, TA), (truncalg, Const); atol, rtol, output_tangent = ΔDVtrunc, fdm)
90-
test_reverse(call_and_zero!, RT, (eig_trunc_no_error!, Const), (copy(A), TA), (truncalg, Const); atol, rtol, output_tangent = ΔDVtrunc, fdm)
88+
DV, DVtrunc, ΔDV, ΔDVtrunc = ad_eig_trunc_setup(A, truncalg)
89+
# trunctol keeps LAPACK's eigenvalue ordering, so sort the outputs (and the tangent)
90+
ΔDVtrunc = permute_eigpairs(ΔDVtrunc, eigvals_sortperm(diagview(DVtrunc[1])))
91+
test_reverse(eig_trunc_wrapper, RT, (eig_trunc_no_error, Const), (A, TA), (truncalg, Const); atol, rtol, output_tangent = ΔDVtrunc, fdm)
92+
test_reverse(eig_trunc!_wrapper, RT, (eig_trunc_no_error!, Const), (copy(A), TA), (truncalg, Const); atol, rtol, output_tangent = ΔDVtrunc, fdm)
9193
# use max range here to try to dodge issues when the gap between eigenvalues is close to the FD perturbation
92-
test_forward(eig_trunc_no_error, RT, (A, TA), (truncalg, Const); atol, rtol, fdm = EnzymeTestUtils.FiniteDifferences.central_fdm(5, 1, max_range = 1.0e-3))
93-
test_forward(call_and_zero!, RT, (eig_trunc_no_error!, Const), (copy(A), TA), (truncalg, Const); atol, rtol, fdm = EnzymeTestUtils.FiniteDifferences.central_fdm(5, 1, max_range = 1.0e-3))
94+
test_forward(eig_trunc_wrapper, RT, (eig_trunc_no_error, Const), (A, TA), (truncalg, Const); atol, rtol, fdm = EnzymeTestUtils.FiniteDifferences.central_fdm(5, 1, max_range = 1.0e-3))
95+
test_forward(eig_trunc!_wrapper, RT, (eig_trunc_no_error!, Const), (copy(A), TA), (truncalg, Const); atol, rtol, fdm = EnzymeTestUtils.FiniteDifferences.central_fdm(5, 1, max_range = 1.0e-3))
9496
end
9597
end
9698
end

‎test/testsuite/enzyme/eigh.jl‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Test the Enzyme forward- and reverse-mode AD rule for `eigh_full` and its in-pla
1919
"""
2020
function test_enzyme_eigh_full(
2121
T, sz;
22-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
22+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
2323
fdm = enzyme_fdm(T)
2424
)
2525
return @testset "eigh_full: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -40,7 +40,7 @@ Test the Enzyme forward- and reverse-mode AD rule for `eigh_vals` and its in-pla
4040
"""
4141
function test_enzyme_eigh_vals(
4242
T, sz;
43-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
43+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
4444
fdm = enzyme_fdm(T)
4545
)
4646
return @testset "eigh_vals: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -62,7 +62,7 @@ in-place variants, over a range of truncation ranks.
6262
"""
6363
function test_enzyme_eigh_trunc(
6464
T, sz;
65-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
65+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
6666
fdm = enzyme_fdm(T)
6767
)
6868
return @testset "eigh_trunc reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -82,8 +82,8 @@ function test_enzyme_eigh_trunc(
8282
end
8383
@testset "trunctol" begin
8484
A = make_eigh_matrix(T, sz)
85-
D = eigh_vals(A / 2, alg)
86-
trunc = trunctol(; atol = maximum(abs, D) / 2)
85+
D = eigh_vals(A, alg)
86+
trunc = trunctol(; atol = midgap_tol(D))
8787
truncalg = TruncatedAlgorithm(alg, trunc)
8888
DV, _, ΔDV, ΔDVtrunc = ad_eigh_trunc_setup(A, truncalg)
8989
test_reverse(eigh_wrapper, RT, (eigh_trunc_no_error, Const), (A, TA), (truncalg, Const); atol, rtol, output_tangent = ΔDVtrunc, fdm)

‎test/testsuite/enzyme/lq.jl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end
1515

1616
function test_enzyme_lq_compact(
1717
T::Type, sz;
18-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
18+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
1919
fdm = enzyme_fdm(T)
2020
)
2121
return @testset "lq_compact: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -31,7 +31,7 @@ end
3131

3232
function test_enzyme_lq_compact_rank_deficient(
3333
T::Type, sz;
34-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
34+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
3535
fdm = enzyme_fdm(T)
3636
)
3737
return @testset "lq_compact rank deficient A: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -52,7 +52,7 @@ end
5252

5353
function test_enzyme_lq_full(
5454
T::Type, sz;
55-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
55+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
5656
fdm = enzyme_fdm(T)
5757
)
5858
return @testset "lq_full reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -70,7 +70,7 @@ end
7070

7171
function test_enzyme_lq_null(
7272
T::Type, sz;
73-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
73+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
7474
fdm = enzyme_fdm(T)
7575
)
7676
return @testset "lq_null reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)

‎test/testsuite/enzyme/orthnull.jl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ algorithms, and their in-place variants.
2222
"""
2323
function test_enzyme_left_orth(
2424
T, sz;
25-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
25+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
2626
fdm = enzyme_fdm(T)
2727
)
2828
return @testset "left_orth reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -61,7 +61,7 @@ algorithms, and their in-place variants.
6161
"""
6262
function test_enzyme_right_orth(
6363
T, sz;
64-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
64+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
6565
fdm = enzyme_fdm(T)
6666
)
6767
return @testset "right_orth reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -99,7 +99,7 @@ in-place variant.
9999
"""
100100
function test_enzyme_left_null(
101101
T, sz;
102-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
102+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
103103
fdm = enzyme_fdm(T)
104104
)
105105
return @testset "left_null: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -124,7 +124,7 @@ in-place variant.
124124
"""
125125
function test_enzyme_right_null(
126126
T, sz;
127-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
127+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
128128
fdm = enzyme_fdm(T)
129129
)
130130
return @testset "right_null: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)

‎test/testsuite/enzyme/polar.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Only runs for tall or square matrices (`m >= n`).
1919
"""
2020
function test_enzyme_left_polar(
2121
T, sz;
22-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T)
22+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T)
2323
)
2424
return @testset "left_polar: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
2525
A = instantiate_matrix(T, sz)
@@ -44,7 +44,7 @@ Only runs for wide or square matrices (`m <= n`).
4444
"""
4545
function test_enzyme_right_polar(
4646
T, sz;
47-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T)
47+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T)
4848
)
4949
return @testset "right_polar: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
5050
A = instantiate_matrix(T, sz)

‎test/testsuite/enzyme/projections.jl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Test the Enzyme forward- and reverse-mode AD rule for `project_hermitian` and it
1919
"""
2020
function test_enzyme_project_hermitian(
2121
T, sz;
22-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
22+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
2323
fdm = enzyme_fdm(T)
2424
)
2525
return @testset "project_hermitian: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -42,7 +42,7 @@ Test the Enzyme forward- and reverse-mode AD rule for `project_antihermitian` an
4242
"""
4343
function test_enzyme_project_antihermitian(
4444
T, sz;
45-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
45+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
4646
fdm = enzyme_fdm(T)
4747
)
4848
return @testset "project_antihermitian: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)

‎test/testsuite/enzyme/qr.jl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ end
1515

1616
function test_enzyme_qr_compact(
1717
T::Type, sz;
18-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
18+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
1919
fdm = enzyme_fdm(T)
2020
)
2121
return @testset "qr_compact reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -31,7 +31,7 @@ end
3131

3232
function test_enzyme_qr_compact_rank_deficient(
3333
T::Type, sz;
34-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
34+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
3535
fdm = enzyme_fdm(T)
3636
)
3737
return @testset "qr_compact rank deficient A reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -52,7 +52,7 @@ end
5252

5353
function test_enzyme_qr_full(
5454
T::Type, sz;
55-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
55+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
5656
fdm = enzyme_fdm(T)
5757
)
5858
return @testset "qr_full reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)
@@ -70,7 +70,7 @@ end
7070

7171
function test_enzyme_qr_null(
7272
T::Type, sz;
73-
rng = Random.default_rng(), atol::Real = 0, rtol::Real = precision(T),
73+
rng = TestSuite.rng, atol::Real = 0, rtol::Real = precision(T),
7474
fdm = enzyme_fdm(T)
7575
)
7676
return @testset "qr_null reverse: RT $RT, TA $TA" for RT in (Duplicated,), TA in (Duplicated,)

0 commit comments

Comments
 (0)