scs icon indicating copy to clipboard operation
scs copied to clipboard

linsys solver using hipsparse

Open kalmarek opened this issue 1 year ago • 4 comments

This is just a proof of concept of how far can I push the idea of "instruct chatGPT to write software for me", hip-edition ;) Made only possible by the amazing design and the documentation of scs. Thanks @bodono!

At the moment this

  • compiles with make DLONG=0 USE_OPENMP=1 hip, after the adjustments of necessary paths in scs.mk,
  • unfortunately it still doesn't run as expected:
./out/demo_socp_hip 100      
seed : 1728819068

A is 400 by 100, with 10 nonzeros per column.
A has 1000 nonzeros (2.500000% dense).
Nonzeros of A take 0.000007 GB of storage.
Row idxs of A take 0.000004 GB of storage.
Col ptrs of A take 0.000000 GB of storage.

ScsCone information:
Zero cone rows: 40
LP cone rows: 120
Number of second-order cones: 8, covering 240 rows, with sizes
[20, 34, 14, 51, 22, 31, 1, 67, ]
Number of rows covered is 400 out of 400.

true pri opt = 0.816196
true dua opt = 0.816196
------------------------------------------------------------------
               SCS v3.2.7 - Splitting Conic Solver
        (c) Brendan O'Donoghue, Stanford University, 2012
------------------------------------------------------------------
problem:  variables n: 100, constraints m: 400
cones:    z: primal zero / dual free vars: 40
          l: linear vars: 120
          q: soc vars: 240, qsize: 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:  hipsparse-direct
          nnz(A): 1000, nnz(P): 0
Error in init -- bufferSize: 10.
Error in init -- analysis: 10.
Error in init -- numeric fact: 10.
Error in factorisation: 10.
ERROR: init_lin_sys_work failure
Failure:could not initialize work
true pri opt = 0.816196
true dua opt = 0.816196
scs pri obj=  nan
scs dua obj = -nan

since hipsparseDcsrsv2_bufferSize refuses to compute the buffer size with HIPSPARSE_STATUS_NOT_SUPPORTED(10), which most probably is related to kkt matrix being symmetric. I've asked about this here: https://github.com/ROCm/hipSPARSE/issues/541

kalmarek avatar Oct 13 '24 12:10 kalmarek

Oh cool! Thanks for looking into this, it would be great to get this in. Happy to take a look once you have it ready.

bodono avatar Oct 16 '24 15:10 bodono

it seems that rocsparse doesn't support symmetric matrices at the moment.

kalmarek avatar Oct 16 '24 20:10 kalmarek

That's a shame, I presume it's because we only store the lower triangular part? If so we could always fill in the upper triangular part, but we would lose some efficiency.

bodono avatar Oct 17 '24 12:10 bodono

but also they lack the integration of pivoting etc. I think this is a bit premature, but I'll try something else, given my motivation recently ;)

kalmarek avatar Oct 17 '24 19:10 kalmarek