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

blastrampoline on julia-1.10 #296

Open
kalmarek opened this issue Aug 27, 2024 · 1 comment
Open

blastrampoline on julia-1.10 #296

kalmarek opened this issue Aug 27, 2024 · 1 comment

Comments

@kalmarek
Copy link
Collaborator

Since SCS libraries link with openblas32 it makes sense to link them against blastrampoline in julia-1.10 (after it is announced the new lts); How should we proceed with switching to libblastrampoline?

Options:

  1. Dropping support for julia <1.10 and going fully through lbt
  2. splitting our codepaths for julia [1.6-1.10) and [1.10 - ).

In both cases running with lbt requires manually forwarding LP64 blas:

(SCS) pkg> st
Project SCS v2.0.1
Status `~/.julia/dev/SCS/Project.toml`
  [b8f27783] MathOptInterface v1.31.1
  [ae029012] Requires v1.3.0
⌅ [656ef2d0] OpenBLAS32_jll v0.3.24+0
  [f4f2fc5b] SCS_jll v3.2.7+0 `~/.julia/dev/SCS_jll`
  [2f01184e] SparseArrays v1.10.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`

julia> using SCS

julia> using Test

julia> include("test/test_problems.jl")
test_options (generic function with 1 method)

julia> using LinearAlgebra

julia> LinearAlgebra.BLAS.lbt_get_config()
LinearAlgebra.BLAS.LBTConfig
Libraries: 
└ [ILP64] libopenblas64_.so

julia> test_options(SCS.DirectSolver)
------------------------------------------------------------------
	       SCS v3.2.7 - Splitting Conic Solver
	(c) Brendan O'Donoghue, Stanford University, 2012
------------------------------------------------------------------
problem:  variables n: 5, constraints m: 8
cones: 	  l: linear vars: 8
settings: eps_abs: 1.0e-04, eps_rel: 1.0e-04, eps_infeas: 1.0e-07
	  alpha: 1.50, scale: 1.00e-01, adaptive_scale: 1
	  max_iters: 100000, normalize: 1, rho_x: 1.00e-06
	  acceleration_lookback: 10, acceleration_interval: 10
	  compiled with openmp parallelization enabled
lin-sys:  sparse-direct-amd-qdldl
	  nnz(A): 12, nnz(P): 0
Error: no BLAS/LAPACK library loaded!
[...]
Error: no BLAS/LAPACK library loaded!
------------------------------------------------------------------
 iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
------------------------------------------------------------------
Error: no BLAS/LAPACK library loaded!
[...]
Error: no BLAS/LAPACK library loaded!
     0|1.94e-318 2.76e-313 1.25e-309  0.00e+00  1.00e-01  6.70e-04 
Error: no BLAS/LAPACK library loaded!
Error: no BLAS/LAPACK library loaded!
Error: no BLAS/LAPACK library loaded!
WARNING - large complementary slackness residual: 0.000000
Error: no BLAS/LAPACK library loaded!
Error: no BLAS/LAPACK library loaded!
Error: no BLAS/LAPACK library loaded!
------------------------------------------------------------------
status:  solved
timings: total: 6.79e-04s = setup: 4.40e-04s + solve: 2.38e-04s
	 lin-sys: 3.39e-06s, cones: 1.68e-06s, accel: 4.00e-08s
------------------------------------------------------------------
objective = 0.000000
------------------------------------------------------------------
Test Failed at /home/kalmar/.julia/dev/SCS/test/test_problems.jl:757
  Expression: isapprox((solution.x)' * args.c, -99.0; rtol = 0.0001)
   Evaluated: isapprox(0.0, -99.0; rtol = 0.0001)

ERROR: There was an error during testing

however after

julia> using OpenBLAS32_jll

julia> LinearAlgebra.BLAS.lbt_forward(OpenBLAS32_jll.libopenblas)
4864

things run as they are expected:

julia> LinearAlgebra.BLAS.lbt_get_config()
LinearAlgebra.BLAS.LBTConfig
Libraries: 
├ [ILP64] libopenblas64_.so
└ [ LP64] libopenblas.so

julia> test_options(SCS.DirectSolver)
------------------------------------------------------------------
	       SCS v3.2.7 - Splitting Conic Solver
	(c) Brendan O'Donoghue, Stanford University, 2012
------------------------------------------------------------------
problem:  variables n: 5, constraints m: 8
cones: 	  l: linear vars: 8
settings: eps_abs: 1.0e-04, eps_rel: 1.0e-04, eps_infeas: 1.0e-07
	  alpha: 1.50, scale: 1.00e-01, adaptive_scale: 1
	  max_iters: 100000, normalize: 1, rho_x: 1.00e-06
	  acceleration_lookback: 10, acceleration_interval: 10
	  compiled with openmp parallelization enabled
lin-sys:  sparse-direct-amd-qdldl
	  nnz(A): 12, nnz(P): 0
------------------------------------------------------------------
 iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
------------------------------------------------------------------
     0| 1.26e+02  3.95e+00  1.22e+03 -6.94e+02  1.00e-01  1.91e-04 
   125| 7.47e-05  4.88e-06  3.10e-04 -9.90e+01  1.00e-01  6.02e-04 
------------------------------------------------------------------
status:  solved
timings: total: 6.08e-04s = setup: 1.20e-04s + solve: 4.88e-04s
	 lin-sys: 4.49e-05s, cones: 1.49e-05s, accel: 2.59e-04s
------------------------------------------------------------------
objective = -98.999835
------------------------------------------------------------------

[...]

What is nice is that things run equally well with MKL:

julia> using MKL

julia> MKL.lbt_forward_to_mkl()

julia> LinearAlgebra.BLAS.lbt_get_config()
LinearAlgebra.BLAS.LBTConfig
Libraries: 
├ [ILP64] libmkl_rt.so
└ [ LP64] libmkl_rt.so

julia> test_options(SCS.DirectSolver)
------------------------------------------------------------------
	       SCS v3.2.7 - Splitting Conic Solver
	(c) Brendan O'Donoghue, Stanford University, 2012
------------------------------------------------------------------
problem:  variables n: 5, constraints m: 8
cones: 	  l: linear vars: 8
settings: eps_abs: 1.0e-04, eps_rel: 1.0e-04, eps_infeas: 1.0e-07
	  alpha: 1.50, scale: 1.00e-01, adaptive_scale: 1
	  max_iters: 100000, normalize: 1, rho_x: 1.00e-06
	  acceleration_lookback: 10, acceleration_interval: 10
	  compiled with openmp parallelization enabled
lin-sys:  sparse-direct-amd-qdldl
	  nnz(A): 12, nnz(P): 0
------------------------------------------------------------------
 iter | pri res | dua res |   gap   |   obj   |  scale  | time (s)
------------------------------------------------------------------
     0| 1.26e+02  3.95e+00  1.22e+03 -6.94e+02  1.00e-01  2.83e-04 
   125| 7.47e-05  4.88e-06  3.10e-04 -9.90e+01  1.00e-01  7.04e-03 
------------------------------------------------------------------
status:  solved
timings: total: 7.05e-03s = setup: 1.94e-04s + solve: 6.86e-03s
	 lin-sys: 2.92e-05s, cones: 7.87e-06s, accel: 6.68e-03s
------------------------------------------------------------------
objective = -98.999835
------------------------------------------------------------------

[...]
@odow
Copy link
Member

odow commented Aug 27, 2024

We can just do what we do for Ipopt:
https://github.com/jump-dev/Ipopt.jl/blob/4c156461ef1fda3c9f015520197afda4e8ca3e26/src/Ipopt.jl#L13-L19

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

No branches or pull requests

2 participants