From d0494c1fed3fa62e313ae76bef8b9b088a79a4ae Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Mon, 26 Aug 2024 20:23:47 +0200 Subject: [PATCH] Remove TimerOutputs (#1749) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #1741. Note that this is still an indirect dependency. ``` (root) pkg> why TimerOutputs Ribasim → DiffEqCallbacks → NonlinearSolve → TimerOutputs Ribasim → OrdinaryDiffEq → NonlinearSolve → TimerOutputs ``` --- Manifest.toml | 4 ++-- Project.toml | 1 - core/Project.toml | 2 -- core/src/Ribasim.jl | 6 ------ core/src/config.jl | 1 - core/src/model.jl | 15 ++------------- core/test/docs.toml | 1 - docs/reference/usage.qmd | 3 +-- python/ribasim/ribasim/config.py | 3 --- 9 files changed, 5 insertions(+), 31 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 07b46a6aa..2512ea2a4 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -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" @@ -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" diff --git a/Project.toml b/Project.toml index 6dc28b0e5..d92b0b06a 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/core/Project.toml b/core/Project.toml index 88faf6540..ce3e4882c 100644 --- a/core/Project.toml +++ b/core/Project.toml @@ -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] @@ -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" diff --git a/core/src/Ribasim.jl b/core/src/Ribasim.jl index 16819d4a2..059a62d4e 100644 --- a/core/src/Ribasim.jl +++ b/core/src/Ribasim.jl @@ -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 diff --git a/core/src/config.jl b/core/src/config.jl index c7ef41eec..794a17477 100644 --- a/core/src/config.jl +++ b/core/src/config.jl @@ -114,7 +114,6 @@ end @option struct Logging <: TableOption verbosity::LogLevel = Info - timing::Bool = false end @option struct Allocation <: TableOption diff --git a/core/src/model.jl b/core/src/model.jl index 531c94d01..13d898336 100644 --- a/core/src/model.jl +++ b/core/src/model.jl @@ -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) @@ -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) @@ -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, @@ -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 diff --git a/core/test/docs.toml b/core/test/docs.toml index 9b2ed206c..e16a9d775 100644 --- a/core/test/docs.toml +++ b/core/test/docs.toml @@ -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 diff --git a/docs/reference/usage.qmd b/docs/reference/usage.qmd index 1da163aec..b77a15615 100644 --- a/docs/reference/usage.qmd +++ b/docs/reference/usage.qmd @@ -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} diff --git a/python/ribasim/ribasim/config.py b/python/ribasim/ribasim/config.py index 1557e921e..78dd50427 100644 --- a/python/ribasim/ribasim/config.py +++ b/python/ribasim/ribasim/config.py @@ -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):