clipdraw
clipdraw copied to clipboard
invalid device function running in colab [fix included]
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)
[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