From edcf42b324f929d5215570a3419c0c6f93a6243e Mon Sep 17 00:00:00 2001 From: Junyi Xu Date: Mon, 26 Aug 2024 02:01:34 +0800 Subject: [PATCH] test: add UpwindTest --- test/UpwindTest.jl | 6 +++--- test/runtests.jl | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/UpwindTest.jl b/test/UpwindTest.jl index 99a999b..fb44407 100644 --- a/test/UpwindTest.jl +++ b/test/UpwindTest.jl @@ -4,8 +4,8 @@ using TrixiEnzyme using TrixiEnzyme: upwind! using ForwardDiff -x = -1:0.005:1 -batch_size = 2 +x = -1:0.01:1 +batch_size = 11 jacobian_enzyme_forward(TrixiEnzyme.upwind!, x, N=batch_size) Δt₁ = @elapsed J1 = jacobian_enzyme_forward(TrixiEnzyme.upwind!, x) @@ -24,7 +24,7 @@ end; end; # 0.326764 seconds (1.09 M allocations: 75.013 MiB, 7.28% gc time, 99.87% compilation time) -@test J1 = J2 +@test J1 == J2 @info "Compare the time consumed by Enzyme.jl Δt and ForwardDiff.jl..." @info "Enzyme: $Δt₁ seconds | ForwardDiff: $Δt₂ seconds." diff --git a/test/runtests.jl b/test/runtests.jl index a88e567..b0e674b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,6 +7,11 @@ using Test, TrixiEnzyme t = @elapsed include("CommonTest.jl") println("##### done (took $t seconds).") end + @testset "Upwind" begin + println("##### Testing Upwind...") + t = @elapsed include("UpwindTest.jl") + println("##### done (took $t seconds).") + end @testset "Semi" begin println("##### Testing semi...") t = @elapsed include("SemiTest.jl")