RipQP.jl
RipQP.jl copied to clipboard
How to test RipQP.jl on GPU?
Is it also possible to explain what is the goal of the following GPU kernel? https://github.com/JuliaSmoothOptimizers/RipQP.jl/blob/main/src/gpu_utils.jl#L64
Get the diagonal elements of a CUDA sparse matrix (see also https://github.com/JuliaSmoothOptimizers/RipQP.jl/blob/51e928f42beb4af86b506339799cc653e8198ec4/src/gpu_utils.jl#L50), but could probably be improved (I only used it with the jacobi preconditionner).
I think something like this might work (K2 with GMRES, no presolve, no scaling and easy stopping tolerances), but I've not done tests that worked since CUDA 3 if I recall correctly 😅
Q = [6. 2. 1.
2. 5. 2.
1. 2. 4.]
c = [-8.; -3; -3]
A = [1. 0. 1.
0. 2. 1.]
b = [0.; 3]
l = [0.;0;0]
u = [Inf; Inf; Inf]
Qsp = sparse(tril(Q))
Qrows, Qcols, Qvals = findnz(Qsp)
Asp = sparse(A)
Arows, Acols, Avals = findnz(Asp)
x0 = CUDA.zeros(Float64, 3)
QM = QuadraticModel(
CuVector{Float64}(c),
CuSparseMatrixCOO{Float64, Int64}(CuVector(Qrows), CuVector(Qcols), CuVector(Qvals), size(Q), nnz(Qsp)),
A = CuSparseMatrixCOO{Float64, Int64}(CuVector(Arows), CuVector(Acols), CuVector(Avals), size(A), nnz(A)),
lcon=CuVector{Float64}(b),
ucon=CuVector{Float64}(b),
lvar=CuVector{Float64}(l),
uvar=CuVector{Float64}(u),
c0 = zero(Float64),
x0 = x0,
)
using RipQP
stats1 = RipQP.ripqp(QM,
sp = RipQP.K2KrylovParams(kmethod=:gmres, uplo = :U, equilibrate = false),
solve_method = IPF(), ps = false, scaling = false,
itol = RipQP.InputTol(max_iter=50, max_time=100.0, ϵ_rc=1.0e-2, ϵ_rb=1.0e-2, ϵ_pdd=1.0e-2))
I will ask Tim or Valentin tomorrow to active buildkite on RipQP.jl. You will have CI on NVIDIA GPUs like Krylov.jl.