diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..e0d470e --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,16 @@ +# https://astroautomata.com/AirspeedVelocity.jl/stable/ + +name: Benchmark + +on: [pull_request, workflow_dispatch] + +permissions: + pull-requests: write # need to post comments + +jobs: + bench: + runs-on: ubuntu-latest + steps: + - uses: MilesCranmer/AirspeedVelocity.jl@action-v1 + with: + julia-version: '1' diff --git a/Project.toml b/Project.toml index 9faf74f..5f22f3e 100644 --- a/Project.toml +++ b/Project.toml @@ -6,7 +6,6 @@ version = "1.0.0-DEV" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" -BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" @@ -24,6 +23,5 @@ Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7" Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..42e3f98 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,6 @@ +[deps] +ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" +Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/TestConstitutiveModels/PhysicalModels.jl b/test/TestConstitutiveModels/PhysicalModels.jl index 6e411d7..5ad93f0 100644 --- a/test/TestConstitutiveModels/PhysicalModels.jl +++ b/test/TestConstitutiveModels/PhysicalModels.jl @@ -4,7 +4,6 @@ using JSON using StaticArrays using Test using HyperFEM.PhysicalModels -using BenchmarkTools import Base: - @@ -39,31 +38,6 @@ function test_derivatives_3D_(model::PhysicalModel; rtol=1e-14, kwargs...) end -function benchmark_derivatives__(model::PhysicalModel, ∇u) - Ψ, ∂Ψu, ∂Ψuu = model() - ∂Ψu_(F) = TensorValue(ForwardDiff.gradient(Ψ, get_array(F))) - ∂Ψuu_(F) = TensorValue(ForwardDiff.hessian(Ψ, get_array(F))) - - F, _, _ = get_Kinematics(model.Kinematic) - print("Analyitical ∂Ψu | ") - @btime $∂Ψu($F($∇u)) - print("Numerical ∂Ψu | ") - @btime $∂Ψu_($F($∇u)) - print("Analyitical ∂Ψuu | ") - @btime $∂Ψuu($F($∇u)) - print("Numerical ∂Ψuu | ") - @btime $∂Ψuu_($F($∇u)) -end - -function benchmark_derivatives_2D_(model::PhysicalModel) - benchmark_derivatives__(model, ∇u2) -end - -function benchmark_derivatives_3D_(model::PhysicalModel) - benchmark_derivatives__(model, ∇u3) -end - - @testset "NonlinearMooneyRivlin_CV" begin model = NonlinearMooneyRivlin_CV(λ=3.0, μ1=1.0, μ2=1.0, α=2.0, β=1.0, γ=6.0) test_derivatives_3D_(model, rtol=1e-13) diff --git a/test/TestConstitutiveModels/runtests.jl b/test/TestConstitutiveModels/runtests.jl index ff18c32..87d5273 100644 --- a/test/TestConstitutiveModels/runtests.jl +++ b/test/TestConstitutiveModels/runtests.jl @@ -1,6 +1,6 @@ using HyperFEM -@testset "ConstitutiveModels" verbose = true begin +@testset "ConstitutiveModels" begin @time begin include("PhysicalModels.jl") diff --git a/test/TestTensorAlgebra/TensorAlgebra.jl b/test/TestTensorAlgebra/TensorAlgebra.jl index 22f0fcf..126ecfc 100644 --- a/test/TestTensorAlgebra/TensorAlgebra.jl +++ b/test/TestTensorAlgebra/TensorAlgebra.jl @@ -2,7 +2,6 @@ using Gridap.TensorValues using Gridap.Arrays using HyperFEM.TensorAlgebra using Test -using BenchmarkTools @testset "Jacobian regularization" begin @@ -31,21 +30,6 @@ end end -# @benchmark (A ⊗₁₃²⁴ B) -# @benchmark (A ⊗₁₂³ V1) -# @benchmark (A ⊗₁₃² V1) -# @benchmark (V1 ⊗₁²³ A) -# @benchmark (A ⊗₁₃²⁴ B) -# @benchmark (D × A) - -# @code_warntype (A ⊗₁₃²⁴ B) -# @code_warntype (A ⊗₁₂³ V1) -# @code_warntype (A ⊗₁₃² V1) -# @code_warntype (V1 ⊗₁²³ A) -# @code_warntype (A ⊗₁₃²⁴ B) -# @code_warntype (D × A) - - @testset "cross" begin A = TensorValue(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0) * 1e-3 B = TensorValue(4.6, 2.1, 1.7, 3.2, 6.5, 1.4, 9.2, 8.0, 9.0) * 1e-3 @@ -106,10 +90,6 @@ end @test I3_ == I3 @test I4_ == I4 @test I9_ == I9 - # @benchmark I2_ - # @benchmark I2 - # @benchmark I9_ - # @benchmark I9 end diff --git a/test/TestTensorAlgebra/runtests.jl b/test/TestTensorAlgebra/runtests.jl index f1e4b72..7b354b0 100644 --- a/test/TestTensorAlgebra/runtests.jl +++ b/test/TestTensorAlgebra/runtests.jl @@ -1,4 +1,4 @@ -@testset "TensorAlgebra" verbose = true begin +@testset "TensorAlgebra" begin @time begin include("TensorAlgebra.jl") diff --git a/test/TestWeakForms/runtests.jl b/test/TestWeakForms/runtests.jl index 72a7843..29cd81b 100644 --- a/test/TestWeakForms/runtests.jl +++ b/test/TestWeakForms/runtests.jl @@ -1,4 +1,4 @@ -@testset "WeakForms" verbose = true begin +@testset "WeakForms" begin @time begin include("WeakForms.jl") diff --git a/test/runtests.jl b/test/runtests.jl index d7188ba..9d9fc57 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,13 +1,6 @@ using HyperFEM using Test -using Profile -using Gridap, GridapGmsh, GridapSolvers, DrWatson, TimerOutputs -using GridapSolvers.NonlinearSolvers -using Gridap.FESpaces -using Gridap.CellData -using Gridap.TensorValues -using HyperFEM: jacobian, IterativeSolver, solve! -using BenchmarkTools +using Gridap @testset "HyperFEMTests" verbose = true begin @@ -23,4 +16,3 @@ using BenchmarkTools end end; -