Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: cudaMemcpy failed #75

Closed
Yuzz1020 opened this issue Apr 21, 2019 · 1 comment
Closed

RuntimeError: cudaMemcpy failed #75

Yuzz1020 opened this issue Apr 21, 2019 · 1 comment

Comments

@Yuzz1020
Copy link

Yuzz1020 commented Apr 21, 2019

Hello,

Great work, thanks for sharing this code! But I have encountered this error when running.

I'm using the random data generated with numpy to run the K-Means algorithm, but it keeps coming with this error

step 1cudaMemcpyAsync( host_dists + offset, (*dists)[devi].get(), length * sizeof(float), cudaMemcpyDeviceToHost)
/home/zzyu/kmcuda/src/kmeans.cu:814 -> invalid argument 

kmeans_cuda_plus_plus failed 
kmeans_init_centroids() failed for yinyang groups: invalid argument 
kmeans_cuda_yy failed: no error
Traceback (most recent call last):
  File "km_test.py", line 7, in <module>
    cen, ind = kmeans_cuda(arr, 512*256, verbosity=2, seed=3, yinyang_t=0.01) 
RuntimeError: cudaMemcpy failed

The random data I used has dimension [512512, 9]
and the cluster center number is 256
512
Any idea why this happens?

Thanks

@vmarkovtsev
Copy link
Collaborator

There are way too many clusters for km++ initialization method. Besides, try setting yinyang_t to 0. In any case, there is no bug in the code, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants