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

ReadOnlyMemoryError #98

Closed
yakir12 opened this issue Jan 11, 2025 · 8 comments · Fixed by JuliaPackaging/Yggdrasil#10268
Closed

ReadOnlyMemoryError #98

yakir12 opened this issue Jan 11, 2025 · 8 comments · Fixed by JuliaPackaging/Yggdrasil#10268

Comments

@yakir12
Copy link
Contributor

yakir12 commented Jan 11, 2025

trying a simple ParametricSpline example errors with ReadOnlyMemoryError:

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.2 (2024-12-01)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.11) pkg> activate --temp
  Activating new project at `/tmp/jl_Yywwx7`

(jl_Yywwx7) pkg> add Dierckx
   Resolving package versions...
    Updating `/tmp/jl_Yywwx7/Project.toml`
  [39dd38d3] + Dierckx v0.5.3
    Updating `/tmp/jl_Yywwx7/Manifest.toml`
  [39dd38d3] + Dierckx v0.5.3
  [692b3bcd] + JLLWrappers v1.7.0
  [21216c6a] + Preferences v1.4.3
  [cd4c43a9] + Dierckx_jll v0.1.1+0
  [56f22d72] + Artifacts v1.11.0
  [ade2ca70] + Dates v1.11.0
  [8f399da3] + Libdl v1.11.0
  [de0858da] + Printf v1.11.0
  [fa267f1f] + TOML v1.0.3
  [4ec0a83e] + Unicode v1.11.0
  [e66e0078] + CompilerSupportLibraries_jll v1.1.1+0
Precompiling project...
  1 dependency successfully precompiled in 1 seconds. 8 already precompiled.

julia> using Dierckx

julia> X = rand(2, 10)
2×10 Matrix{Float64}:
 0.249525  0.467703  0.588399  0.874943  0.971398  0.790435  0.969108  0.0201033  0.708681  0.3892
 0.369256  0.823229  0.21343   0.267268  0.498935  0.667902  0.981211  0.739794   0.411529  0.633819

julia> spl = ParametricSpline(X)
ParametricSpline(knots=[0.0,0.255327 … 0.738611,1.0] (8 elements), k=3, extrapolation="nearest", residual=0.0)

julia> spl(2)
ERROR: ReadOnlyMemoryError()
Stacktrace:
 [1] _evaluate(t::Vector{Float64}, c::Vector{Float64}, k::Int64, x::Int64, bc::Int64)
   @ Dierckx ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:279
 [2] (::Dierckx.var"#13#14"{Vector{Float64}, Int64, Int64, Int64})(v::Vector{Float64})
   @ Dierckx ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:583
 [3] mapslices(f::Dierckx.var"#13#14"{Vector{Float64}, Int64, Int64, Int64}, A::Matrix{Float64}; dims::Vector{Int64})
   @ Base ./abstractarray.jl:3281
 [4] _evaluate(t::Vector{Float64}, c::Matrix{Float64}, k::Int64, x::Int64, bc::Int64)
   @ Dierckx ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:581
 [5] evaluate
   @ ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:590 [inlined]
 [6] (::ParametricSpline)(x::Int64)
   @ Dierckx ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:1114
 [7] top-level scope
   @ REPL[6]:1

I should mention that testing Dierckx also fails with ReadOnlyMemoryError.

@yakir12
Copy link
Contributor Author

yakir12 commented Jan 11, 2025

I found out that v0.5.1 is the latest version that works for me (i.e. 0.5.2 and 0.5.3 do not).

@JTHesse
Copy link

JTHesse commented Jan 13, 2025

I'm seeing the same error.

@jbphyswx
Copy link

jbphyswx commented Jan 13, 2025

Seeing the same error!

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.5 (2024-08-27)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> a = Float64[1,2,3]; b = Float64[1,2,3]
3-element Vector{Float64}:
 1.0
 2.0
 3.0

julia> using Dierckx

julia> Dierckx.Spline1D(a,b;k=1).(1)
ERROR: ReadOnlyMemoryError()
Stacktrace:
 [1] _evaluate(t::Vector{Float64}, c::Vector{Float64}, k::Int64, x::Int64, bc::Int64)
   @ Dierckx ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:279
 [2] evaluate
   @ ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:296 [inlined]
 [3] Spline1D
   @ ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:1112 [inlined]
 [4] _broadcast_getindex_evalf
   @ ./broadcast.jl:709 [inlined]
 [5] _broadcast_getindex
   @ ./broadcast.jl:682 [inlined]
 [6] getindex
   @ ./broadcast.jl:636 [inlined]
 [7] copy
   @ ./broadcast.jl:918 [inlined]
 [8] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0}, Nothing, Spline1D, Tuple{Int64}})
   @ Base.Broadcast ./broadcast.jl:903
 [9] top-level scope
   @ REPL[3]:1

julia> Dierckx.Spline1D(a,b;k=1).(b)
ERROR: ReadOnlyMemoryError()
Stacktrace:
  [1] _evaluate(t::Vector{Float64}, c::Vector{Float64}, k::Int64, x::Float64, bc::Int64)
    @ Dierckx ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:279
  [2] evaluate
    @ ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:296 [inlined]
  [3] Spline1D
    @ ~/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:1112 [inlined]
  [4] _broadcast_getindex_evalf
    @ ./broadcast.jl:709 [inlined]
  [5] _broadcast_getindex
    @ ./broadcast.jl:682 [inlined]
  [6] getindex
    @ ./broadcast.jl:636 [inlined]
  [7] macro expansion
    @ ./broadcast.jl:1004 [inlined]
  [8] macro expansion
    @ ./simdloop.jl:77 [inlined]
  [9] copyto!
    @ ./broadcast.jl:1003 [inlined]
 [10] copyto!
    @ ./broadcast.jl:956 [inlined]
 [11] copy
    @ ./broadcast.jl:928 [inlined]
 [12] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, Spline1D, Tuple{Vector{Float64}}})
    @ Base.Broadcast ./broadcast.jl:903
 [13] top-level scope
    @ REPL[4]:1

julia> Dierckx.Spline1D(a,b;k=1).(a)

[1405477] signal (11.1): Segmentation fault
in expression starting at REPL[5]:1
splev_ at /home/jbenjami/.julia/artifacts/84929b756ffb0c74c96cd2779caa935fa733436c/lib/libddierckx.so (unknown line)
_evaluate at /home/jbenjami/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:279
evaluate at /home/jbenjami/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:296 [inlined]
Spline1D at /home/jbenjami/.julia/packages/Dierckx/TDOyl/src/Dierckx.jl:1112 [inlined]
_broadcast_getindex_evalf at ./broadcast.jl:709 [inlined]
_broadcast_getindex at ./broadcast.jl:682 [inlined]
getindex at ./broadcast.jl:636 [inlined]

@bclyons12
Copy link

This also appears to be due to the new v0.1.1+0 of Dierckx_jll, just like #99. Downgrading to v0.1.0 of Dierckx_jll fixes this issue.

giordano added a commit to giordano/Yggdrasil that referenced this issue Jan 14, 2025
People have reported issues with the new
version (JuliaMath/Dierckx.jl#98,
JuliaMath/Dierckx.jl#99) but no one tried to debug it.
At least this should give users a more usable version for some time.
@giordano
Copy link
Member

If someone wanted to fix the issue, the arguments of a bunch of functions were changed:

This is what I found with a 2-minute look at the history of upstream

giordano added a commit to giordano/Yggdrasil that referenced this issue Jan 14, 2025
People have reported issues with the new
version (JuliaMath/Dierckx.jl#98,
JuliaMath/Dierckx.jl#99) but no one tried to debug it.
At least this should give users a more usable version for some time.
giordano added a commit to JuliaPackaging/Yggdrasil that referenced this issue Jan 14, 2025
People have reported issues with the new
version (JuliaMath/Dierckx.jl#98,
JuliaMath/Dierckx.jl#99) but no one tried to debug it.
At least this should give users a more usable version for some time.
@bclyons12
Copy link

This was only fixed because scipy was downgraded in the latest Dierckx_jll release. It would be good to keep an issue open to make this work with the latest scipy.

@giordano
Copy link
Member

I'm already working on it

@giordano
Copy link
Member

#102. Depends on JuliaPackaging/Yggdrasil#10269, but tests pass locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants