Ipopt.jl icon indicating copy to clipboard operation
Ipopt.jl copied to clipboard

Ipopt_jll with LBT

Open amontoison opened this issue 2 years ago • 61 comments

close #6

I updated and recompiled MUMPS_seq_jll / Ipopt_jll with libblastrampoline. We can easily switch the BLAS backend now with the version 300.1400.401 of Ipopt_jll.

import LinearAlgebra, OpenBLAS32_jll
LinearAlgebra.BLAS.lbt_forward(OpenBLAS32_jll.libopenblas_path)

or

import LinearAlgebra, MKL_jll
LinearAlgebra.BLAS.lbt_forward(MKL_jll.libmkl_rt_path)

Because Ipopt_jll and MUMPS_seq_jll are compiled with LBT_jll now, we must add OpenBLAS32_jll as dependency here to have a least one 32 bit BLAS/LAPACK backend.

amontoison avatar Aug 24 '22 02:08 amontoison

Can we test with MKL on CI machines?

odow avatar Aug 24 '22 02:08 odow

Can we test with MKL on CI machines?

Yes, you just need to add MKL_jll as a test dependency. This simple modification should work.

@testset "C" begin
    include("C_wrapper.jl")
end

@testset "MathOptInterface" begin
    include("MOI_wrapper.jl")
end

import LinearAlgebra, MKL_jll
LinearAlgebra.BLAS.lbt_forward(MKL_jll.libmkl_rt_path)

@testset "C" begin
    include("C_wrapper.jl")
end

@testset "MathOptInterface" begin
    include("MOI_wrapper.jl")
end

amontoison avatar Aug 24 '22 02:08 amontoison

Codecov Report

Base: 91.52% // Head: 93.22% // Increases project coverage by +1.70% :tada:

Coverage data is based on head (7441c41) compared to base (7162015). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #327      +/-   ##
==========================================
+ Coverage   91.52%   93.22%   +1.70%     
==========================================
  Files           4        4              
  Lines         743      797      +54     
==========================================
+ Hits          680      743      +63     
+ Misses         63       54       -9     
Impacted Files Coverage Δ
src/Ipopt.jl 100.00% <100.00%> (ø)
src/utils.jl 99.58% <0.00%> (+0.07%) :arrow_up:
src/MOI_wrapper.jl 91.20% <0.00%> (+2.42%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Aug 24 '22 02:08 codecov[bot]

Windows segfault seems related: https://github.com/jump-dev/Ipopt.jl/runs/7986459839?check_suite_focus=true

Does LBT not work on Windows?

odow avatar Aug 24 '22 02:08 odow

Windows segfault seems related: https://github.com/jump-dev/Ipopt.jl/runs/7986459839?check_suite_focus=true

Does LBT not work on Windows?

I never tested LBT on Windows. I don't know if it's related to the new version of MUMPS (5.5.1) or LBT. I also use LBT for HSL.jl but Windows was not tested.

amontoison avatar Aug 24 '22 02:08 amontoison

Windows segfault seems related: https://github.com/jump-dev/Ipopt.jl/runs/7986459839?check_suite_focus=true

Does LBT not work on Windows?

It seems to be related to OpenBLAS32. We should test with v0.3.10 and v0.3.12 to see if we also have this error.

amontoison avatar Aug 24 '22 03:08 amontoison

The null pointer suggests that something isn't loaded properly.

@ViralBShah is there anything we need to do for LBT on Windows?

odow avatar Aug 24 '22 04:08 odow

Not to the best of my knowledge. @giordano perhaps.

ViralBShah avatar Aug 24 '22 05:08 ViralBShah

I suggest passing all the arguments to lbt_forward to make sure we are not clearing the ilp64 symbols.

ViralBShah avatar Aug 24 '22 05:08 ViralBShah

Also why such an old OpenBLAS32?

ViralBShah avatar Aug 24 '22 05:08 ViralBShah

Also, perhaps we want to only forward if the user has not already set up a forward. Otherwise you have to load packages in the right order so that MKL.jl forwards are not overwritten by this package for example. Eventually we need a better Julia wide mechanism to use Preferences to pick BLAS etc.

ViralBShah avatar Aug 24 '22 05:08 ViralBShah

Also, perhaps we want to only forward if the user has not already set up a forward. Otherwise you have to load packages in the right order so that MKL.jl forwards are not overwritten by this package for example. Eventually we need a better Julia wide mechanism to use Preferences to pick BLAS etc.

Is it possible to detect if the user has already set up a 32 bits BLAS/LAPACK backend ?

amontoison avatar Aug 24 '22 05:08 amontoison

Is it possible to detect if the user has already set up a 32 bits BLAS/LAPACK backend ?

Yes, LBT allows you to query with BLAS.lbt_get_config()

ViralBShah avatar Aug 24 '22 13:08 ViralBShah

Does LBT not work on Windows?

Julia base uses LBT by default, and so this is checked in Julia base CI etc. Also MKL.jl CI tests Windows, and it works fine. We don't do anything special there, AFAICT.

ViralBShah avatar Aug 24 '22 13:08 ViralBShah

is there anything we need to do for LBT on Windows?

I'm not aware of anything special being needed for Windows

giordano avatar Aug 24 '22 13:08 giordano

Can someone fix the CI and re-trigger?

ViralBShah avatar Aug 24 '22 14:08 ViralBShah

I added a check for LP64 BLAS, but the problem is still there.

odow avatar Aug 24 '22 21:08 odow

Does it matter that OpenBLAS32_jll and OpenBLAS_jll are different versions?

odow avatar Aug 24 '22 21:08 odow

It shouldn't really matter, but one can never be 100% sure.

ViralBShah avatar Aug 24 '22 21:08 ViralBShah

Let's test with 0.3.20 and see if that helps?

ViralBShah avatar Aug 24 '22 21:08 ViralBShah

Ah. 3.20 isn't supported on Julia v1.8

odow avatar Aug 24 '22 21:08 odow

So even when we don't forward, Windows still hits the same issue. Perhaps this is unrelated to LBT?

odow avatar Aug 25 '22 00:08 odow

The messages in the log files suggest that the BLAS/LAPACK are not being loaded on 1.8. I'm taking a look. I see the same error locally on mac on 1.8 and nightly.

ViralBShah avatar Aug 25 '22 03:08 ViralBShah

Ah I didn't realize that the lbt_forward was currently disabled with the if false flag. Turning it on, the tests go through fine, although I have yet to test on Windows. It is good to set clear = false for lbt_forward as well - I believe it is the default, but best to be deliberate about it.

ViralBShah avatar Aug 25 '22 20:08 ViralBShah

Ah I didn't realize that the lbt_forward was currently disabled with the if false flag

I disabled it to check if we get the same fault without forwarding. We do, so I wonder if the problem lies elsewhere?

I've re-enabled with clear = false

odow avatar Aug 25 '22 21:08 odow

Yes, I see what you were doing. It suggests the problem is perhaps elsewhere with Ipopt. Do we know if this version of Ipopt works on windows? Perhaps we should try with an earlier version?

I'll try to see if I can reproduce on a Windows machine. Something is clearly giving it a null pointer.

ViralBShah avatar Aug 25 '22 21:08 ViralBShah

It says it crashes in line 219 in C_wrapper tests, which is just the function call to the tests. Can we run the tests temporarily in a script or something - with the hope that we get a more direct failing test case?

ViralBShah avatar Aug 25 '22 21:08 ViralBShah

CI was passing a few days ago on Julia v1.7 with these versions: image

I just kicked off #328 to see if it's a Julia v1.8 thing.

I'll modify the test script for this PR

odow avatar Aug 25 '22 21:08 odow

Yes, I see what you were doing. It suggests the problem is perhaps elsewhere with Ipopt. Do we know if this version of Ipopt works on windows? Perhaps we should try with an earlier version?

I'll try to see if I can reproduce on a Windows machine. Something is clearly giving it a null pointer.

For Julia 1.6 or 1.7, we have Ipopt 3.14.4 + MUMPS_seq 5.4.1 + OpenBLAS32. For Julia >= 1.8, we have Ipopt 3.14.4 + MUMPS_seq 5.5.1 + LBT (with this PR).

If the issue comes from MUMPS_seq, we never tested the version 5.5.1 on Windows.

amontoison avatar Aug 25 '22 21:08 amontoison

That's weird. The issue is in CreateIpoptProblem. This is the line that triggers:

https://github.com/amontoison/Ipopt.jl/blob/fc9fd16cb8a00fb2e9457f6324989c2fc4160f7e/test/C_wrapper.jl#L137

which calls

https://github.com/amontoison/Ipopt.jl/blob/fc9fd16cb8a00fb2e9457f6324989c2fc4160f7e/src/C_wrapper.jl#L164-L294

For Julia 1.6 or 1.7, we have Ipopt 3.14.4 + MUMPS_seq 5.4.1 + OpenBLAS32.

Also work on Julia v1.8 with those versions.

odow avatar Aug 25 '22 21:08 odow