Skip to content

Commit

Permalink
Remove TimerOutputs (#1749)
Browse files Browse the repository at this point in the history
Fixes #1741.

Note that this is still an indirect dependency.

```
(root) pkg> why TimerOutputs
  Ribasim → DiffEqCallbacks → NonlinearSolve → TimerOutputs
  Ribasim → OrdinaryDiffEq → NonlinearSolve → TimerOutputs
```
  • Loading branch information
visr authored Aug 26, 2024
1 parent 3c8858a commit d0494c1
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.4"
manifest_format = "2.0"
project_hash = "f5db1a5a8508af3b6aa81e77870ec2fb3af68768"
project_hash = "c2cb085c326f61a96abd1a295e6fa775c585beba"

[[deps.ADTypes]]
git-tree-sha1 = "6778bcc27496dae5723ff37ee30af451db8b35fe"
Expand Down Expand Up @@ -1302,7 +1302,7 @@ uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "3.5.18"

[[deps.Ribasim]]
deps = ["Accessors", "Arrow", "BasicModelInterface", "CodecZstd", "ComponentArrays", "Configurations", "DBInterface", "DataInterpolations", "DataStructures", "Dates", "DiffEqCallbacks", "EnumX", "FiniteDiff", "ForwardDiff", "Graphs", "HiGHS", "IterTools", "JuMP", "Legolas", "LinearSolve", "Logging", "LoggingExtras", "MetaGraphsNext", "OrdinaryDiffEq", "PreallocationTools", "SQLite", "SciMLBase", "SparseArrays", "SparseConnectivityTracer", "StructArrays", "Tables", "TerminalLoggers", "TimerOutputs", "TranscodingStreams"]
deps = ["Accessors", "Arrow", "BasicModelInterface", "CodecZstd", "ComponentArrays", "Configurations", "DBInterface", "DataInterpolations", "DataStructures", "Dates", "DiffEqCallbacks", "EnumX", "FiniteDiff", "ForwardDiff", "Graphs", "HiGHS", "IterTools", "JuMP", "Legolas", "LinearSolve", "Logging", "LoggingExtras", "MetaGraphsNext", "OrdinaryDiffEq", "PreallocationTools", "SQLite", "SciMLBase", "SparseArrays", "SparseConnectivityTracer", "StructArrays", "Tables", "TerminalLoggers", "TranscodingStreams"]
path = "core"
uuid = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635"
version = "2024.10.0"
Expand Down
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
TestEnv = "1e6cf692-eddd-4d53-88a5-2d735e33781b"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
2 changes: 0 additions & 2 deletions core/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ SparseConnectivityTracer = "9f842d2f-2579-4b1d-911e-f412cf18a3f5"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"

[weakdeps]
Expand Down Expand Up @@ -88,7 +87,6 @@ Tables = "1"
TerminalLoggers = "0.1.7"
Test = "<0.0.1, 1"
TestItemRunner = "1"
TimerOutputs = "0.5"
TranscodingStreams = "0.9, 0.10, 0.11"
julia = "1.10"

Expand Down
6 changes: 0 additions & 6 deletions core/src/Ribasim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,8 @@ using Tables: Tables, AbstractRow, columntable
# Wrapper around a vector of structs to easily retrieve the same field from all elements.
using StructArrays: StructVector

# TODO remove, not used
using TimerOutputs: TimerOutputs, TimerOutput, @timeit_debug

export libribasim

const to = TimerOutput()
TimerOutputs.complement!()

include("schema.jl")
include("config.jl")
using .config
Expand Down
1 change: 0 additions & 1 deletion core/src/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ end

@option struct Logging <: TableOption
verbosity::LogLevel = Info
timing::Bool = false
end

@option struct Allocation <: TableOption
Expand Down
15 changes: 2 additions & 13 deletions core/src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ function Model(config::Config)::Model
error("Database file not found")
end

# Setup timing logging
if config.logging.timing
TimerOutputs.enable_debug_timings(Ribasim) # causes recompilation (!)
end

# All data from the database that we need during runtime is copied into memory,
# so we can directly close it again.
db = SQLite.DB(db_path)
Expand Down Expand Up @@ -135,9 +130,7 @@ function Model(config::Config)::Model
end
RHS = ODEFunction(water_balance!; jac_prototype)

@timeit_debug to "Setup ODEProblem" begin
prob = ODEProblem(RHS, u0, timespan, parameters)
end
prob = ODEProblem(RHS, u0, timespan, parameters)
@debug "Setup ODEProblem."

callback, saved = create_callbacks(parameters, config, saveat)
Expand All @@ -152,7 +145,7 @@ function Model(config::Config)::Model
# https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/
# Not all keyword arguments (e.g. `dt`) support `nothing`, in which case we follow
# https://github.com/SciML/OrdinaryDiffEq.jl/blob/v6.57.0/src/solve.jl#L10
@timeit_debug to "Setup integrator" integrator = init(
integrator = init(
prob,
alg;
progress = true,
Expand All @@ -173,10 +166,6 @@ function Model(config::Config)::Model
)
@debug "Setup integrator."

if config.logging.timing
@show Ribasim.to
end

if config.allocation.use_allocation && is_active(parameters.allocation)
set_initial_allocation_mean_flows!(integrator)
end
Expand Down
1 change: 0 additions & 1 deletion core/test/docs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ autodiff = true # optional, default true
[logging]
# defines the logging level of Ribasim
verbosity = "info" # optional, default "info", can otherwise be "debug", "warn" or "error"
timing = false # optional, whether to log debug timing statements

[results]
# These results files are always written
Expand Down
3 changes: 1 addition & 2 deletions docs/reference/usage.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ subgrid | Bool | Compute and output more detailed water levels.

## Logging settings

The following entries can be set in the configuration in the `[logging]` section.
The following can be set in the configuration in the `[logging]` section.

entry | type | description
----------------- | ------ | -----------
verbosity | String | Verbosity level: debug, info, warn, or error.
timing | Bool | Enable timings.

# GeoPackage database and Arrow tables {#sec-geopackage}

Expand Down
3 changes: 0 additions & 3 deletions python/ribasim/ribasim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,9 @@ class Logging(ChildModel):
----------
verbosity : Verbosity
The verbosity of the logging: debug/info/warn/error (Optional, defaults to info)
timing : Bool
Enable timings (Optional, defaults to False)
"""

verbosity: Verbosity = Verbosity.info
timing: bool = False


class Node(pydantic.BaseModel):
Expand Down

0 comments on commit d0494c1

Please sign in to comment.