Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Nov 27, 2024
1 parent f053ea6 commit f91eb20
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
7 changes: 7 additions & 0 deletions test/enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,10 @@ include("nlp/basic.jl")
include("nls/basic.jl")
include("nlp/nlpmodelstest.jl")
include("nls/nlpmodelstest.jl")

const test_enzyme = true

include("sparse_jacobian.jl")
include("sparse_jacobian_nls.jl")
# include("sparse_hessian.jl")
# include("sparse_hessian_nls.jl")
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ using ADNLPModels, ManualNLPModels, NLPModels, NLPModelsModifiers, NLPModelsTest
using ADNLPModels:
gradient, gradient!, jacobian, hessian, Jprod!, Jtprod!, directional_second_derivative, Hvprod!

const test_enzyme = false

@testset "Test sparsity pattern of Jacobian and Hessian" begin
f(x) = sum(x .^ 2)
c(x) = x
Expand Down
10 changes: 6 additions & 4 deletions test/sparse_jacobian.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
list_sparse_jac_backend =
((ADNLPModels.SparseADJacobian, Dict()),
(ADNLPModels.SparseEnzymeADJacobian, Dict()),
(ADNLPModels.ForwardDiffADJacobian, Dict()))
if test_enzyme
list_sparse_jac_backend = ((ADNLPModels.SparseEnzymeADJacobian, Dict()),)
else
list_sparse_jac_backend = ((ADNLPModels.SparseADJacobian, Dict()),
(ADNLPModels.ForwardDiffADJacobian, Dict()))
end

dt = (Float32, Float64)

Expand Down
10 changes: 6 additions & 4 deletions test/sparse_jacobian_nls.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
list_sparse_jac_backend =
((ADNLPModels.SparseADJacobian, Dict()),
(ADNLPModels.SparseEnzymeADJacobian, Dict()),
(ADNLPModels.ForwardDiffADJacobian, Dict()))
if test_enzyme
list_sparse_jac_backend = ((ADNLPModels.SparseEnzymeADJacobian, Dict()),)
else
list_sparse_jac_backend = ((ADNLPModels.SparseADJacobian, Dict()),
(ADNLPModels.ForwardDiffADJacobian, Dict()))
end

dt = (Float32, Float64)

Expand Down

0 comments on commit f91eb20

Please sign in to comment.