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

Segmentation fault: #68

Open
bc0n opened this issue May 3, 2024 · 14 comments
Open

Segmentation fault: #68

bc0n opened this issue May 3, 2024 · 14 comments

Comments

@bc0n
Copy link

bc0n commented May 3, 2024

Julia Version 1.10.3 via juliaup 1.10.3+0.x64.w64.mingw32 on win10, [7e558dbc] ArbNumerics v1.5.0

julia> using ArbNumerics
julia>  besseli(0,ArbReal(1.0))
1.2660658777520083355982446252147175376
julia> elliptic_e( ArbFloat(0.2), ArbFloat(0.8) )
Segmentation fault
@JeffreySarnoff
Copy link
Owner

elliptic_e expects one argument, not two. That argument can be complex.

using ArbNumerics
re = ArbFloat(0.2)
im = ArbFloat(0.8)
cplx = ArbComplex(re, im)
elliptic_e(cplx)
elliptic_e(ArbComplex(ArbReal(0.2), ArbReal(0.8))

@bc0n
Copy link
Author

bc0n commented May 6, 2024

I'm using the incomplete elliptic defined at

function elliptic_e(phi::ArbFloat{P}, modulus::ArbFloat{P}) where {P}
to calculate the arc length of an ellipse, as in https://github.com/mechanomy/Geometry2D.jl/blob/ab6bf6a1f5d47dbf4a235eb23177ed6e02ec826d/src/Ellipse2D.jl#L52C27-L52C55

The test that's failing is calling elliptic_e(ArbFloat(-1.3438),ArbFloat(-5.25)), a case which succeeded when committed on 7/12/2023. Between then and now ArbTypes.jl was introduced..?

@JeffreySarnoff
Copy link
Owner

Hi Ben,
I have asked Klaus to take a look at this. Thank you for bringing it to our attention.

@JeffreySarnoff JeffreySarnoff reopened this May 8, 2024
@KlausC
Copy link
Collaborator

KlausC commented May 8, 2024

Hi @bc0n , I failed to reconstruct this issue. Can you start a clean environment and reproduce the error?
It would be interesting to see the output of ]st st -m st -m -o of your active env.

Here is my output from Linux - I have no windows available to test, unfortunately.

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

(@v1.10) pkg> activate .
  Activating project at `/tmp/Arb`

(Arb) pkg> instantiate
  Downloaded artifact: FLINT
Precompiling project...
  3 dependencies successfully precompiled in 4 seconds. 16 already precompiled.

julia> 

julia> using ArbNumerics

julia> elliptic_e(ArbFloat(-1.3438),ArbFloat(-5.25))
-2.313226393263641543571401003117683631289359015094346

(Arb) pkg> st
Status `/tmp/Arb/Project.toml`
  [7e558dbc] ArbNumerics v1.5.0

(Arb) pkg> st -m -o
Status `/tmp/Arb/Manifest.toml`
⌅ [e134572f] FLINT_jll v200.900.9+0 (<v300.100.300+0): ArbNumerics, Arb_jll
⌅ [656ef2d0] OpenBLAS32_jll v0.3.24+0 (<v0.3.27+1): julia


(Arb) pkg> st -m
Status `/tmp/Arb/Manifest.toml`
  [7e558dbc] ArbNumerics v1.5.0
  [ffbed154] DocStringExtensions v0.9.3
  [14197337] GenericLinearAlgebra v0.3.11
  [92d709cd] IrrationalConstants v0.2.2
  [692b3bcd] JLLWrappers v1.5.0
  [2ab3a3ac] LogExpFunctions v0.3.27
  [21216c6a] Preferences v1.4.3
  [0d4725de] Readables v0.3.3
  [276daf66] SpecialFunctions v2.4.0
  [d9960996] Arb_jll v200.2300.0+0
⌅ [e134572f] FLINT_jll v200.900.9+0
⌅ [656ef2d0] OpenBLAS32_jll v0.3.24+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [781609d7] GMP_jll v6.2.1+6
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [3a97d323] MPFR_jll v4.2.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

@bc0n
Copy link
Author

bc0n commented May 8, 2024

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a550 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 12 × AMD Ryzen 5 1600X Six-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver1)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
Environment:
  JULIA_PKG_DEVDIR = W:\sync\mechgits\julia
(CleanArbNumerics) pkg> st
Project CleanArbNumerics v0.1.0
Status `W:\sync\mechgits\dev\CleanArbNumerics\Project.toml`
  [7e558dbc] ArbNumerics v1.5.0
(CleanArbNumerics) pkg> st -m -o
Project CleanArbNumerics v0.1.0
Status `W:\sync\mechgits\dev\CleanArbNumerics\Manifest.toml`
⌅ [e134572f] FLINT_jll v200.900.9+0 (<v300.100.300+0): ArbNumerics, Arb_jll
⌅ [656ef2d0] OpenBLAS32_jll v0.3.24+0 (<v0.3.27+1): julia
(CleanArbNumerics) pkg> st -m
Project CleanArbNumerics v0.1.0
Status `W:\sync\mechgits\dev\CleanArbNumerics\Manifest.toml`
  [7e558dbc] ArbNumerics v1.5.0
  [ffbed154] DocStringExtensions v0.9.3
  [14197337] GenericLinearAlgebra v0.3.11
  [92d709cd] IrrationalConstants v0.2.2
  [692b3bcd] JLLWrappers v1.5.0
  [2ab3a3ac] LogExpFunctions v0.3.27
  [21216c6a] Preferences v1.4.3
  [0d4725de] Readables v0.3.3
  [276daf66] SpecialFunctions v2.4.0
  [d9960996] Arb_jll v200.2300.0+0
⌅ [e134572f] FLINT_jll v200.900.9+0
⌅ [656ef2d0] OpenBLAS32_jll v0.3.24+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [781609d7] GMP_jll v6.2.1+6
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [3a97d323] MPFR_jll v4.2.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
julia> elliptic_e(ArbFloat(-1.3438),ArbFloat(-5.25))

=> segfault crashes the terminal

@bc0n
Copy link
Author

bc0n commented May 8, 2024

Reverting to Julia 1.6 it works:

julia> using ArbNumerics
julia> elliptic_e(ArbFloat(-1.3),ArbFloat(-5.25))
-2.206560606640109255190917667431457867084148343251624

julia> versioninfo()
Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: AMD Ryzen 5 1600X Six-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver1)
Environment:
  JULIA_PKG_DEVDIR = W:\sync\mechgits\julia

(CleanArbNumerics16) pkg> st
     Project CleanArbNumerics16 v0.1.0
      Status `W:\sync\mechgits\dev\CleanArbNumerics16\Project.toml`
  [7e558dbc] ArbNumerics v1.5.0

(CleanArbNumerics16) pkg> st -m
     Project CleanArbNumerics16 v0.1.0
      Status `W:\sync\mechgits\dev\CleanArbNumerics16\Manifest.toml`
  [7e558dbc] ArbNumerics v1.5.0
  [d360d2e6] ChainRulesCore v1.23.0
  [9e997f8a] ChangesOfVariables v0.1.8
  [34da2185] Compat v4.15.0
  [ffbed154] DocStringExtensions v0.9.3
  [14197337] GenericLinearAlgebra v0.3.11
  [3587e190] InverseFunctions v0.1.14
  [92d709cd] IrrationalConstants v0.2.2
  [692b3bcd] JLLWrappers v1.5.0
  [2ab3a3ac] LogExpFunctions v0.3.27
  [21216c6a] Preferences v1.4.3
  [0d4725de] Readables v0.3.3
  [276daf66] SpecialFunctions v2.4.0
  [d9960996] Arb_jll v200.2300.0+0
  [e134572f] FLINT_jll v200.900.9+0
  [656ef2d0] OpenBLAS32_jll v0.3.12+1
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [8e850b90] libblastrampoline_jll v3.1.0+2
  [0dad84c5] ArgTools
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [f43a241f] Downloads
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [ca575930] NetworkOptions
  [44cfe95a] Pkg
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [fa267f1f] TOML
  [a4e569a6] Tar
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll
  [781609d7] GMP_jll
  [deac9b47] LibCURL_jll
  [29816b5a] LibSSH2_jll
  [3a97d323] MPFR_jll
  [c8ffd9c3] MbedTLS_jll
  [14a3606d] MozillaCACerts_jll
  [05823500] OpenLibm_jll
  [83775a58] Zlib_jll
  [8e850ede] nghttp2_jll
  [3f19e933] p7zip_jll

@JeffreySarnoff
Copy link
Owner

does substituting ArbReal for ArbFloat work for you?

julia> using ArbNumerics

julia> elliptic_e(ArbReal(-1.3438), ArbReal(-5.25))
-2.313226393263641543571401003118

@JeffreySarnoff
Copy link
Owner

@bc0n ^

@bc0n
Copy link
Author

bc0n commented May 8, 2024

@JeffreySarnoff Substituting ArbReal also crashes...

@bc0n
Copy link
Author

bc0n commented May 8, 2024

Back in 1.10 x64, I get

$ julia --debug-info=2 -ie 'using ArbNumerics; @show elliptic_e(ArbFloat(-1.38),ArbFloat(-5.25));'
Exception (FLINT memory_manager). Unable to allocate memory (888).
Exception (FLINT memory_manager). Unable to allocate memory ((base)

@JeffreySarnoff
Copy link
Owner

I created a new environment, then added ArbNumerics.
I got ArbNumerics v1.5.0 .. however
[d9960996] + Arb_jll v200.2300.0+0 forced FLINT_jll to downgrade to v200.900.0+0 (from v3??)
⌅ [e134572f] + FLINT_jll v200.900.9+0
and ⌅ [656ef2d0] + OpenBLAS32_jll v0.3.24+0 also downgraded (pbly not involved directly .. but idk)

FLINT was structurally modified recently -- I have not tried to use the current version inside ArbNumerics
(although that is important to do for algorithmic coherence over time).

A mismatch of expected C API within /src/libarb/Flint2.jl would segfault and kill the REPL..
This or something like it is the likely culprit. [unless it is this and some other thing, or just the other thing :)]

I cannot address this now :(

pkg> add ArbNumerics
   Resolving package versions...
    Updating `C:\Users\MrJSa\.julia\projects\newpkgs\Project.toml`
  [7e558dbc] + ArbNumerics v1.5.0
    Updating `C:\Users\MrJSa\.julia\projects\newpkgs\Manifest.toml`
  [7e558dbc] + ArbNumerics v1.5.0
  [ffbed154] + DocStringExtensions v0.9.3
  [14197337] + GenericLinearAlgebra v0.3.11
  [92d709cd] + IrrationalConstants v0.2.2
  [692b3bcd] + JLLWrappers v1.5.0
  [2ab3a3ac] + LogExpFunctions v0.3.27
  [21216c6a] + Preferences v1.4.3
  [0d4725de] + Readables v0.3.3
  [276daf66] + SpecialFunctions v2.4.0
  [d9960996] + Arb_jll v200.2300.0+0
⌅ [e134572f] + FLINT_jll v200.900.9+0
⌅ [656ef2d0] + OpenBLAS32_jll v0.3.24+0
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL v0.6.4
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.10.0
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [fa267f1f] + TOML v1.0.3
  [a4e569a6] + Tar v1.10.0
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.1.0+0
  [781609d7] + GMP_jll v6.2.1+6
  [deac9b47] + LibCURL_jll v8.4.0+0
  [e37daf67] + LibGit2_jll v1.6.4+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [3a97d323] + MPFR_jll v4.2.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.2+1
  [14a3606d] + MozillaCACerts_jll v2023.1.10
  [4536629a] + OpenBLAS_jll v0.3.23+4
  [05823500] + OpenLibm_jll v0.8.1+2
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850b90] + libblastrampoline_jll v5.8.0+1
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`

@JeffreySarnoff
Copy link
Owner

To know if this is the fix requires adapting to the new FLINT_lib and Arb_lib .. that requires the better part of a week
-- unless .. (maybe there is a faster way -- I'll look over the weekend)

@JeffreySarnoff
Copy link
Owner

It seems to be a Windows dynamic library snafu (as Klaus does not see the issue).

@JeffreySarnoff
Copy link
Owner

@bc0n In case of emergency -- the author of Arb provides a well travelled and up to date python interface (mpmath)
https://mpmath.org/doc/current/functions/elliptic.html

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

No branches or pull requests

3 participants