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

Cannot precompile Clarabel #171

Closed
StoffelOdw opened this issue Jun 5, 2024 · 14 comments
Closed

Cannot precompile Clarabel #171

StoffelOdw opened this issue Jun 5, 2024 · 14 comments

Comments

@StoffelOdw
Copy link

StoffelOdw commented Jun 5, 2024

Hi,

I am a newbie to Julia and tried to install Clarabel. When precompiling Clarabel, I got the following error:

(julia01) pkg> precompile
Precompiling project...
  ✗ Clarabel
  0 dependencies successfully precompiled in 5 seconds. 188 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

Clarabel [61c947e1-3e6d-4ee4-985a-eec8c727bd6e]

Failed to precompile Clarabel [61c947e1-3e6d-4ee4-985a-eec8c727bd6e] to "/Users/uwe/.julia/compiled/v1.10/Clarabel/jl_UnP2Al".
ERROR: LoadError: MethodError: no method matching Clarabel.GenPowerConeT(::Vector{Float64}, ::Int64)

Closest candidates are:
  Clarabel.GenPowerConeT(::Vector{Float64}, ::Int32)
   @ Clarabel ~/.julia/packages/Clarabel/dltFS/src/cones/cone_api.jl:40

Stacktrace:
 [1] __precompile_native()
   @ Clarabel ~/.julia/packages/Clarabel/dltFS/src/precompile.jl:46
 [2] macro expansion
   @ ~/.julia/packages/Clarabel/dltFS/src/Clarabel.jl:108 [inlined]
 [3] macro expansion
   @ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62 [inlined]
 [4] (::Clarabel.var"#141#142")()
   @ Clarabel ~/.julia/packages/Clarabel/dltFS/src/Clarabel.jl:107
 [5] (::Base.RedirectStdStream)(thunk::Clarabel.var"#141#142", stream::Base.DevNull)
   @ Base ./stream.jl:1429
 [6] top-level scope
   @ ~/.julia/packages/Clarabel/dltFS/src/Clarabel.jl:106
 [7] top-level scope
   @ stdin:3
in expression starting at /Users/uwe/.julia/packages/Clarabel/dltFS/src/Clarabel.jl:2
in expression starting at stdin:

(julia01) pkg> 

Can you help me, please?

Thank you,
Stoffel

@goulart-paul
Copy link
Member

goulart-paul commented Jun 5, 2024

That's very odd. What version of Julia is it, i.e. what do you get when you type VERSION in the terminal?

Edit : never mind, it looks like v1.10. I don't see why there should be a bug there, but will need to update version to check for myself.

@StoffelOdw
Copy link
Author

I'm running Julia 1.10.3 (2024-04-03) installed using Homebrew on macOS Ventura 13.6.3. Would be great, if you could reproduce this error (and give a hint to a solution).

thnx

@goulart-paul
Copy link
Member

I can't reproduce it on Mac for Julia 1.10.3, and I don't really understand what could cause that error.

What do you get if you do :

using LinearAlgebra
LinearAlgebra.BlasInt

@StoffelOdw
Copy link
Author

I get the following:

julia> using LinearAlgebra

julia> LinearAlgebra.BlasInt
Int32

julia> 

Could there be a conflict with other packages? My Project.toml is

[deps]
Clarabel = "61c947e1-3e6d-4ee4-985a-eec8c727bd6e"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

@goulart-paul
Copy link
Member

I think there is an implicit assumption throughout the code that LinearAlgebra.BlasInt is the same as Int64, and the fact that it isn't for you is the root cause. I think that's usually the case (i.e. nobody has previously reported this issue), but evidently not always. Either way I think it's a bug on our part.

I think it's fixable for you with just a one line change here, but that's not a satisfactory long term solution.

As to why your installation is configured that way.... for this I don't have a good answer, particular on OSX.

@StoffelOdw
Copy link
Author

I changed the line you mentionend in your last post and replaced LinearAlgebra.BlasIntwith Int64.

Result: IT WORKS!! :-)

I was able to run the sample in https://clarabel.org/stable/julia/getting_started_jl/ and everything worked fine.

Thank you so much for your help!!!

Do you think this will be fixed in a future version of Clarabel? And do you have an idea, when this will be available?

Thanks again!!

Stoffel

@goulart-paul
Copy link
Member

Yes, we will definitely fix it. I am not sure of a timeline yet since I would first like to understand when BlasInt is something other than Int64, since it might have an effect on solving for SDPs in particular. We will make it a high priority fix though since it's obviously not good for the package to crash like that as soon as it loads.

@StoffelOdw
Copy link
Author

Sounds good!

I did some google search and found, that the Int-type in https://github.com/JuliaLang/julia/blob/master/stdlib/LinearAlgebra/src/LinearAlgebra.jl depends on USE_BLAS64, which looks like a compilerflag (I guess).

On https://docs.julialang.org/en/v1/devdocs/build/distributing/ you will find the info:

On 32-bit architectures, Julia builds OpenBLAS to use 32-bit integers, while on 64-bit architectures, Julia builds OpenBLAS to use 64-bit integers (ILP64)

The Homebrew installation seems to be build as a 32-bit version of Julia, but I am running a M2 mac (which is 64-bit).

Hope this helps.

@StoffelOdw
Copy link
Author

StoffelOdw commented Jun 6, 2024

Found it: The Homebrew formula uses USE_BLAS64 = 0: julia.rb

So Homebrew builds the 32-bit version.

@goulart-paul
Copy link
Member

Found it: The Homebrew formula uses USE_BLAS64 = 0: julia.rb

So Homebrew builds the 32-bit version.

Thank you. This is very helpful and I am now able to reproduce the error using a homebrew install.

goulart-paul added a commit that referenced this issue Jun 6, 2024
@goulart-paul
Copy link
Member

Should be fixed and available in v0.9.0 via the package manager shortly.

@StoffelOdw
Copy link
Author

That's great news! So I should execute the command updatein the package manager from time to time?

@goulart-paul
Copy link
Member

Yes, you can just type

] update Clarabel

to update the package. Note the leading bracket, which enters the package manager. No need to do so regularly if you are happy with how it is working, although we are still actively adding features.

@StoffelOdw
Copy link
Author

I just did the update as you described and everything is working fine, now.
Thanks again for helping me and doing the fix so fast!!
Kind regards
Stoffel

goulart-paul added a commit that referenced this issue Jun 12, 2024
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

2 participants