Skip to content

Use more functions from TrixiTest.jl - #226

Merged
JoshuaLampert merged 5 commits into
mainfrom
more-trixitest
Jul 24, 2025
Merged

Use more functions from TrixiTest.jl#226
JoshuaLampert merged 5 commits into
mainfrom
more-trixitest

Conversation

@JoshuaLampert

Copy link
Copy Markdown
Member

With TrixiTest.jl v0.1.3 we have some more functionality in the common TrixiTest.jl, which can be reused here. Note that we need a custom @test_trixi_include_base because it looks quite different compared to the one in TrixiTest.jl, but I also adapted to the new style, where we have a @test_trixi_include_base and a @test_trixi_include to stay consistent and avoid confusion.
Regarding the @test_allocations, we now also need to pass the rhs! to the macro.

For potential future reference, here is the script I used to replace all occurrences
for (root, _, files) in walkdir("test")
    for file in files
        if endswith(file, ".jl")
            filename = joinpath(root, file)
            (tmppath, tmpio) = mktemp()
            open(filename) do io
                for line in readlines(io)
                    if contains(line, "@test_allocations(semi, sol, ")
                        new_line = replace(line, "@test_allocations(semi, sol, " => "@test_allocations(DispersiveShallowWater.rhs!, semi, sol, ")
                        println(tmpio, new_line)
                    else
                        println(tmpio, line)
                    end
                end
            end
            close(tmpio)
            mv(tmppath, filename, force = true)
        end
    end
end

@github-actions

github-actions Bot commented Jul 24, 2025

Copy link
Copy Markdown
Contributor

Benchmark Results (Julia v1.10)

Time benchmarks
main f3d85b9... main / f3d85b9...
bbm_1d/bbm_1d_basic.jl - rhs!: 13.9 ± 0.36 μs 13.7 ± 0.32 μs 1.02 ± 0.035
bbm_1d/bbm_1d_fourier.jl - rhs!: 0.533 ± 0.0098 ms 0.527 ± 0.32 ms 1.01 ± 0.61
bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl - rhs!: 0.0805 ± 0.0013 ms 0.0807 ± 0.00037 ms 0.998 ± 0.017
bbm_bbm_1d/bbm_bbm_1d_dg.jl - rhs!: 0.034 ± 0.00049 ms 0.0354 ± 0.00062 ms 0.961 ± 0.022
bbm_bbm_1d/bbm_bbm_1d_relaxation.jl - rhs!: 27.5 ± 0.52 μs 27.6 ± 0.7 μs 0.996 ± 0.032
bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl - rhs!: 0.0482 ± 0.00061 ms 0.0482 ± 0.00064 ms 1 ± 0.018
hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl - rhs!: 4.26 ± 0.03 μs 4.27 ± 0.031 μs 0.998 ± 0.01
kdv_1d/kdv_1d_basic.jl - rhs!: 1.47 ± 0.021 μs 1.56 ± 0.021 μs 0.942 ± 0.018
kdv_1d/kdv_1d_implicit.jl - rhs!: 1.42 ± 0.03 μs 1.42 ± 0.02 μs 1 ± 0.025
serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl - rhs!: 0.205 ± 0.0097 ms 0.201 ± 0.0089 ms 1.02 ± 0.066
svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl - rhs!: 0.151 ± 0.0054 ms 0.147 ± 0.004 ms 1.02 ± 0.046
time_to_load 2.07 ± 0.019 s 2.06 ± 0.004 s 1.01 ± 0.0096
Memory benchmarks
main f3d85b9... main / f3d85b9...
bbm_1d/bbm_1d_basic.jl - rhs!: 1 allocs: 4.12 kB 1 allocs: 4.12 kB 1
bbm_1d/bbm_1d_fourier.jl - rhs!: 1 allocs: 4.12 kB 1 allocs: 4.12 kB 1
bbm_bbm_1d/bbm_bbm_1d_basic_reflecting.jl - rhs!: 5 allocs: 1.17 kB 5 allocs: 1.17 kB 1
bbm_bbm_1d/bbm_bbm_1d_dg.jl - rhs!: 10 allocs: 8.62 kB 10 allocs: 8.62 kB 1
bbm_bbm_1d/bbm_bbm_1d_relaxation.jl - rhs!: 2 allocs: 8.25 kB 2 allocs: 8.25 kB 1
bbm_bbm_1d/bbm_bbm_1d_upwind_relaxation.jl - rhs!: 2 allocs: 8.25 kB 2 allocs: 8.25 kB 1
hyperbolic_serre_green_naghdi_1d/hyperbolic_serre_green_naghdi_dingemans.jl - rhs!: 0 allocs: 0 B 0 allocs: 0 B
kdv_1d/kdv_1d_basic.jl - rhs!: 0 allocs: 0 B 0 allocs: 0 B
kdv_1d/kdv_1d_implicit.jl - rhs!: 0 allocs: 0 B 0 allocs: 0 B
serre_green_naghdi_1d/serre_green_naghdi_well_balanced.jl - rhs!: 0.075 k allocs: 0.66 MB 0.075 k allocs: 0.66 MB 1
svaerd_kalisch_1d/svaerd_kalisch_1d_dingemans_relaxation.jl - rhs!: 0.042 k allocs: 0.315 MB 0.042 k allocs: 0.315 MB 1
time_to_load 0.153 k allocs: 14.5 kB 0.153 k allocs: 14.5 kB 1

Why were they not included the first time? I just reran the script...
@coveralls

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 16500908095

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.292%

Totals Coverage Status
Change from base Build 16451792702: 0.0%
Covered Lines: 2245
Relevant Lines: 2284

💛 - Coveralls

@JoshuaLampert
JoshuaLampert requested a review from ranocha July 24, 2025 15:52

@ranocha ranocha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JoshuaLampert
JoshuaLampert merged commit a5e6adb into main Jul 24, 2025
11 checks passed
@JoshuaLampert
JoshuaLampert deleted the more-trixitest branch July 24, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants