Skip to content

Commit

Permalink
follow SciMLBase update destats -> stats (trixi-framework#1372)
Browse files Browse the repository at this point in the history
* follow SciMLBase update destats -> stats

* update compat bounds of OrdinaryDiffEq.jl for destats -> stats

* set required Julia version to v1.8 and update CI

* fix tests of performance specializations
  • Loading branch information
ranocha authored Mar 15, 2023
1 parent 06407f4 commit cd92502
Show file tree
Hide file tree
Showing 20 changed files with 60 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: '1.7'
version: '1.8'
show-versioninfo: true
- uses: julia-actions/julia-buildpkg@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
os:
- ubuntu-latest
version:
- '1.7'
- '1.8'
arch:
- x64
steps:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.7'
- '1.8'
# - 'nightly'
os:
- ubuntu-latest
Expand All @@ -77,19 +77,19 @@ jobs:
- mpi
- threaded
include:
- version: '1.7'
- version: '1.8'
os: macOS-latest
arch: x64
trixi_test: mpi
- version: '1.7'
- version: '1.8'
os: macOS-latest
arch: x64
trixi_test: threaded
- version: '1.7'
- version: '1.8'
os: windows-latest
arch: x64
trixi_test: mpi
- version: '1.7'
- version: '1.8'
os: windows-latest
arch: x64
trixi_test: threaded
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ for human readability.

#### Changed

- The required Julia version is updated to v1.8 in Trixi.jl v0.5.13.

#### Deprecated

#### Removed
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Polyester = "0.3.4, 0.5, 0.6, 0.7"
RecipesBase = "1.1"
Reexport = "1.0"
Requires = "1.1"
SciMLBase = "1.65"
SciMLBase = "1.90"
Setfield = "0.8, 1"
StartUpDG = "0.15"
Static = "0.3, 0.4, 0.5, 0.6, 0.7, 0.8"
Expand All @@ -71,4 +71,4 @@ Triangulate = "2.0"
TriplotBase = "0.1"
TriplotRecipes = "0.1"
UnPack = "1.0"
julia = "1.7"
julia = "1.8"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ installation and postprocessing procedures. Its features include:
## Installation
If you have not yet installed Julia, please [follow the instructions for your
operating system](https://julialang.org/downloads/platform/). Trixi works
with Julia v1.7.
with Julia v1.8.

### For users
Trixi and its related tools are registered Julia packages. Hence, you
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ HOHQMesh = "0.1, 0.2"
LaTeXStrings = "1.2"
Literate = "2.9"
Measurements = "2.5"
OrdinaryDiffEq = "5.65, 6"
OrdinaryDiffEq = "6.49.1"
Plots = "1.9"
Trixi2Vtk = "0.3"
6 changes: 3 additions & 3 deletions docs/src/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package, which tracks changed files and re-loads them automatically. Therefore,
it is *highly recommended* to first install Revise with the following command in Julia:
To enter the package REPL mode, press `]` in the standard Julia REPL mode. Then, execute
```julia-repl
(@v1.7) pkg> add Revise
(@v1.8) pkg> add Revise
```
Now you are able to run Trixi from the REPL, change Trixi code between runs,
**and** enjoy the advantages of the compilation cache! Before you start using
Expand All @@ -28,7 +28,7 @@ Another recommended package for working from the REPL is
[OhMyREPL.jl](https://github.com/KristofferC/OhMyREPL.jl). It can be installed
by running
```julia-repl
(@v1.7) pkg> add OhMyREPL
(@v1.8) pkg> add OhMyREPL
```
and adds syntax highlighting, bracket highlighting, and other helpful
improvements for using Julia interactively. To automatically use OhMyREPL when
Expand Down Expand Up @@ -332,5 +332,5 @@ in Trixi2Vtk.
To use a locally modified Trixi clone instead of a Trixi release, one can tell Pkg
to use the local source code of Trixi instead of a registered version by running
```julia-repl
(@v1.7) pkg> develop path/to/Trixi.jl
(@v1.8) pkg> develop path/to/Trixi.jl
```
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ installation and postprocessing procedures. Its features include:
## Installation
If you have not yet installed Julia, please [follow the instructions for your
operating system](https://julialang.org/downloads/platform/). Trixi works
with Julia v1.7.
with Julia v1.8.

### For users
Trixi and its related tools are registered Julia packages. Hence, you
Expand Down
12 changes: 6 additions & 6 deletions src/callbacks_step/alive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ function (alive_callback::AliveCallback)(u, t, integrator)
@unpack alive_interval, analysis_interval = alive_callback

# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
return alive_interval > 0 && (
(integrator.destats.naccept % alive_interval == 0 &&
!(integrator.destats.naccept == 0 && integrator.iter > 0) &&
(analysis_interval == 0 || integrator.destats.naccept % analysis_interval != 0)) ||
(integrator.stats.naccept % alive_interval == 0 &&
!(integrator.stats.naccept == 0 && integrator.iter > 0) &&
(analysis_interval == 0 || integrator.stats.naccept % analysis_interval != 0)) ||
isfinished(integrator))
end

Expand All @@ -86,13 +86,13 @@ function (alive_callback::AliveCallback)(integrator)
if isfinished(integrator) && mpi_isroot()
println(""^100)
println("Trixi simulation finished. Final time: ", integrator.t,
" Time steps: ", integrator.destats.naccept, " (accepted), ", integrator.iter, " (total)")
" Time steps: ", integrator.stats.naccept, " (accepted), ", integrator.iter, " (total)")
println(""^100)
println()
elseif mpi_isroot()
runtime_absolute = 1.0e-9 * (time_ns() - alive_callback.start_time)
@printf("#timesteps: %6d │ Δt: %.4e │ sim. time: %.4e │ run time: %.4e s\n",
integrator.destats.naccept, integrator.dt, integrator.t, runtime_absolute)
integrator.stats.naccept, integrator.dt, integrator.t, runtime_absolute)
end

# avoid re-evaluating possible FSAL stages
Expand Down
6 changes: 3 additions & 3 deletions src/callbacks_step/amr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ function AMRCallback(semi, controller, adaptor;

# AMR every `interval` time steps, but not after the final step
# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
if interval > 0
condition = (u, t, integrator) -> ( (integrator.destats.naccept % interval == 0) &&
!(integrator.destats.naccept == 0 && integrator.iter > 0) &&
condition = (u, t, integrator) -> ( (integrator.stats.naccept % interval == 0) &&
!(integrator.stats.naccept == 0 && integrator.iter > 0) &&
!isfinished(integrator) )
else # disable the AMR callback except possibly for initial refinement during initialization
condition = (u, t, integrator) -> false
Expand Down
8 changes: 4 additions & 4 deletions src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ function AnalysisCallback(mesh, equations::AbstractEquations, solver, cache;
kwargs...)
# Decide when the callback is activated.
# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
condition = (u, t, integrator) -> interval > 0 && ( (integrator.destats.naccept % interval == 0 &&
!(integrator.destats.naccept == 0 && integrator.iter > 0)) ||
condition = (u, t, integrator) -> interval > 0 && ( (integrator.stats.naccept % interval == 0 &&
!(integrator.stats.naccept == 0 && integrator.iter > 0)) ||
isfinished(integrator))

analyzer = SolutionAnalyzer(solver; kwargs...)
Expand Down Expand Up @@ -202,7 +202,7 @@ function (analysis_callback::AnalysisCallback)(integrator)
semi = integrator.p
mesh, equations, solver, cache = mesh_equations_solver_cache(semi)
@unpack dt, t = integrator
iter = integrator.destats.naccept
iter = integrator.stats.naccept

# Record performance measurements and compute performance index (PID)
runtime_since_last_analysis = 1.0e-9 * (time_ns() - analysis_callback.start_time_last_analysis)
Expand Down
6 changes: 3 additions & 3 deletions src/callbacks_step/save_restart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ function (restart_callback::SaveRestartCallback)(u, t, integrator)
@unpack interval, save_final_restart = restart_callback

# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
return interval > 0 && (
((integrator.destats.naccept % interval == 0) && !(integrator.destats.naccept == 0 && integrator.iter > 0)) ||
((integrator.stats.naccept % interval == 0) && !(integrator.stats.naccept == 0 && integrator.iter > 0)) ||
(save_final_restart && isfinished(integrator)))
end

Expand All @@ -94,7 +94,7 @@ end
function (restart_callback::SaveRestartCallback)(integrator)
u_ode = integrator.u
@unpack t, dt = integrator
iter = integrator.destats.naccept
iter = integrator.stats.naccept
semi = integrator.p
mesh, _, _, _ = mesh_equations_solver_cache(semi)

Expand Down
10 changes: 5 additions & 5 deletions src/callbacks_step/save_solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ function (solution_callback::SaveSolutionCallback)(u, t, integrator)
@unpack interval, save_final_solution = solution_callback

# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
return interval > 0 && (
((integrator.destats.naccept % interval == 0) && !(integrator.destats.naccept == 0 && integrator.iter > 0)) ||
((integrator.stats.naccept % interval == 0) && !(integrator.stats.naccept == 0 && integrator.iter > 0)) ||
(save_final_solution && isfinished(integrator)))
end

Expand All @@ -109,7 +109,7 @@ end
function (solution_callback::SaveSolutionCallback)(integrator)
u_ode = integrator.u
@unpack t, dt = integrator
iter = integrator.destats.naccept
iter = integrator.stats.naccept
semi = integrator.p
mesh, _, _, _ = mesh_equations_solver_cache(semi)

Expand All @@ -125,10 +125,10 @@ function (solution_callback::SaveSolutionCallback)(integrator)
callbacks = integrator.opts.callback
if callbacks isa CallbackSet
for cb in callbacks.continuous_callbacks
get_element_variables!(element_variables, u_ode, semi, cb; t=integrator.t, iter=integrator.destats.naccept)
get_element_variables!(element_variables, u_ode, semi, cb; t=integrator.t, iter=integrator.stats.naccept)
end
for cb in callbacks.discrete_callbacks
get_element_variables!(element_variables, u_ode, semi, cb; t=integrator.t, iter=integrator.destats.naccept)
get_element_variables!(element_variables, u_ode, semi, cb; t=integrator.t, iter=integrator.stats.naccept)
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions src/callbacks_step/time_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ function TimeSeriesCallback(mesh, equations, solver, cache, point_coordinates;
# Invoke callback every `interval` time steps or after final step (for storing the data on disk)
if interval > 0
# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
condition = (u, t, integrator) -> ( (integrator.destats.naccept % interval == 0 &&
!(integrator.destats.naccept == 0 && integrator.iter > 0)) ||
condition = (u, t, integrator) -> ( (integrator.stats.naccept % interval == 0 &&
!(integrator.stats.naccept == 0 && integrator.iter > 0)) ||
isfinished(integrator))
else # disable the callback for interval == 0
condition = (u, t, integrator) -> false
Expand Down Expand Up @@ -173,11 +173,11 @@ function (time_series_callback::TimeSeriesCallback)(integrator)

# Create record if in correct interval (needs to be checked since the callback is also called
# after the final step for storing the data on disk, indepdendent of the current interval)
if integrator.destats.naccept % interval == 0
if integrator.stats.naccept % interval == 0
@trixi_timeit timer() "time series" begin
# Store time and step
push!(time_series_callback.time, integrator.t)
push!(time_series_callback.step, integrator.destats.naccept)
push!(time_series_callback.step, integrator.stats.naccept)

# Unpack data
u_ode = integrator.u
Expand Down
8 changes: 4 additions & 4 deletions src/callbacks_step/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ function (visualization_callback::VisualizationCallback)(u, t, integrator)
@unpack interval = visualization_callback

# With error-based step size control, some steps can be rejected. Thus,
# `integrator.iter >= integrator.destats.naccept`
# `integrator.iter >= integrator.stats.naccept`
# (total #steps) (#accepted steps)
# We need to check the number of accepted steps since callbacks are not
# activated after a rejected step.
return interval > 0 && ( (integrator.destats.naccept % interval == 0 &&
!(integrator.destats.naccept == 0 && integrator.iter > 0)) ||
return interval > 0 && ( (integrator.stats.naccept % interval == 0 &&
!(integrator.stats.naccept == 0 && integrator.iter > 0)) ||
isfinished(integrator))
end

Expand All @@ -153,7 +153,7 @@ function (visualization_callback::VisualizationCallback)(integrator)
# Create plot
plot_creator(plot_data, variable_names;
show_mesh=show_mesh, plot_arguments=plot_arguments,
time=integrator.t, timestep=integrator.destats.naccept)
time=integrator.t, timestep=integrator.stats.naccept)

# avoid re-evaluating possible FSAL stages
u_modified!(integrator, false)
Expand Down
4 changes: 2 additions & 2 deletions src/time_integration/methods_2N.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ mutable struct SimpleIntegrator2N{RealT<:Real, uType, Params, Sol, F, Alg, Simpl
finalstep::Bool # added for convenience
end

# Forward integrator.destats.naccept to integrator.iter (see GitHub PR#771)
# Forward integrator.stats.naccept to integrator.iter (see GitHub PR#771)
function Base.getproperty(integrator::SimpleIntegrator2N, field::Symbol)
if field === :destats
if field === :stats
return (naccept = getfield(integrator, :iter),)
end
# general fallback
Expand Down
4 changes: 2 additions & 2 deletions src/time_integration/methods_3Sstar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ mutable struct SimpleIntegrator3Sstar{RealT<:Real, uType, Params, Sol, F, Alg, S
finalstep::Bool # added for convenience
end

# Forward integrator.destats.naccept to integrator.iter (see GitHub PR#771)
# Forward integrator.stats.naccept to integrator.iter (see GitHub PR#771)
function Base.getproperty(integrator::SimpleIntegrator3Sstar, field::Symbol)
if field === :destats
if field === :stats
return (naccept = getfield(integrator, :iter),)
end
# general fallback
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ CairoMakie = "0.6, 0.7, 0.8, 0.9, 0.10"
Flux = "0.13 - 0.13.12" # TODO: Return to "0.13" once https://github.com/FluxML/Flux.jl/issues/2204 is resolved
ForwardDiff = "0.10"
MPI = "0.20"
OrdinaryDiffEq = "5.65, 6"
OrdinaryDiffEq = "6.49.1"
Plots = "1.16"
Loading

0 comments on commit cd92502

Please sign in to comment.