cvxgrp / scs

Splitting Conic Solver
MIT License
553 stars 136 forks source link

linsys solver using hipsparse #293

Open kalmarek opened 1 month ago

kalmarek commented 1 month ago

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

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 
bodono commented 1 month ago

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.

kalmarek commented 1 month ago

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

bodono commented 1 month ago

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.

kalmarek commented 1 month ago

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 ;)