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

Documentation building bug (related to Measurements.jl) #1378

Closed
ArseniyKholod opened this issue Mar 29, 2023 · 7 comments
Closed

Documentation building bug (related to Measurements.jl) #1378

ArseniyKholod opened this issue Mar 29, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@ArseniyKholod
Copy link
Contributor

ArseniyKholod commented Mar 29, 2023

While building Documentation 16: Differentiable programming fails.
In part Propagating errors using Measurements.jl we are using following code:

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
                                    solver, uEltype=Measurement{Float64})

And finally LoadError appears (building summary)

Differentiable programming: Error During Test at /home/runner/work/Trixi.jl/Trixi.jl/docs/literate/make.jl:59
Got exception outside of a @test
LoadError: MethodError: no method matching Float64(::Measurement{Float64})

I looked in History of Measurements.jl. They released new version 2.9.0 last week with following:

  • New methods value(::Missing) and uncertainty(::Missing) (#127, #128).

  • one(::Measurement{T}) now returns one(T), instead of an instance of Measurement{T} (#134, #135). This change should not breaking (and hence the major version was not increased), unless you were relying on the previous incorrect return type of one(::Measurement{T}), which did not follow the precise semantic of the one function.

Then I downgraded version of Measurements.jl to previous one - 2.8.0. And after that error disappeared. I think that Trixi or related packages use function one(uEltype) (explicit or implicit) somewhere.

Like a temporal solution I added following code to 16: Differentiable programming in my PR.

using Pkg #hide #md
Pkg.add(name="Measurements", version="2.8.0") #hide #md

Now Documentation check doesn't fail. But it doesn't seem to be a good solution.

@ArseniyKholod ArseniyKholod added the bug Something isn't working label Mar 29, 2023
@ArseniyKholod ArseniyKholod changed the title Documentation building bug with Measurement.jl Documentation building bug (related to Measurement.jl) Mar 29, 2023
@ArseniyKholod ArseniyKholod changed the title Documentation building bug (related to Measurement.jl) Documentation building bug (related to Measurements.jl) Mar 29, 2023
@ArseniyKholod
Copy link
Contributor Author

ArseniyKholod commented Mar 29, 2023

According to error's stacktrace (building summary) problem seems to be in OrdinaryDiffEq.jl or
DiffEqBase.jl. Because error appears after calling

sol = solve(ode, BS3(), save_everystep=false);

in Propagating errors using Measurements.jl

@ranocha
Copy link
Member

ranocha commented Mar 31, 2023

Since the stacktrace you linked above comes from calculate_residuals! (see https://github.com/trixi-framework/Trixi.jl/actions/runs/4545729357/jobs/8013456987#step:6:1116), it looks to me like it's a problem in OrdinaryDiffEq.jl. You you please very that by running a simple ODE with OrdinaryDiffEq.jl and Measurements.jl? If that works with the old version of Measurements.jl (it should) but not the new one, we have tracked the problem better. Then, you could open an issue there.

@ArseniyKholod
Copy link
Contributor Author

ArseniyKholod commented Mar 31, 2023

I tested following simple ODE with OrdinaryDiffEq.jl and Measurements.jl:

using OrdinaryDiffEq, Measurements, Plots
u₀ = 1.0  ± 0.1
tspan = (0.0, 1.0)
radioactivedecay(u, p, t) = -5.730 * u
prob = ODEProblem(radioactivedecay, u₀, tspan)
sol = solve(prob, Tsit5())
plot(sol)

With old (2.8.0) and new (2.9.0) version of Measurements it works exactly in the same way

@ArseniyKholod
Copy link
Contributor Author

ArseniyKholod commented Mar 31, 2023

Remark to previous comment. Problem actually appears in OrdinaryDiffEq. But was invisible in easiest example with only scalar variable.
I tried ODE's examples with vector-variable u, in this case vector of value and it's derivative:

using OrdinaryDiffEq, Plots, Measurements
const g = 9.81±0.1
L = 1.0±0.1
u₀ = [0±0.0, π / 2±0.1]
tspan = (0.0, 6.3)
function simplependulum(du, u, p, t)
    θ = u[1]
    dθ = u[2]
    du[1] = dθ
    du[2] = -(g / L) * sin(θ)
end
prob = ODEProblem(simplependulum, u₀, tspan)
sol = solve(prob, Tsit5())

Error appears only with latest version Measurements.jl@v2.9.0
ERROR: LoadError: MethodError: no method matching Float64(::Measurement{Float64})
OrdinaryDiffEq might incorrect handle Vector{Measurement{Float64}}.
Stacktrace also comes from calculate_residuals!.

@sloede
Copy link
Member

sloede commented Apr 1, 2023

Thanks for the investigation! With this, it might make sense to open an issue with the OrdinaryDiffEq package. If you do, please make sure to

  1. describe the problem (as you did here),
  2. include the MWE code,
  3. include the full error message (including the stacktrace!), and
  4. link to this issue here for reference.

It would also be great if you could tag Hendrik and me by adding something like "cc @ranocha @sloede" in your issue, such that we are aware of it.

@ranocha
Copy link
Member

ranocha commented Apr 1, 2023

I can't reproduce your example. Please tell us the version numbers of everything involved (Julia, Measurements, OrdinaryDiffEq) and the full stacktrace.

@ArseniyKholod
Copy link
Contributor Author

ArseniyKholod commented Apr 1, 2023

Thank you for response!
I updated all packages, error doesn't appear any more.
20 hours ago problem was solved in RecursiveArrayTools.jl. Because of the same issue created in
DifferentialEquations.jl.
See PR Handle measurement units #260.
Trixi documentation now builds successful according to your commit(https://github.com/trixi-framework/Trixi.jl/actions/runs/4582247950/jobs/8092347449)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants