Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test with Enzyme #429

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Lux = "b2108857-7c20-44ae-9111-449ecde12c47"
LuxCUDA = "d0bbae9a-e099-4d5b-a835-1c6931763bda"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -32,13 +31,12 @@ ComputationalResources = "0.3"
DataFrames = "1"
DifferentiationInterface = "0.1, 0.2, 0.3, 0.4, 0.5"
Distributions = "0.25"
ForwardDiff = "0.10"
Enzyme = "0.12"
GPUArraysCore = "0.1"
JET = "0.8, 0.9"
Lux = "0.5"
LuxCUDA = "0.3"
MLJBase = "1"
ReverseDiff = "1"
SciMLBase = "2"
TerminalLoggers = "0.1"
Zygote = "0.6"
Expand Down
35 changes: 16 additions & 19 deletions test/call_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ Test.@testset "Call Tests" begin
nvars_ = Int[2]
aug_steers = Bool[false, true]
inplaces = Bool[false, true]
adb_list = AbstractDifferentiation.AbstractBackend[
AbstractDifferentiation.ZygoteBackend(),
AbstractDifferentiation.ReverseDiffBackend(),
AbstractDifferentiation.ForwardDiffBackend(),
]
adtypes = ADTypes.AbstractADType[
ADTypes.AutoZygote(),
ADTypes.AutoReverseDiff(),
ADTypes.AutoForwardDiff(),
adb_list =
AbstractDifferentiation.AbstractBackend[AbstractDifferentiation.ZygoteBackend(),
# AbstractDifferentiation.ReverseDiffBackend(),
# AbstractDifferentiation.ForwardDiffBackend(),
]
adtypes = ADTypes.AbstractADType[ADTypes.AutoZygote(),
# ADTypes.AutoEnzyme(Enzyme.Forward),
# ADTypes.AutoEnzyme(Enzyme.Reverse),
# ADTypes.AutoReverseDiff(),
# ADTypes.AutoForwardDiff(),
]
compute_modes = ContinuousNormalizingFlows.ComputeMode[
ContinuousNormalizingFlows.ADVecJacVectorMode(
Expand All @@ -50,6 +51,10 @@ Test.@testset "Call Tests" begin
ContinuousNormalizingFlows.DIJacVecVectorMode(ADTypes.AutoZygote()),
ContinuousNormalizingFlows.DIVecJacMatrixMode(ADTypes.AutoZygote()),
ContinuousNormalizingFlows.DIJacVecMatrixMode(ADTypes.AutoZygote()),
# ContinuousNormalizingFlows.DIVecJacVectorMode(ADTypes.AutoEnzyme(Enzyme.Reverse)),
ContinuousNormalizingFlows.DIJacVecVectorMode(ADTypes.AutoEnzyme(Enzyme.Forward)),
# ContinuousNormalizingFlows.DIVecJacMatrixMode(ADTypes.AutoEnzyme(Enzyme.Reverse)),
ContinuousNormalizingFlows.DIJacVecMatrixMode(ADTypes.AutoEnzyme(Enzyme.Forward)),
]
data_types = Type{<:AbstractFloat}[Float32]
resources = ComputationalResources.AbstractResource[ComputationalResources.CPU1()]
Expand Down Expand Up @@ -226,11 +231,7 @@ Test.@testset "Call Tests" begin
Test.@testset "x" begin
Test.@test !isnothing(
AbstractDifferentiation.gradient(adb, diff2_loss, r),
) broken =
(GROUP != "All") &&
adb isa AbstractDifferentiation.ReverseDiffBackend &&
compute_mode isa ContinuousNormalizingFlows.MatrixMode &&
VERSION >= v"1.10"
)
end
end
end
Expand All @@ -244,11 +245,7 @@ Test.@testset "Call Tests" begin
Test.@testset "x" begin
Test.@test !isnothing(
DifferentiationInterface.gradient(diff2_loss, adtype, r),
) broken =
(GROUP != "All") &&
adtype isa ADTypes.AutoReverseDiff &&
compute_mode isa ContinuousNormalizingFlows.MatrixMode &&
VERSION >= v"1.10"
)
end
end
end
Expand Down
13 changes: 9 additions & 4 deletions test/fit_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ Test.@testset "Fit Tests" begin
nvars_ = Int[2]
aug_steers = Bool[false, true]
inplaces = Bool[false, true]
adtypes = ADTypes.AbstractADType[
ADTypes.AutoZygote(),
ADTypes.AutoReverseDiff(),
ADTypes.AutoForwardDiff(),
adtypes = ADTypes.AbstractADType[ADTypes.AutoZygote(),
# ADTypes.AutoEnzyme(Enzyme.Forward),
# ADTypes.AutoEnzyme(Enzyme.Reverse),
# ADTypes.AutoReverseDiff(),
# ADTypes.AutoForwardDiff(),
]
compute_modes = ContinuousNormalizingFlows.ComputeMode[
ContinuousNormalizingFlows.ADVecJacVectorMode(
Expand All @@ -42,6 +43,10 @@ Test.@testset "Fit Tests" begin
ContinuousNormalizingFlows.DIJacVecVectorMode(ADTypes.AutoZygote()),
ContinuousNormalizingFlows.DIVecJacMatrixMode(ADTypes.AutoZygote()),
ContinuousNormalizingFlows.DIJacVecMatrixMode(ADTypes.AutoZygote()),
# ContinuousNormalizingFlows.DIVecJacVectorMode(ADTypes.AutoEnzyme(Enzyme.Reverse)),
ContinuousNormalizingFlows.DIJacVecVectorMode(ADTypes.AutoEnzyme(Enzyme.Forward)),
# ContinuousNormalizingFlows.DIVecJacMatrixMode(ADTypes.AutoEnzyme(Enzyme.Reverse)),
ContinuousNormalizingFlows.DIJacVecMatrixMode(ADTypes.AutoEnzyme(Enzyme.Forward)),
]
data_types = Type{<:AbstractFloat}[Float32]
resources = ComputationalResources.AbstractResource[ComputationalResources.CPU1()]
Expand Down
8 changes: 3 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import AbstractDifferentiation,
DataFrames,
DifferentiationInterface,
Distributions,
ForwardDiff,
Enzyme,
GPUArraysCore,
JET,
Logging,
Lux,
LuxCUDA,
MLJBase,
ReverseDiff,
SciMLBase,
TerminalLoggers,
Test,
Expand All @@ -30,11 +29,10 @@ if (GROUP == "All")

debuglogger = TerminalLoggers.TerminalLogger(stderr, Logging.Debug)
Logging.global_logger(debuglogger)
else
warnlogger = TerminalLoggers.TerminalLogger(stderr, Logging.Warn)
Logging.global_logger(warnlogger)
end

Enzyme.API.runtimeActivity!(true)

Test.@testset "Overall" begin
if GROUP == "All" ||
GROUP in ["RNODE", "FFJORD", "Planar", "CondRNODE", "CondFFJORD", "CondPlanar"]
Expand Down
Loading