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

Drop support for Julia 1.9 #703

Merged
merged 17 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ jobs:
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'
# Also run tests on Windows and macOS-ARM, but only with the latest Julia release and LTS
- version: 'lts'
os: windows-latest
arch: x64
- version: '1.10'
- version: 'lts'
os: macos-14
arch: arm64
- version: '1'
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.6"
Polyester = "0.7.10"
RecipesBase = "1"
Reexport = "1"
Expand All @@ -54,4 +54,4 @@ StrideArrays = "0.1"
TimerOutputs = "0.5.25"
TrixiBase = "0.1.3"
WriteVTK = "1"
julia = "1.9"
julia = "1.10"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
44 changes: 8 additions & 36 deletions src/callbacks/solution_saving.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -329,9 +303,7 @@ function Base.show(io::IO, ::MIME"text/plain",
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 = [
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
CSV = "0.10"
CairoMakie = "0.13"
CairoMakie = "0.12"
svchb marked this conversation as resolved.
Show resolved Hide resolved
DataFrames = "1.6"
GLM = "1.9"
Glob = "1.3"
Expand Down
17 changes: 4 additions & 13 deletions test/validation/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,10 @@
@test sol.retcode == ReturnCode.Success
@test count_rhs_allocations(sol, semi) == 0

if VERSION == v"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)
end
@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())

# Ignore method redefinitions from duplicate `include("../validation_util.jl")`
@test_nowarn_mod trixi_include(@__MODULE__,
Expand Down
Loading