src-d / kmcuda

Large scale K-means and K-nn implementation on NVIDIA GPU / CUDA
Other
791 stars 145 forks source link

compute capability mismatch for device 0: wanted 6.1, have 3.7 #13

Closed olalonde closed 7 years ago

olalonde commented 7 years ago

I'm getting this error on a fresh EC2 machine (p2.xlarge, ubuntu 16.04) on which I've installed cuda, python3, numpy and libKMCUDA with pip.

(venv) ubuntu@ip-172-31-17-253:~/code/km-test$ python test.py
reassignments threshold: 100
compute capability mismatch for device 0: wanted 6.1, have 3.7
>>>> you may want to build kmcuda with -DCUDA_ARCH=37 (refer to "Building" in README.md)
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    centroids, assignments = kmeans_cuda(arr, 4, verbosity=1, seed=3)
ValueError: No such CUDA device exists

Here's how I installed CUDA:

wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda

And here's test.py:

import numpy
from libKMCUDA import kmeans_cuda

numpy.random.seed(0)
arr = numpy.empty((10000, 2), dtype=numpy.float32)
arr[:2500] = numpy.random.rand(2500, 2) + [0, 2]
arr[2500:5000] = numpy.random.rand(2500, 2) - [0, 2]
arr[5000:7500] = numpy.random.rand(2500, 2) + [2, 0]
arr[7500:] = numpy.random.rand(2500, 2) - [2, 0]
centroids, assignments = kmeans_cuda(arr, 4, verbosity=1, seed=3)
print(centroids)
olalonde commented 7 years ago

Fixed by compiling with -DCUDA_ARCH=37 flag instead of installing with pip.