From b41d8dc9ecc47d24e4d6558a4a7e956e7b8a472f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 15:09:25 +0200 Subject: [PATCH 01/11] added CI --- .github/workflows/benchmark.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/benchmark.yml 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' From 2198df0ee8f0f647db8670d3b480f1a1ae18bf33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 15:51:57 +0200 Subject: [PATCH 02/11] moved packages to a narrower scope --- Project.toml | 2 -- benchmark/Project.toml | 2 ++ test/Project.toml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 benchmark/Project.toml create mode 100644 test/Project.toml 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/benchmark/Project.toml b/benchmark/Project.toml new file mode 100644 index 0000000..05a4894 --- /dev/null +++ b/benchmark/Project.toml @@ -0,0 +1,2 @@ +[deps] +BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..0c36332 --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,2 @@ +[deps] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From f9e31d980c79f09587cc7307103f6b6d2e929bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:09:31 +0200 Subject: [PATCH 03/11] dependencies --- benchmark/Project.toml | 1 + test/Project.toml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/benchmark/Project.toml b/benchmark/Project.toml index 05a4894..f656c36 100644 --- a/benchmark/Project.toml +++ b/benchmark/Project.toml @@ -1,2 +1,3 @@ [deps] BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e" diff --git a/test/Project.toml b/test/Project.toml index 0c36332..9a758ca 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,2 +1,5 @@ [deps] +Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From ab79bfc1584fcd9874b59f7d5e509e4f8d5e7bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:10:58 +0200 Subject: [PATCH 04/11] unused --- test/runtests.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index d7188ba..ac6649d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,13 +1,11 @@ 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 @testset "HyperFEMTests" verbose = true begin From b77df5069518e6c9f11e4e44bd0c4b072072ec00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:19:52 +0200 Subject: [PATCH 05/11] remove benchmark form tests --- test/TestTensorAlgebra/TensorAlgebra.jl | 20 -------------------- 1 file changed, 20 deletions(-) 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 From d2d2d0d392fea4a8df680eeef3f48dc246e98e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:20:11 +0200 Subject: [PATCH 06/11] remove bench from test --- test/TestConstitutiveModels/PhysicalModels.jl | 26 ------------------- 1 file changed, 26 deletions(-) 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) From 87ce0669717e571a7e58a2cecc86349b150f3ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:20:56 +0200 Subject: [PATCH 07/11] unused usings --- test/runtests.jl | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index ac6649d..9d9fc57 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,11 +1,6 @@ using HyperFEM using Test -using Gridap, GridapGmsh, GridapSolvers, DrWatson, TimerOutputs -using GridapSolvers.NonlinearSolvers -using Gridap.FESpaces -using Gridap.CellData -using Gridap.TensorValues -using HyperFEM: jacobian, IterativeSolver, solve! +using Gridap @testset "HyperFEMTests" verbose = true begin @@ -21,4 +16,3 @@ using HyperFEM: jacobian, IterativeSolver, solve! end end; - From 24862dbb8fa788c07bcac42b55aeed77cee253bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:21:22 +0200 Subject: [PATCH 08/11] no verbose if passess --- test/TestConstitutiveModels/runtests.jl | 2 +- test/TestTensorAlgebra/runtests.jl | 2 +- test/TestWeakForms/runtests.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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/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") From f3a110564d80c711fbce5d2207df88b9155b890c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:27:52 +0200 Subject: [PATCH 09/11] added using --- benchmark/benchmarks.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index 679b1a1..d0a6492 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -1,4 +1,5 @@ using BenchmarkTools +using Gridap using HyperFEM const SUITE = BenchmarkGroup() From 63bea3dcb4359081c40e79f9cf22deeaf500f051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Tue, 7 Oct 2025 16:35:07 +0200 Subject: [PATCH 10/11] missing forward diff --- test/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Project.toml b/test/Project.toml index 9a758ca..ca1ab13 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,5 +1,6 @@ [deps] Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e" +ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" From d58446c24aa6a9946a9182a81f78db377115cd47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mas=C3=B3?= Date: Wed, 8 Oct 2025 10:04:42 +0200 Subject: [PATCH 11/11] alph order --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index ca1ab13..42e3f98 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,6 +1,6 @@ [deps] -Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e" 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"