diff --git a/test/enzyme.jl b/test/enzyme.jl index 08552352..b000c937 100644 --- a/test/enzyme.jl +++ b/test/enzyme.jl @@ -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") diff --git a/test/runtests.jl b/test/runtests.jl index 1d764265..94d14ffa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 diff --git a/test/sparse_jacobian.jl b/test/sparse_jacobian.jl index 349ea980..b8a22259 100644 --- a/test/sparse_jacobian.jl +++ b/test/sparse_jacobian.jl @@ -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) diff --git a/test/sparse_jacobian_nls.jl b/test/sparse_jacobian_nls.jl index 55d4af10..cecb05f9 100644 --- a/test/sparse_jacobian_nls.jl +++ b/test/sparse_jacobian_nls.jl @@ -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)