osqp / cuosqp

Python interface for CUDA implementation of OSQP
Apache License 2.0
86 stars 15 forks source link

parallel_for failed: cudaErrorNoKernelImageForDevice: no kernel image is available for execution on the device #4

Open ztjsw opened 3 years ago

ztjsw commented 3 years ago

Hello there, I ran the cuosqp but it aborts as following:

terminate called after throwing an instance of 'thrust::system::system_error'
  what():  parallel_for failed: cudaErrorNoKernelImageForDevice: no kernel image is available for execution on the device

My GPU is NVIDIA 1080Ti, the code is:

import cuosqp as osqp
import numpy as np
from scipy import sparse

# Define problem data
P = sparse.csc_matrix([[4, 1], [1, 2]])
q = np.array([1, 1])
A = sparse.csc_matrix([[1, 1], [1, 0], [0, 1]])
l = np.array([1, 0, 0])
u = np.array([1, 0.7, 0.7])

# Create an OSQP object
prob = osqp.OSQP()

# Setup workspace
prob.setup(P, q, A, l, u)

# Solve problem
res = prob.solve()

# Solve again
res2 = prob.solve()

I was wondering why this is and if there is anything I am doing wrong?

gbanjac commented 3 years ago

Can you install the C version of cuOSQP given here: https://github.com/osqp/osqp/tree/cuda-1.0

What happens when you run the demo example?

ztjsw commented 3 years ago

I have builded the osqp with branch cuda-1.0. But it still returns the error:

-> % ./out/osqp_demo 
terminate called after throwing an instance of 'thrust::system::system_error'
  what():  parallel_for failed: cudaErrorNoKernelImageForDevice: no kernel image is available for execution on the device
[1]    15556 abort (core dumped)  ./out/osqp_demo
gbanjac commented 3 years ago

Which version of the CUDA Toolkit do you have installed?

ztjsw commented 3 years ago

CUDA 10.2

gbanjac commented 3 years ago

It seems that your GPU has the Pascal architecture, which has the CUDA compute capability 6.1.

What happens if you change this line to set(CMAKE_CUDA_ARCHITECTURES 61)?

chuber11 commented 2 years ago

I had the same problem. Setting the CMAKE_CUDA_ARCHITECTURES did not help but i had to remove ", '--target', 'osqpstatic'" from https://github.com/osqp/cuosqp/blob/master/setup.py#L104

smithian commented 1 year ago

Same problem here. In my case, using an A30, setting set(CMAKE_CUDA_ARCHITECTURES 80) and commenting out the conditional statement solved the problem.