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

invalid device function running in colab [fix included] #9

Open
zxsq-cc opened this issue Jul 27, 2021 · 1 comment
Open

invalid device function running in colab [fix included] #9

zxsq-cc opened this issue Jul 27, 2021 · 1 comment

Comments

@zxsq-cc
Copy link

zxsq-cc commented Jul 27, 2021

when running this in google colab, it no longer works, giving an error when running the final program along the lines of
RuntimeError: radix_sort: failed on 1st step: cudaErrorInvalidDeviceFunction: invalid device function

I was able to solve this by changing Pre Installation to un-comment the !pip install torch==1.7.1... line, then editing the cmakelists.txt file (located at /content/diffvg/) to add
string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_70,code=sm_70")
after line 87, inside if(DIFFVG_CUDA) to force it to use the correct compute capability version for the gpu colab was using. the correct version can be found in the future here by finding the gpu listed by "inputs and notebook utilities"'s output, and replacing the 70 above (e.g. my colab instance had a tesla v100, which supports compute 7.0)

@sousquared
Copy link

sousquared commented Dec 6, 2021

[Suggestion] Changing the CUDA version

Hi,
Thank you for your great work!
I faced the same error and found that this is because of the default CUDA version of my Colab (CUDA11.1). (The same problem is discussed here.)

!nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0

So I changed the CUDA version to the one the scripts expected (CUDA10.1 in my case). Then it's working now!

import os
p = os.getenv('PATH')
ld = os.getenv('LD_LIBRARY_PATH')
os.environ['PATH'] = f"/usr/local/cuda-10.1/bin:{p}"
os.environ['LD_LIBRARY_PATH'] = f"/usr/local/cuda-10.1/lib64:{ld}"
!nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243

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