diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cae43ee26..a1c9b2038 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,40 +27,35 @@ on: - 'docs/**' workflow_dispatch: -# Cancel redundant CI tests automatically +# Skip intermediate builds: always. +# Cancel intermediate builds: only if it is a pull request build. concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: build: - name: Run Tests (Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}) - runs-on: ubuntu-latest + name: Run Tests (Julia ${{ matrix.version }} - ${{ matrix.os }}) + runs-on: ${{ matrix.os }} strategy: + # Don't cancel all running jobs when one job fails fail-fast: false matrix: - version: - - '1.9' - - '1.10' - - '1' - os: - - ubuntu-latest - arch: - - x64 - include: - # Also run tests on Windows and macOS-ARM, but only with the latest Julia version and 1.10 - - version: '1.10' - os: windows-latest - arch: x64 - - version: '1.10' - os: macos-14 - arch: arm64 - - version: '1' - os: windows-latest - arch: x64 - - version: '1' - os: macos-14 - arch: arm64 + version: + - '1.10' + - '1' + os: + - ubuntu-latest + include: + # Also run tests on Windows and macOS-ARM, but only with the latest Julia release and minimum supported version + - version: 'min' + os: windows-latest + - version: 'min' + os: macos-14 + - version: '1' + os: windows-latest + - version: '1' + os: macos-14 steps: - name: Check out project @@ -71,6 +66,9 @@ jobs: with: version: ${{ matrix.version }} + - name: Display Julia version + run: julia -e 'using InteractiveUtils; versioninfo(verbose=true)' + - uses: julia-actions/cache@v2 - name: Build package diff --git a/Project.toml b/Project.toml index b757a53e5..45f335178 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TrixiParticles" uuid = "66699cd8-9c01-4e9d-a059-b96c86d16b3a" authors = ["erik.faulhaber <44124897+efaulhaber@users.noreply.github.com>"] -version = "0.2.4" +version = "0.2.5-dev" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" @@ -32,19 +32,19 @@ TrixiBase = "9a0f1c46-06d5-4909-a5a3-ce25d3fa3284" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" [compat] -Adapt = "3, 4" +Adapt = "4" CSV = "0.10" DataFrames = "1.6" DelimitedFiles = "1" -DiffEqCallbacks = "2, 3, 4" +DiffEqCallbacks = "4" FastPow = "0.1" FileIO = "1" ForwardDiff = "0.10" -GPUArraysCore = "0.1, 0.2" +GPUArraysCore = "0.2" JSON = "0.21" KernelAbstractions = "0.9" MuladdMacro = "0.2" -PointNeighbors = "0.4.2" +PointNeighbors = "0.4.7" Polyester = "0.7.10" RecipesBase = "1" Reexport = "1" @@ -54,4 +54,4 @@ StrideArrays = "0.1" TimerOutputs = "0.5.25" TrixiBase = "0.1.3" WriteVTK = "1" -julia = "1.9" +julia = "1.10" diff --git a/README.md b/README.md index 5e5f5e165..d6645d820 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ TrixiParticles.jl focuses on the following use cases: - Development of new particle-based methods and models. - Easy setup of accessible simulations for educational purposes, including student projects, coursework, and thesis work. -It offers intuitive configuration, robust pre- and post-processing, and vendor-agnostic GPU-support based on the Julia package [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl). +It offers intuitive configuration, robust pre- and post-processing, and vendor-agnostic GPU-support based on the Julia package [KernelAbstractions.jl](https://github.com/JuliaGPU/KernelAbstractions.jl). [![YouTube](https://github.com/user-attachments/assets/dc2be627-a799-4bfd-9226-2077f737c4b0)](https://www.youtube.com/watch?v=V7FWl4YumcA&t=4667s) @@ -66,7 +66,7 @@ We provide several example simulation setups in the `examples` folder (which can ## Installation If you have not yet installed Julia, please [follow the instructions for your operating system](https://julialang.org/downloads/platform/). TrixiParticles.jl works -with Julia v1.9 and newer. We recommend using the latest stable release of Julia. +with Julia v1.10 and newer. We recommend using the latest stable release of Julia. ### For users TrixiParticles.jl is a registered Julia package. diff --git a/docs/Project.toml b/docs/Project.toml index 054725973..82eba151f 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -13,5 +13,5 @@ Documenter = "1" DocumenterCitations = "1" OrdinaryDiffEq = "6" Plots = "1" -PointNeighbors = "0.4" +PointNeighbors = "0.4.7" TrixiBase = "0.1" diff --git a/docs/src/install.md b/docs/src/install.md index 53e5d15b8..15c6668b9 100644 --- a/docs/src/install.md +++ b/docs/src/install.md @@ -3,7 +3,7 @@ ## Setting up Julia If you have not yet installed Julia, please [follow the instructions on the official website](https://julialang.org/downloads/). TrixiParticles.jl works -with Julia v1.9 and newer. We recommend using the latest stable release of Julia. +with Julia v1.10 and newer. We recommend using the latest stable release of Julia. ## For users TrixiParticles.jl is a registered Julia package. diff --git a/src/callbacks/solution_saving.jl b/src/callbacks/solution_saving.jl index 91dc03ff7..b226c4433 100644 --- a/src/callbacks/solution_saving.jl +++ b/src/callbacks/solution_saving.jl @@ -106,9 +106,7 @@ function SolutionSavingCallback(; interval::Integer=0, dt=0.0, -1, Ref("UnknownVersion")) if length(save_times) > 0 - # See the large comment below for an explanation why we use `finalize` here. - # When support for Julia 1.9 is dropped, the `finalize` argument can be removed. - return PresetTimeCallback(save_times, solution_callback, finalize=solution_callback) + return PresetTimeCallback(save_times, solution_callback) elseif dt > 0 # Add a `tstop` every `dt`, and save the final solution return PeriodicCallback(solution_callback, dt, @@ -198,41 +196,22 @@ end # When `interval` is used, this is # `DiscreteCallback{<:SolutionSavingCallback, # <:SolutionSavingCallback, -# typeof(TrixiParticles.initialize_save_cb!), -# typeof(SciMLBase.FINALIZE_DEFAULT)}`. +# typeof(TrixiParticles.initialize_save_cb!)}`. # # When `dt` is used, this is # `DiscreteCallback{DiffEqCallbacks.var"#99#103"{...}, # DiffEqCallbacks.PeriodicCallbackAffect{<:SolutionSavingCallback}, -# DiffEqCallbacks.var"#100#104"{...} -# typeof(SciMLBase.FINALIZE_DEFAULT)}`. +# DiffEqCallbacks.var"#100#104"{...}}`. # # When `save_times` is used, this is # `DiscreteCallback{DiffEqCallbacks.var"#115#117"{...}, # <:SolutionSavingCallback, -# DiffEqCallbacks.var"#116#118"{...}, -# typeof(SciMLBase.FINALIZE_DEFAULT)}}`. +# DiffEqCallbacks.var"#116#118"{...}}`. # # So we can unambiguously dispatch on # - `DiscreteCallback{<:SolutionSavingCallback, <:SolutionSavingCallback}`, # - `DiscreteCallback{<:Any, <:PeriodicCallbackAffect{<:SolutionSavingCallback}}`, # - `DiscreteCallback{<:Any, <:SolutionSavingCallback}`. -# -# WORKAROUND FOR JULIA 1.9: -# When `save_times` is used, the `affect!` is also wrapped in an anonymous function: -# `DiscreteCallback{DiffEqCallbacks.var"#110#113"{...}, -# DiffEqCallbacks.var"#111#114"{<:SolutionSavingCallback}, -# DiffEqCallbacks.var"#116#118"{...}, -# typeof(SciMLBase.FINALIZE_DEFAULT)}}`. -# -# To dispatch here, we set `finalize` to the callback itself, so that the fourth parameter -# becomes `<:SolutionSavingCallback`. This is only used in Julia 1.9. 1.10 and later uses -# a newer version of DiffEqCallbacks.jl that does not have this issue. -# -# To use the callback as `finalize`, we have to define the following function. -# `finalize` is set to `FINALIZE_DEFAULT` by default in the `PresetTimeCallback`, -# which is a function that just returns `nothing`. -# We define the `SolutionSavingCallback` to do the same when called with these arguments. function (finalize::SolutionSavingCallback)(c, u, t, integrator) return nothing end @@ -256,17 +235,12 @@ function Base.show(io::IO, print(io, "SolutionSavingCallback(dt=", solution_saving.interval, ")") end -# With `save_times`, also working in Julia 1.9. -# When support for Julia 1.9 is dropped, this can be changed to -# `DiscreteCallback{<:Any, <:SolutionSavingCallback}`, and the `finalize` argument -# in the constructor of `SolutionSavingCallback` can be removed. +# With `save_times` function Base.show(io::IO, - cb::DiscreteCallback{<:Any, <:Any, <:Any, <:SolutionSavingCallback}) + cb::DiscreteCallback{<:Any, <:SolutionSavingCallback}) @nospecialize cb # reduce precompilation time - # This has to be changed to `cb.affect!` when support for Julia 1.9 is dropped - # and finalize is removed from the constructor of `SolutionSavingCallback`. - solution_saving = cb.finalize + solution_saving = cb.affect! print(io, "SolutionSavingCallback(save_times=", solution_saving.save_times, ")") end @@ -323,15 +297,13 @@ end # With `save_times`. See comments above. function Base.show(io::IO, ::MIME"text/plain", - cb::DiscreteCallback{<:Any, <:Any, <:Any, <:SolutionSavingCallback}) + cb::DiscreteCallback{<:Any, <:SolutionSavingCallback}) @nospecialize cb # reduce precompilation time if get(io, :compact, false) show(io, cb) else - # This has to be changed to `cb.affect!` when support for Julia 1.9 is dropped - # and finalize is removed from the constructor of `SolutionSavingCallback`. - solution_saving = cb.finalize + solution_saving = cb.affect! cq = collect(solution_saving.custom_quantities) setup = [ diff --git a/test/Project.toml b/test/Project.toml index 2fdbaaa0d..ef78271e3 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -16,7 +16,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] CSV = "0.10" -CairoMakie = "0.13" +CairoMakie = "0.12" DataFrames = "1.6" GLM = "1.9" Glob = "1.3" diff --git a/test/count_allocations.jl b/test/count_allocations.jl index 69dfa19d3..cd1ad4aff 100644 --- a/test/count_allocations.jl +++ b/test/count_allocations.jl @@ -5,6 +5,8 @@ struct NoUpdateNeighborhoodSearch{NHS} nhs::NHS end +@inline Base.ndims(nhs::NoUpdateNeighborhoodSearch) = ndims(nhs.nhs) + # Copy a `Semidiscretization`, but wrap the neighborhood searches with # `NoUpdateNeighborhoodSearch`. function copy_semi_with_no_update_nhs(semi) diff --git a/test/validation/validation.jl b/test/validation/validation.jl index 3c964f9c3..5a7412b65 100644 --- a/test/validation/validation.jl +++ b/test/validation/validation.jl @@ -47,18 +47,26 @@ @test sol.retcode == ReturnCode.Success @test count_rhs_allocations(sol, semi) == 0 - if VERSION == v"1.10" + if Sys.ARCH === :aarch64 + # MacOS ARM produces slightly different pressure values than x86. + # Note that pressure values are in the order of 1e5. + @test isapprox(error_edac_P1, 0, atol=8e-10) + @test isapprox(error_edac_P2, 0, atol=7e-12) + @test isapprox(error_wcsph_P1, 0, atol=18.0) + @test isapprox(error_wcsph_P2, 0, atol=0.004) + elseif VERSION == v"1.10" + # Reference values are computed with 1.10 @test isapprox(error_edac_P1, 0, atol=eps()) @test isapprox(error_edac_P2, 0, atol=eps()) @test isapprox(error_wcsph_P1, 0, atol=eps()) @test isapprox(error_wcsph_P2, 0, atol=eps()) else - # 1.9 causes a large difference in the solution - # TODO 1.11 requires a performance hotfix which will likely change these results again - @test isapprox(error_edac_P1, 0, atol=4e-9) - @test isapprox(error_edac_P2, 0, atol=3e-11) - @test isapprox(error_wcsph_P1, 0, atol=26.3) - @test isapprox(error_wcsph_P2, 0, atol=8.2e-3) + # 1.11 produces slightly different pressure values than 1.10. + # Note that pressure values are in the order of 1e5. + @test isapprox(error_edac_P1, 0, atol=eps()) + @test isapprox(error_edac_P2, 0, atol=eps()) + @test isapprox(error_wcsph_P1, 0, atol=0.07) + @test isapprox(error_wcsph_P2, 0, atol=8e-6) end # Ignore method redefinitions from duplicate `include("../validation_util.jl")`