wsl2安装完成cuda,输入cat /usr/local/cuda/version.json
有输出
{
"cuda" : {
"name" : "CUDA SDK",
"version" : "11.2.20210226"
},
"cuda_cudart" : {
"name" : "CUDA Runtime (cudart)",
"version" : "11.2.152"
},
"cuda_cuobjdump" : {
"name" : "cuobjdump",
"version" : "11.2.152"
},
"cuda_cupti" : {
"name" : "CUPTI",
"version" : "11.2.152"
},
"cuda_cuxxfilt" : {
"name" : "CUDA cu++ filt",
"version" : "11.2.152"
},
"cuda_demo_suite" : {
"name" : "CUDA Demo Suite",
"version" : "11.2.152"
},
"cuda_gdb" : {
"name" : "CUDA GDB",
"version" : "11.2.152"
},
"cuda_memcheck" : {
"name" : "CUDA Memcheck",
"version" : "11.2.152"
},
"cuda_nsight" : {
"name" : "Nsight Eclipse Plugins",
"version" : "11.2.152"
},
"cuda_nvcc" : {
"name" : "CUDA NVCC",
"version" : "11.2.152"
},
"cuda_nvdisasm" : {
"name" : "CUDA nvdisasm",
"version" : "11.2.152"
},
"cuda_nvml_dev" : {
"name" : "CUDA NVML Headers",
"version" : "11.2.152"
},
"cuda_nvprof" : {
"name" : "CUDA nvprof",
"version" : "11.2.152"
},
"cuda_nvprune" : {
"name" : "CUDA nvprune",
"version" : "11.2.152"
},
"cuda_nvrtc" : {
"name" : "CUDA NVRTC",
"version" : "11.2.152"
},
"cuda_nvtx" : {
"name" : "CUDA NVTX",
"version" : "11.2.152"
},
"cuda_nvvp" : {
"name" : "CUDA NVVP",
"version" : "11.2.152"
},
"cuda_samples" : {
"name" : "CUDA Samples",
"version" : "11.2.152"
},
"cuda_sanitizer_api" : {
"name" : "CUDA Compute Sanitizer API",
"version" : "11.2.152"
},
"libcublas" : {
"name" : "CUDA cuBLAS",
"version" : "11.4.1.1043"
},
"libcufft" : {
"name" : "CUDA cuFFT",
"version" : "10.4.1.152"
},
"libcurand" : {
"name" : "CUDA cuRAND",
"version" : "10.2.3.152"
},
"libcusolver" : {
"name" : "CUDA cuSOLVER",
"version" : "11.1.0.152"
},
"libcusparse" : {
"name" : "CUDA cuSPARSE",
"version" : "11.4.1.1152"
},
"libnpp" : {
"name" : "CUDA NPP",
"version" : "11.3.2.152"
},
"libnvjpeg" : {
"name" : "CUDA nvJPEG",
"version" : "11.4.0.152"
},
"nsight_compute" : {
"name" : "Nsight Compute",
"version" : "2020.3.1.4"
},
"nsight_systems" : {
"name" : "Nsight Systems",
"version" : "2020.4.3.7"
},
"nvidia_driver" : {
"name" : "NVIDIA Linux Driver",
"version" : "460.32.03"
}
}
在使用tvm加载cuda环境时报错如下:
OSError: libcuda.so.1: cannot open shared object file: No such file or directory
终端输入where libcuda.so.1
发现有输出
/usr/lib/wsl/lib/libcuda.so.1
在环境中添加如下vim ~/.bashrc
:
export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH
使用source ~/.bashrc
重启环境即可解决。