Closed ghost closed 5 years ago
An update:
I tried several other types problems. It is the same issue. So the problem is not due to the SDP. I also tried to run the included GPU test in SCS, it work.
So the problem is that when using GPU through cvxpy.
My guess is that your GPU is running out of memory, SCS tries to catch that but if the problem is almost able to fit in memory then weird things happen. If you run nvidia-smi
at the command line you can see how much memory your GPU has and how much is being used.
I'm having the same problem here. When I run problem.solve with gpu=False, I get status = solved, but with gpu=True I get Unbounded. I'm simply running the following testing program:
m = 30
n = 20
np.random.seed(1)
A = np.random.randn(m, n)
b = np.random.randn(m)
x = cp.Variable(n)
objective = cp.Minimize(cp.sum_squares(A*x - b))
constraints = [0 <= x, x <= 1]
prob = cp.Problem(objective, constraints)
result = prob.solve("SCS", gpu=False, verbose=True)
I found this post: (https://stackoverflow.com/questions/52579531/how-to-install-cvxpy-scs-to-use-with-gpu) and tried the following setup, but it did not help:
python3 setup.py install --scs --gpu --int
Should be fixed now. When installing from source remember to delete all previous build artifacts, ie, something like rm -rf build dist scs.egg-info
.
I run into a situation that for the same problem, the behavior of SCS is different with GPU on or OFF..
With GPU = True here is the output:
Lin-sys: sparse-indirect GPU, nnz in A = 5038575, CG tol ~ 1/iter^(2.00) eps = 1.00e-05, alpha = 1.50, max_iters = 5000, normalize = 1, scale = 1.00 acceleration_lookback = 20, rho_x = 1.00e-03 Variables n = 30100, constraints m = 31100 Cones: primal zero / dual free vars: 11000 sd vars: 20100, sd blks: 1 Setup time: 2.57e+00s
Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
Status: Unbounded Timing: Solve time: 6.98e-01s Lin-sys: avg # CG iterations: 0.00, avg solve time: 2.41e-02s Cones: avg projection time: 2.34e-04s Acceleration: avg step time: 6.71e-03s
Certificate of dual infeasibility: dist(s, K) = 1.1314e-10 |Ax + s|_2 * |c|_2 = 6.5790e-09 c'x = -1.0000
with GPU false here is the output:
Lin-sys: sparse-indirect, nnz in A = 5041955, CG tol ~ 1/iter^(2.00) eps = 1.00e-05, alpha = 1.50, max_iters = 5000, normalize = 1, scale = 1.00 acceleration_lookback = 20, rho_x = 1.00e-03 Variables n = 30100, constraints m = 31100 Cones: primal zero / dual free vars: 11000 sd vars: 20100, sd blks: 1 Setup time: 2.60e-01s
Iter | pri res | dua res | rel gap | pri obj | dua obj | kap/tau | time (s)
100| 1.09e-03 3.43e-03 4.30e-04 1.00e+00 1.00e+00 3.75e-16 2.81e+01 160| 5.45e-06 8.68e-06 1.73e-06 1.00e+00 1.00e+00 1.26e-16 3.98e+01
Status: Solved Timing: Solve time: 3.98e+01s Lin-sys: avg # CG iterations: 8.27, avg solve time: 2.14e-01s Cones: avg projection time: 1.97e-02s Acceleration: avg step time: 1.12e-02s
Error metrics: dist(s, K) = 1.2674e-09, dist(y, K*) = 6.9758e-10, s'y/|s||y| = -5.9677e-11 primal res: |Ax + s - b|_2 / (1 + |b|_2) = 5.4544e-06 dual res: |A'y + c|_2 / (1 + |c|_2) = 8.6825e-06 rel gap: |c'x + b'y| / (1 + |c'x| + |b'y|) = 1.7304e-06
c'x = 1.0000, -b'y = 1.0000
Does anyone has similar problems.
The problem is just a nuclear norm minimization problem with constraints (equivalent SDP with constraints)