Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
6 changes: 6 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -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"
26 changes: 0 additions & 26 deletions test/TestConstitutiveModels/PhysicalModels.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using JSON
using StaticArrays
using Test
using HyperFEM.PhysicalModels
using BenchmarkTools


import Base: -
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/TestConstitutiveModels/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using HyperFEM

@testset "ConstitutiveModels" verbose = true begin
@testset "ConstitutiveModels" begin

@time begin
include("PhysicalModels.jl")
Expand Down
20 changes: 0 additions & 20 deletions test/TestTensorAlgebra/TensorAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ using Gridap.TensorValues
using Gridap.Arrays
using HyperFEM.TensorAlgebra
using Test
using BenchmarkTools


@testset "Jacobian regularization" begin
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -106,10 +90,6 @@ end
@test I3_ == I3
@test I4_ == I4
@test I9_ == I9
# @benchmark I2_
# @benchmark I2
# @benchmark I9_
# @benchmark I9
end


Expand Down
2 changes: 1 addition & 1 deletion test/TestTensorAlgebra/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "TensorAlgebra" verbose = true begin
@testset "TensorAlgebra" begin

@time begin
include("TensorAlgebra.jl")
Expand Down
2 changes: 1 addition & 1 deletion test/TestWeakForms/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "WeakForms" verbose = true begin
@testset "WeakForms" begin

@time begin
include("WeakForms.jl")
Expand Down
10 changes: 1 addition & 9 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -23,4 +16,3 @@ using BenchmarkTools
end

end;