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

libhsl.dylib won't load on MacOS (HSL_jll.jl.v2024.11.28) #14

Closed
artkuo opened this issue Jan 10, 2025 · 10 comments
Closed

libhsl.dylib won't load on MacOS (HSL_jll.jl.v2024.11.28) #14

artkuo opened this issue Jan 10, 2025 · 10 comments

Comments

@artkuo
Copy link

artkuo commented Jan 10, 2025

I had a few issues with HSL_jll.

  1. Testing instructions "2.3.2 Usage with Ipopt.jl" I got a library loading failure for libhsl.dylib. I was able to get it to work by explicitly removing quarantine xattr -d com.apple.quarantine lib.hsl.dylib while in its directory. I think unquarantine of zip file doesn't automatically unquarantine all the contents? In any case for me after unquarantine, the MA57 example now works.

  2. Linear solver MA97 fails. The second example in 2.3.2:

    julia> set_attribute(model, "linear_solver", "ma97")
    
    julia> optimize!(model)
    Exception of type: DYNAMIC_LIBRARY_FAILURE in file "Common/IpLibraryLoader.cpp" at line 198:
     Exception message: dlsym(0x7de1dfb0, MA97_DEFAULT_CONTROL_D): symbol not found
    
    EXIT: Library loading failure.
    

    I wonder if I need to unquarantine another file?

  3. Testing "2.3.1 Usage with HSL_jll" also fails for a similar reason.

    julia> x = ma97_solve(A,b)
    ERROR: could not load symbol "ma97_default_control_d":
    dlsym(0x7de1dfb0, ma97_default_control_d): symbol not found
    Stacktrace:
      [1] ma97_default_control_d
        @ ~/.julia/packages/HSL/sFS3X/src/C/libhsl/hsl_ma97.jl:165 [inlined]
      [2] #ma97_control_variant#13
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:78 [inlined]
      [3] ma97_control_variant
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:70 [inlined]
      [4] ma97_csc(n::Int64, colptr::Vector{Int32}, rowval::Vector{Int32}, nzval::Vector{Float64}; kwargs::@Kwargs{})
        @ HSL ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:144
      [5] ma97_csc
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:137 [inlined]
      [6] #Ma97#18
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:191 [inlined]
      [7] Ma97
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:187 [inlined]
      [8] ma97_solve!(A::SparseMatrixCSC{Float64, Int64}, b::Vector{Float64}; matrix_type::Symbol)
        @ HSL ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:320
      [9] ma97_solve!
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:314 [inlined]
     [10] #ma97_solve#33
        @ ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:305 [inlined]
     [11] ma97_solve(A::SparseMatrixCSC{Float64, Int64}, b::Vector{Float64})
        @ HSL ~/.julia/packages/HSL/sFS3X/src/hsl_ma97.jl:296
     [12] top-level scope
        @ REPL[35]:1
    

I tried nm -g libhsl.dylib and the symbol does seem to exist:

0000000000b1e890 T _ma97_default_control_d

Also, ma57_solve works. That's the extent of my knowledge, and I don't know why ma97 doesn't work.

@amontoison
Copy link
Member

amontoison commented Jan 10, 2025

The symbol has a prefix _. I don't know why we have this extra underscore.

@nimgould @jfowkes @AndrewLister-STFC

You can load the library so you don't need to remove quarantine on other files.
I don't have a Mac so I don't know if we need to unquarantine something else than the archive.

@jfowkes May I ask to try it on the Mac Mini if you find time? We need to update the documentation if it's enough to unquarantine the archive.

@amontoison
Copy link
Member

@artkuo Do you also have the version 2023.X.Y of HSL_jll.jl?
If yes, is everything working?

@artkuo
Copy link
Author

artkuo commented Jan 10, 2025

I did have a previous version that was working (dunno version, but I do an empty directory coinhsl-2021.05.05), but I believe I never tried ma97. Unfortunately I over-wrote whichever version I had before.

@artkuo
Copy link
Author

artkuo commented Jan 10, 2025

Ah, I see that I can download an old version. I installed 2023.11.7 on Julia 1.11.2 on Mac Pro laptop, and ma97 works for both Ipopt and HSL.jl examples.

(Although ma57_solve with HSL.jl fails on ERROR: ReadOnlyMemoryError(); it works for same example in 2024.11.28).

@amontoison
Copy link
Member

Was it the same error for MA57 then the one in this issue:
JuliaSmoothOptimizers/HSL.jl#211 ?

@artkuo
Copy link
Author

artkuo commented Jan 10, 2025

I believe MA57 error is different, because it's not a segfault. The error is

julia> x = ma57_solve(A,b)
ERROR: ReadOnlyMemoryError()
Stacktrace:
 [1] ma57cd(job::Int64, n::Int32, fact::Vector{…}, lfact::Int32, ifact::Vector{…}, lifact::Int32, nrhs::Int64, rhs::Vector{…}, lrhs::Int32, w::Vector{…}, lw::Int64, iw1::Vector{…}, icntl::Vector{…}, info::Vector{…})
   @ HSL ~/.julia/packages/HSL/YVjOf/src/Fortran/ma57.jl:19
 [2] ma57_solve!(ma57::Ma57{Float64}, b::Vector{Float64}, work::Vector{Float64}; job::Symbol)
   @ HSL ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:463
 [3] ma57_solve!
   @ ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:456 [inlined]
 [4] #ma57_solve#20
   @ ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:429 [inlined]
 [5] ma57_solve
   @ ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:427 [inlined]
 [6] ma57_solve(A::SparseMatrixCSC{Float64, Int64}, b::Vector{Float64})
   @ HSL ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:628
Some type information was truncated. Use `show(err)` to see complete types.

This case is for Julia 1.11.2 with ]dev HSL_jll.jl-2023.11.7, where add HSL installs HSL v0.4.3. Here, MA97 works where it doesn't for HSL 2024.11.28. Also, MA57 does work in the Ipopt example.

@AndrewLister-STFC
Copy link

AndrewLister-STFC commented Jan 10, 2025

Thanks for the feedback! I'll test the examples on the mac today.

Update I've just booted up the mac mini we have (aarch) and tested the 2.3.1 and 2.3.2 examples with the latest HSL_jll and it all seemed to work. I also checked the symbol names. Do you need to unquarantine the header files in include?

I'm running:

bash> julia --version
julia version 1.11.2

MA57 and HSL_MA97 are different in that HSL_MA97 uses fortran modules and has a c interface, whereas MA57 is an older style and so has less moving parts from a build perspective.

Here's what I did (note I didn't have any quarantine as I downloaded it on my laptop and scp'd it to the mac):
2.3.2:

bash> tar -xzf HSL_jll.jl.v2024.11.28.tar.gz
bash> julia project=.
julia> ]dev ./HSL_jll.jl.v2024.11.28/

julia> ]add JuMP Ipopt

julia> using JuMP

julia> import Ipopt, HSL_jll

julia> model = Model(Ipopt.Optimizer)
A JuMP Model
├ solver: Ipopt
├ objective_sense: FEASIBILITY_SENSE
├ num_variables: 0
├ num_constraints: 0
└ Names registered in the model: none

julia> @variable(model, x)
x

julia> @objective(model, Min, (x - 2)^2)
x² - 4 x + 4

julia> set_attribute(model, "hsllib", HSL_jll.libhsl_path)

julia> set_attribute(model, "linear_solver", "ma57")

julia> optimize!(model)

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit https://github.com/coin-or/Ipopt
******************************************************************************

This is Ipopt version 3.14.17, running with linear solver ma57.

Number of nonzeros in equality constraint Jacobian...:        0
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        1

Total number of variables............................:        1
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        0
                     variables with only upper bounds:        0
Total number of equality constraints.................:        0
Total number of inequality constraints...............:        0
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  4.0000000e+00 0.00e+00 4.00e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  0.0000000e+00 0.00e+00 0.00e+00  -1.0 2.00e+00    -  1.00e+00 1.00e+00f  1

Number of Iterations....: 1

                                   (scaled)                 (unscaled)
Objective...............:   0.0000000000000000e+00    0.0000000000000000e+00
Dual infeasibility......:   0.0000000000000000e+00    0.0000000000000000e+00
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   0.0000000000000000e+00    0.0000000000000000e+00
Overall NLP error.......:   0.0000000000000000e+00    0.0000000000000000e+00


Number of objective function evaluations             = 2
Number of objective gradient evaluations             = 2
Number of equality constraint evaluations            = 0
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 1
Total seconds in IPOPT                               = 0.004

EXIT: Optimal Solution Found.

julia> set_attribute(model, "linear_solver", "ma97")

julia> optimize!(model)
This is Ipopt version 3.14.17, running with linear solver ma97.

Number of nonzeros in equality constraint Jacobian...:        0
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        1

Total number of variables............................:        1
                     variables with only lower bounds:        0
                variables with lower and upper bounds:        0
                     variables with only upper bounds:        0
Total number of equality constraints.................:        0
Total number of inequality constraints...............:        0
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  4.0000000e+00 0.00e+00 4.00e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  0.0000000e+00 0.00e+00 0.00e+00  -1.0 2.00e+00    -  1.00e+00 1.00e+00f  1

Number of Iterations....: 1

                                   (scaled)                 (unscaled)
Objective...............:   0.0000000000000000e+00    0.0000000000000000e+00
Dual infeasibility......:   0.0000000000000000e+00    0.0000000000000000e+00
Constraint violation....:   0.0000000000000000e+00    0.0000000000000000e+00
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   0.0000000000000000e+00    0.0000000000000000e+00
Overall NLP error.......:   0.0000000000000000e+00    0.0000000000000000e+00


Number of objective function evaluations             = 2
Number of objective gradient evaluations             = 2
Number of equality constraint evaluations            = 0
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 1
Total seconds in IPOPT                               = 0.004

EXIT: Optimal Solution Found.

nm:

bash> nm -g HSL_jll.jl.v2024.11.28/override/lib/aarch64-apple-darwin-libgfortran5/libhsl.dylib | grep "ma97_solve"
00000000003e9be0 T ___hsl_ma97_complex_MOD_ma97_solve_fredholm_complex
00000000003e8ba0 T ___hsl_ma97_complex_MOD_ma97_solve_mult_complex
00000000003eb150 T ___hsl_ma97_complex_MOD_ma97_solve_one_complex
0000000000408750 T ___hsl_ma97_double_MOD_ma97_solve_fredholm_double
0000000000407890 T ___hsl_ma97_double_MOD_ma97_solve_mult_double
0000000000409ae0 T ___hsl_ma97_double_MOD_ma97_solve_one_double
0000000000447be0 T ___hsl_ma97_double_complex_MOD_ma97_solve_fredholm_double_complex
0000000000446ba0 T ___hsl_ma97_double_complex_MOD_ma97_solve_mult_double_complex
0000000000449150 T ___hsl_ma97_double_complex_MOD_ma97_solve_one_double_complex
0000000000427400 T ___hsl_ma97_single_MOD_ma97_solve_fredholm_single
0000000000426540 T ___hsl_ma97_single_MOD_ma97_solve_mult_single
0000000000428790 T ___hsl_ma97_single_MOD_ma97_solve_one_single
0000000000b1d030 T _ma97_solve_c
0000000000b21310 T _ma97_solve_d
0000000000b1dc50 T _ma97_solve_fredholm_c
0000000000b21f50 T _ma97_solve_fredholm_d
0000000000b26190 T _ma97_solve_fredholm_s
0000000000b2a4a0 T _ma97_solve_fredholm_z
0000000000b25580 T _ma97_solve_s
0000000000b29860 T _ma97_solve_z
bash> nm -g HSL_jll.jl.v2024.11.28/override/lib/aarch64-apple-darwin-libgfortran5/libhsl.dylib | grep "ma57_solve"
0000000000203880 T ___hsl_ma57_double_MOD_ma57_solve1
0000000000204890 T ___hsl_ma57_double_MOD_ma57_solve2
000000000020d1c0 T ___hsl_ma57_single_MOD_ma57_solve1
000000000020e1a0 T ___hsl_ma57_single_MOD_ma57_solve2
0000000000b005c0 T _ma57_solve_d
0000000000b02cc0 T _ma57_solve_s

2.3.1:

bash> julia --project=.
julia> ]add HSL LinearAlgebra SparseArrays

julia> using HSL

julia> using LinearAlgebra

julia> using SparseArrays

julia> A = sprand(100, 100, 0.1)
100×100 SparseMatrixCSC{Float64, Int64} with 978 stored entries:
⎡⠠⠀⠐⠀⠀⡀⠨⠀⠀⠠⠂⠀⠄⠈⠀⠀⠂⠀⠰⡀⠀⠤⠀⠀⠀⠈⠄⠀⠂⠀⠀⠀⠐⠄⠀⡀⢂⡁⠀⠀⠀⠈⡐⠀⠀⠀⠀⠀⡀⡀⎤
⎢⠀⢀⢀⡆⠀⠄⠑⠀⠀⠀⠀⠐⡐⡁⠘⠀⠀⠀⠀⠂⢀⠠⠁⠄⠀⠀⠀⠀⡠⠌⠀⠀⠀⢉⠬⠀⠀⠒⠀⠈⠄⢁⠀⠀⢀⠀⠀⠀⠢⠁⎥
⎢⠂⠀⠀⠀⠀⠁⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⠈⠠⢀⠔⠀⡐⠀⠀⠀⢄⠀⠀⠀⠀⠁⠘⠀⠄⠀⢐⠀⠁⠅⠀⠀⠈⠀⠠⠀⠒⠀⢑⠀⎥
⎢⠂⠐⠃⠀⠀⠀⠈⠐⡀⠀⠄⠀⡀⠁⠀⠀⠂⠀⠀⠀⢀⠄⡀⠁⠂⠀⢀⠀⠀⠀⠀⢀⠀⠁⡀⠐⠀⠀⠀⠀⡀⠀⠣⢈⠀⠀⠩⠨⠀⠀⎥
⎢⠀⠀⠀⢀⠁⠀⠔⠀⣄⠃⠀⠀⠁⠀⠠⠀⠁⠀⠀⠀⠀⠐⠈⠀⠈⠀⠀⠁⠀⠀⠀⠂⠂⠈⠀⠀⠀⠀⠀⡀⠀⠃⠠⠂⠖⠑⠀⡐⡀⠄⎥
⎢⠀⠂⠀⠀⠁⠂⡁⠀⠊⡀⢀⠀⠃⠀⠠⠀⠈⠁⠀⠀⠄⠂⠀⢀⠐⠈⠄⠁⠈⠁⠄⠀⡈⠈⠁⠈⠠⠀⠁⡀⠐⢈⠐⢀⠀⣀⡔⠀⠀⠀⎥
⎢⠁⠀⠐⠀⠢⠄⠄⠂⠄⠁⠠⣀⢀⠀⠂⢡⠐⢀⡀⠀⠀⠁⠀⠀⠀⠀⡀⢀⠐⠄⠀⠀⠑⠀⠀⡀⠐⢀⠁⠢⠈⠀⠄⢁⠄⠀⢐⠠⠀⠁⎥
⎢⠀⡁⠀⢀⠀⠀⠐⠀⢀⠀⠀⠐⡀⢀⠀⠀⠀⠀⡀⠀⠀⠄⠀⠐⠀⡀⠂⢀⠡⠐⠀⡄⠀⠠⠈⡀⠀⠀⠀⠀⠨⡀⠡⣅⡈⠀⠈⡂⠐⠊⎥
⎢⠀⠀⠀⠀⠄⠐⠀⠀⠀⠠⠀⠀⠀⠀⠀⢐⠀⠀⠀⠁⡀⢈⠰⠀⢀⠁⠁⠁⠠⠀⠀⠠⢀⠄⠔⠂⡆⠀⡀⠀⠖⠠⡀⠠⠀⠁⠀⠀⠀⡀⎥
⎢⠀⠂⠀⠀⠰⠢⠐⠉⠀⠀⠀⡀⠠⠈⡀⡂⠀⡈⡈⠠⠀⢤⡄⠀⠀⠀⠀⠀⠀⠀⠃⢢⠀⠠⠠⠈⠀⠀⠠⢀⠘⠠⠠⢗⠀⠈⢀⠀⠐⠔⎥
⎢⠠⠄⢌⠀⡀⠀⠈⡀⠀⠌⠀⠀⠀⠠⡄⠄⠢⢤⠂⠠⠊⠀⠠⠠⠴⠄⠐⠀⠀⢂⠑⠂⠀⠂⠀⠃⠀⠈⠀⠂⠁⠃⡀⠁⠀⠀⠀⠀⠰⠠⎥
⎢⠀⠀⠑⠀⡂⠀⠄⠄⠁⠃⡄⠀⡊⠀⠀⠲⠁⠁⠀⠈⠀⠀⠀⠄⠀⠀⢁⠂⠀⠀⠀⠀⠂⠀⠀⠒⠀⠐⠂⠤⠢⢀⠀⠈⠂⠀⠠⠀⠐⠄⎥
⎢⠀⠀⠀⠀⡀⠀⠀⠨⢀⠀⠀⠔⠠⠀⠠⠀⡀⠠⡀⠀⠁⠂⠉⠁⠂⠀⡍⠄⠐⠀⢀⠄⠄⠀⠀⣀⠈⢠⠁⢀⠐⠀⠀⡀⠂⠀⠀⠀⠀⠀⎥
⎢⡠⠠⡠⠀⠄⠀⠀⠀⡀⠁⠈⠀⠤⠠⠀⠆⠀⢀⠀⠐⠑⠂⢔⠠⡄⠁⠀⠀⠀⠀⠀⢀⠐⠀⢂⢄⠂⠎⠀⠐⠀⠀⡀⡀⠀⠀⠄⠀⢀⠐⎥
⎢⠀⠄⠂⢀⠀⠄⠐⢁⠪⡖⠀⠈⢐⠀⡃⠀⠆⡁⠀⠄⠠⡀⠀⠐⢂⠀⠔⠀⠀⠄⠀⢈⡀⠌⠀⠀⠀⠂⠐⠁⠠⠃⠂⠀⠀⠘⠀⠀⠀⠀⎥
⎢⠀⠀⠀⠌⠊⠐⢀⠁⠀⠐⠀⠀⠉⡑⠀⠠⠀⢄⠠⡄⠒⢀⠀⠀⠁⠁⠀⠂⠁⡀⠀⠀⠀⠀⠀⢀⡠⠠⠀⠀⠀⠀⢁⠀⢀⠐⠀⠀⢀⡀⎥
⎢⠀⠈⠁⡄⠀⢀⠂⢀⠀⡀⠀⠀⠔⠀⠈⠉⠂⢄⠅⠀⡀⠀⡀⠀⠂⠠⢀⠐⡀⠀⠀⢃⢀⠀⠤⠀⠂⠀⠀⠢⡀⠀⠀⡀⠀⠂⠠⠐⡀⠂⎥
⎢⠀⠂⠀⠁⠂⠀⠀⢠⠀⠀⠆⠀⠀⠐⠀⠄⠌⠀⠀⢉⠁⢁⡐⠀⠀⠁⠀⠀⠐⠀⠐⠌⡄⠐⠀⠀⡠⠀⠀⠀⠀⡠⠀⠀⠂⠀⠀⠨⡄⠀⎥
⎢⠤⠀⠀⢀⡂⠀⡄⠒⣡⢀⠠⠀⠀⠃⠀⠀⠀⠀⡀⠄⠀⠀⠀⠀⠀⠀⠀⢂⠂⠀⠠⠀⠁⠀⢀⠀⠀⠀⠁⠀⡀⢄⡀⠠⠑⠀⠀⠀⡀⠐⎥
⎢⠀⠀⠀⢈⡀⠈⡆⠀⠐⠁⢐⠀⠀⠂⠀⠀⠂⠐⠀⠆⡀⠠⠂⡢⠀⠀⠀⣄⠀⢀⠠⠀⠠⠐⠀⠈⡀⠀⠈⠈⡠⡍⡆⠀⠀⠂⠄⠁⡀⠀⎥
⎢⠂⢈⠀⢀⠀⠁⠀⠀⠀⠉⡀⠃⠀⠀⠈⠀⠀⠀⠐⠁⢀⡀⠀⠀⠀⠈⠂⠀⠀⠀⠰⠠⠈⠀⠀⠀⠀⢀⠐⠢⠐⠀⠀⡐⠀⠀⠈⠀⢀⠀⎥
⎢⠃⠀⠀⢀⠀⠀⢀⠀⡐⡔⢀⡀⠀⠀⡀⠠⠀⠀⡀⠁⡀⠀⠀⠐⠀⢠⠁⢈⠀⠥⠁⠀⠀⠈⠤⠠⠀⠀⠠⡂⠑⡈⠀⢀⠀⠀⠌⠀⠂⠊⎥
⎢⡀⠀⠀⠂⠈⠀⢀⠂⠀⠀⠀⠀⠐⠀⠀⠀⠀⠂⢂⠚⠐⣀⠀⠀⢀⠀⠠⠀⠀⡀⢠⠊⠄⠃⠅⠀⠠⠈⠄⠂⡀⠀⢀⣁⠡⠀⠀⠀⠐⠀⎥
⎢⠀⣐⠀⠃⠀⠀⠈⠠⢈⠄⠄⠃⠀⠀⠀⠉⠀⠠⠀⡐⠀⠡⠀⡀⡀⢠⠊⡀⠃⠀⠀⢃⢠⠀⠤⠀⠁⡀⠂⠀⡀⢈⠀⠊⠀⠀⠀⠈⠈⡀⎥
⎣⠄⠐⡀⠀⠀⠁⡀⠄⠀⠀⠀⢠⠰⠄⡁⠘⡀⠁⡐⠀⠀⠐⠀⠀⠀⠀⠄⠈⠈⠀⠂⠂⡐⠀⠁⡂⠁⠀⡄⢐⠀⡀⠀⠔⠅⠀⠀⠀⠠⠀⎦

julia> A = A + A'
100×100 SparseMatrixCSC{Float64, Int64} with 1848 stored entries:
⎡⠠⠂⠐⢀⠈⡀⢨⠀⠀⠠⠢⠀⠅⠈⠄⠠⠂⠀⠰⡀⠀⠦⠀⠀⠀⠈⠄⡊⠂⠄⠀⠀⡐⠄⠠⡀⢂⡃⠀⠀⡈⢈⡙⠀⠀⠈⢀⢠⣀⡁⎤
⎢⠐⢀⢠⡶⠀⠄⠙⠀⠀⢀⠀⠐⡐⡁⠘⢀⠀⠀⠀⠂⢂⠱⠑⠄⠀⠀⠀⠊⡨⢌⡀⠄⠁⢭⠬⠀⠀⢒⡀⢈⠄⢁⠀⢀⢠⠀⠤⠀⠢⠉⎥
⎢⠂⠠⠀⠄⠄⠁⠂⠀⠁⠀⠡⠀⠈⠆⠀⠀⢋⠉⠰⣂⠔⠈⡘⠈⠀⠈⢄⠁⠀⠄⢊⠁⠘⢀⠌⠀⢘⠈⡁⠍⠄⠀⠈⠀⠢⠀⠒⠀⢕⠀⎥
⎢⠂⠒⠓⠀⠈⠀⢊⠐⡐⠁⠅⠈⡠⠁⠐⠀⠂⠀⡔⠀⢂⠤⡀⠅⡂⡀⢀⠀⠔⢀⠄⢐⠈⢁⡀⣐⢠⠉⠈⠉⡀⠀⠣⢘⠠⠐⠫⡨⠀⠌⎥
⎢⠀⡀⠀⢀⠁⠀⠔⠈⣤⠛⠊⠠⠅⠁⠠⠐⠁⡀⠀⠀⡀⠔⠭⠀⠈⠐⠄⠉⢪⠦⢀⠂⠂⠨⠀⠀⠁⢚⠔⡀⡄⠃⢰⠮⠖⠑⠂⡔⡀⠄⎥
⎢⠈⠂⢀⠀⠁⠂⡁⠁⠊⡀⢀⠐⠃⢢⢠⠀⠈⠁⠀⠠⠄⠂⠀⢉⢐⠌⠆⠁⡈⠁⠄⠀⡈⠈⠉⠉⠠⠂⠑⡐⠴⢈⠐⢰⠀⣀⡴⠁⠀⣀⎥
⎢⡁⠁⠔⠨⠢⠄⠄⠊⠅⠁⠩⣀⢀⠐⠂⢩⠐⢀⡀⠂⠀⡁⠊⠈⠀⠂⡀⣃⠐⠔⢇⠠⠑⠁⢀⡀⠴⢀⠡⠢⠈⠀⠄⢁⠔⠀⢐⠠⠐⠇⎥
⎢⠀⡁⠒⢀⠀⠀⠐⠀⢀⠂⠀⠒⡌⣀⠀⠀⢀⢀⡠⠨⠀⠍⢠⡐⠀⡂⠢⢄⠩⠘⠀⡄⡆⠠⠈⡄⠀⠀⠀⠀⠪⡀⠡⣍⡈⠀⡌⡂⣑⠊⎥
⎢⠈⠀⠀⠀⡏⠐⠈⠀⠁⠠⠆⠀⠐⢀⠀⢐⠀⠀⡀⠡⡈⣎⠵⠀⢀⡉⠁⢁⠬⠡⠀⢤⢈⢄⠖⠃⡆⠀⣈⠀⠖⠠⡀⠠⠠⠁⠀⡀⠄⡈⎥
⎢⠐⠢⠠⠀⠰⢢⠐⠉⠀⠀⠀⡀⠠⠈⡀⡊⠄⡈⡊⡨⠈⣤⡄⠀⠀⠈⢀⠀⠀⠄⠃⢦⠁⠡⡤⢈⠀⠌⠠⢄⠜⠠⠤⢟⣨⠘⢀⠠⠐⠜⎥
⎢⠠⡄⢌⡐⡐⠁⠈⡔⢀⠌⠠⠁⠄⠠⡄⠄⡢⢬⠂⣤⠊⠀⠠⠠⠵⠄⠱⠀⠀⢢⠙⢂⠀⠊⠅⢃⠀⠈⠀⡊⠁⠳⡀⠉⠐⢠⠄⡀⢰⠠⎥
⎢⠀⠀⠑⠄⡒⠈⠄⠌⠃⠃⡄⢀⡊⠀⢀⠲⠑⠃⠀⠉⠀⡂⠀⠄⠇⠀⢑⡓⢀⠀⠀⠀⠂⠈⠐⠚⠀⠐⠪⡤⠢⢀⢀⠈⠂⠀⠠⠠⠐⠄⎥
⎢⡀⠀⠀⠀⡀⠀⠈⠨⢂⠀⡐⠔⠠⠀⠠⠠⡄⠰⡀⠀⠑⠇⠉⠁⠊⠀⡍⠍⠘⠐⢅⠄⠌⡀⠄⣀⠈⢠⠁⢀⡐⠀⠀⣀⠂⠐⠀⣈⠀⠀⎥
⎢⡠⠡⡠⠀⠄⠑⠀⠐⡄⠁⠌⠁⠤⢨⠈⢆⠅⢀⠀⠐⠑⠂⢵⠰⡇⠍⠀⠀⠐⠁⠠⢀⢐⠐⢂⢄⠢⢎⠀⢴⠈⠀⡁⣀⠀⠂⠎⠠⣀⠑⎥
⎢⠈⠄⡂⢎⠀⠄⠐⢁⠪⡖⠆⠈⢐⠄⣃⠂⠆⡃⠀⠄⠠⣀⠀⠐⢒⠀⠔⠀⠀⠄⠁⢨⡀⠌⠐⠀⠈⠂⠐⢁⠠⠃⠆⡄⠀⠸⠉⠀⠂⠀⎥
⎢⠀⠀⠀⠌⠎⠐⢀⢁⠠⠐⠀⠁⠉⡑⠀⠤⠀⣄⠩⣄⠳⢀⠀⠀⠁⠕⠀⢂⡁⣀⠀⠀⠤⢀⡐⢄⡠⠢⠀⠂⠐⡂⢁⠀⣠⠒⠤⢀⢨⡀⎥
⎢⠐⠌⡅⣄⠒⢀⠆⢀⡈⡀⡂⠈⠕⠀⠈⡉⠂⢔⠅⡀⡠⠀⡈⠀⠂⠡⢐⠐⡀⠌⠀⢃⢀⠐⢤⠉⠃⠀⢀⠢⡂⠀⡀⡀⠤⠃⠠⠒⡐⠊⎥
⎢⠀⠢⠂⠃⠂⠁⢀⢨⠀⠀⡇⠀⠀⠰⠂⠤⠼⠁⡀⢋⠥⢁⣰⠀⠀⢡⠈⢔⠐⠀⠐⢌⡄⠓⠀⠀⡠⠐⡀⠀⠀⡠⠀⡃⠃⠁⠀⠫⡥⠠⎥
⎢⠬⠰⢠⢀⡒⠐⡄⠒⣡⢀⠠⠂⠐⢃⠀⠀⠈⠉⡀⠄⡀⠀⢀⠀⠂⣀⡨⢆⠢⠀⠠⡊⠉⠀⢀⠊⠀⠀⠁⠈⡀⢄⡀⠠⡑⠂⠁⠠⡁⠐⎥
⎢⠀⠀⡀⢈⡅⠌⡆⠀⠐⠡⢑⠠⠡⡂⠀⠀⠂⠘⠀⢆⡠⠠⠊⡦⠁⢀⢀⣄⠔⢀⠠⠀⠠⡐⠀⠈⡁⠀⡊⠈⡰⡍⡦⠢⠠⠃⠌⠁⣀⢉⎥
⎢⡂⢈⠄⢁⠀⠁⠀⠈⠤⠉⡐⢃⠂⠀⠊⠢⠘⡁⠒⡁⢥⡀⠈⢂⠐⠈⠂⠀⠤⠂⠰⠠⠈⠈⠀⡠⠀⢌⡔⠮⠐⠀⡑⡰⠀⠈⡈⢈⢀⠠⎥
⎢⠓⠈⠀⢀⠂⠀⣉⢂⡰⡖⢐⣀⠄⢁⡅⢦⠀⡈⣤⢇⡄⠈⡀⠐⠀⢠⠁⢨⠈⠥⠁⠐⠀⠨⠤⠠⠀⡈⠨⡋⢑⡨⠀⢀⠄⢰⡬⠀⢂⠎⎥
⎢⡀⠀⠀⠒⠈⠂⢀⠂⢜⠁⠀⢠⠐⠁⠂⠈⠄⠂⣂⠚⠐⣀⠈⠀⢈⠀⠠⠀⣀⡀⢠⠚⠤⠃⠍⠀⠱⠈⠤⠂⡀⠀⢀⣁⠡⠂⠀⠀⠑⠁⎥
⎢⠀⣐⠀⠃⠘⠀⡋⡢⢈⠤⠔⠋⠐⡐⠢⠩⠀⠠⠀⡐⠀⠡⠀⡂⡀⢠⠊⡁⠃⠀⠀⢃⢠⠂⡤⡀⠁⡀⠆⠁⡂⢈⠂⠋⠀⠀⡀⠈⠈⡀⎥
⎣⠄⠸⡌⠂⠑⠑⡀⠄⠀⠌⠀⢠⠴⠄⡱⠘⡀⠡⣐⠄⠐⡒⠐⠄⠀⠀⢄⠘⠈⠀⠂⠲⡰⠈⠁⡋⢁⠈⡄⢘⠀⡐⡨⠔⠕⠀⠂⠠⠠⠂⎦

julia> b = rand(100)
100-element Vector{Float64}:
 0.19379672565075035
 0.3019155640208091
 0.47847004322799747
 0.2737976844628641
 0.7734333248041657
 0.7115190021508135
 0.10661027381356847
 0.5365622177039706
 0.48456815169110823
 0.5767473863426527
 0.49495044733526705
 0.27457194885285885
 0.7043053374844963
 ⋮
 0.2190540646432585
 0.1709608073785549
 0.44556676239927084
 0.8319385983780593
 0.1460812463083997
 0.982181879243103
 0.8121033474276085
 0.9564187921306119
 0.5597694911080818
 0.3753588492866138
 0.538826314469229
 0.46530800497742764

julia> x = ma97_solve(A, b)
100-element Vector{Float64}:
 -0.36471777164076297
  0.15167184056174476
 -0.9752581265084848
 -0.7052057836361664
 -1.0283124240789552
  1.3508214969189005
  0.7660755350778463
  1.2695171918455983
 -1.7091810899277604
  0.10356578517949745
  1.3796184906956999
  3.733375709463078
 -1.7021452352832336
  ⋮
  0.050597457094771384
  0.8241884108951516
 -1.79935931932601
  0.052641794557921354
  0.5954708126657974
  0.6507020658261136
  0.5184526365285395
 -1.3284708775414504
 -0.7246214263931191
 -0.8315104056000535
  0.6554531223410597
  2.839726607481972

@AndrewLister-STFC
Copy link

I believe MA57 error is different, because it's not a segfault. The error is

julia> x = ma57_solve(A,b)
ERROR: ReadOnlyMemoryError()
Stacktrace:
 [1] ma57cd(job::Int64, n::Int32, fact::Vector{…}, lfact::Int32, ifact::Vector{…}, lifact::Int32, nrhs::Int64, rhs::Vector{…}, lrhs::Int32, w::Vector{…}, lw::Int64, iw1::Vector{…}, icntl::Vector{…}, info::Vector{…})
   @ HSL ~/.julia/packages/HSL/YVjOf/src/Fortran/ma57.jl:19
 [2] ma57_solve!(ma57::Ma57{Float64}, b::Vector{Float64}, work::Vector{Float64}; job::Symbol)
   @ HSL ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:463
 [3] ma57_solve!
   @ ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:456 [inlined]
 [4] #ma57_solve#20
   @ ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:429 [inlined]
 [5] ma57_solve
   @ ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:427 [inlined]
 [6] ma57_solve(A::SparseMatrixCSC{Float64, Int64}, b::Vector{Float64})
   @ HSL ~/.julia/packages/HSL/YVjOf/src/hsl_ma57.jl:628
Some type information was truncated. Use `show(err)` to see complete types.

This case is for Julia 1.11.2 with ]dev HSL_jll.jl-2023.11.7, where add HSL installs HSL v0.4.3. Here, MA97 works where it doesn't for HSL 2024.11.28. Also, MA57 does work in the Ipopt example.

I think this is the same as the linked error just hitting a different problem.
If you run the following it should work:

julia> M = Ma57(A)
julia> ma57_factorize!(M)
julia> x = ma57_solve(M,b)

@artkuo
Copy link
Author

artkuo commented Jan 10, 2025

@AndrewLister-STFC is correct, this worked in 2023.11.7: julia> x = ma57_solve(M,b). The ma57_solve does error at the same line ma57.jl:19 so I guess it could be the same kind of problem, just causing a different error message.

As for the issue with ma97 2024, I deleted everything and followed a procedure like yours, and it now works. So somewhere maybe there was a quarantine still going on.

Thanks for your help and sorry for the false alarm.

@artkuo artkuo closed this as completed Jan 10, 2025
@AndrewLister-STFC
Copy link

AndrewLister-STFC commented Jan 13, 2025

No problem, glad we could help!

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