Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmarks #56

Merged
merged 1 commit into from
Jul 4, 2024
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
34 changes: 34 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run benchmarks

on:
pull_request:
branches:
- master
- '!compathelper/**'
paths-ignore:
- 'README.md'
- 'test/**'
- 'docs/**'
- 'examples/**'

jobs:
Benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- uses: julia-actions/julia-buildpkg@latest
- name: Install dependencies
run: |
julia -e 'using Pkg; pkg"add PkgBenchmark [email protected]"'
cd benchmark; ln -s ../test/Artifacts.toml Artifacts.toml
- name: Run benchmarks
run: julia -e 'using BenchmarkCI; BenchmarkCI.judge(; retune=true)'
- name: Post results
run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print judgement
run: julia -e 'using BenchmarkCI; BenchmarkCI.displayjudgement()'
2 changes: 2 additions & 0 deletions benchmark/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
25 changes: 25 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using BenchmarkTools, LazyArtifacts

t = @elapsed using Batsrus
println("Julia version is $VERSION")
println(string("Batsrus.jl loading time: \e[33;1;1m$t\e[m seconds"))
println()
println("Benchmarking Batsrus.jl...")
println()

directory = artifact"testdata"
files = ("1d__raw_2_t25.60000_n00000258.out", "z=0_raw_1_t25.60000_n00000258.out",
"bx0_mhd_6_t00000100_n00000352.out")


const SUITE = BenchmarkGroup()

SUITE["read"] = BenchmarkGroup(["IO"])
file = joinpath(directory, files[1])
SUITE["read"]["ASCII"] = @benchmarkable load($file)

file = joinpath(directory, files[2])
SUITE["read"]["Binary structured"] = @benchmarkable load($file)

file = joinpath(directory, files[3])
SUITE["read"]["Binary unstructured"] = @benchmarkable load($file)
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ end
vars = getvars(bd, ["p"])
@test size(vars["p"]) == (8,8,8)
end
#TODO: add tecplot tests
#@testset "Reading Tecplot" begin

#end

@testset "Log" begin
logfilename = joinpath(datapath, "log_n000001.log")
Expand Down
Loading