bitsandbytes包找不到cuda
1. 报错如下:RuntimeError:
CUDA Setup failed despite GPU being available. Please run the following command to get more information:
python -m bitsandbytes
Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
to your LD_LIBRARY_PATH. If you suspect a bug,
-
已有环境:win11-cuda12.6-torch2.6.0+cu126
-
参考:https://github.com/bitsandbytes-foundation/bitsandbytes/blob/main/docs/source/installation.mdx在自己电脑上编译安装bitsandbytes
-
cmake -DCOMPUTE_BACKEND=cuda -S . 遇到问题:
– Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
– The CXX compiler identification is MSVC 19.29.30139.0
CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/CMakeDetermineCompilerId.cmake:491 (message):
No CUDA toolset found.
* 参考:https://github.com/NVlabs/tiny-cuda-nn/issues/164
* 但是我的vs安装版本有好几个,路径也乱七八糟,需要确定cmake用的是哪个目录下的VC,复制过去之后上面的问题解决了,但是有新的问题:
- Compiling the CUDA compiler identification source file
“CMakeCUDACompilerId.cu” failed.
- 参考:https://blog.youkuaiyun.com/qq_26157437/article/details/129834852
- 如果保存时提示没有权限保存,记得记事本用管理员身份打开再编辑,就可以保存了
- cmake成功,输出如下:
- bitsandbytes>cmake -DCOMPUTE_BACKEND=cuda -S .
– Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22631.
– Configuring bitsandbytes (Backend: cuda)
– The CUDA compiler identification is NVIDIA 12.6.77
– Detecting CUDA compiler ABI info
– Detecting CUDA compiler ABI info - done
– Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe - skipped
– Detecting CUDA compile features
– Detecting CUDA compile features - done
– Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/include (found version “12.6.77”)
– CUDA Version: 126 (12.6.77)
– CUDA Compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvcc.exe
– CUDA Capabilities Available: 50;52;53;60;61;62;70;72;75;80;86;87;89;90
– CUDA Capabilities Selected: 50;52;53;60;61;62;70;72;75;80;86;87;89;90
– CUDA Targets: 50-real;52-real;53-real;60-real;61-real;62-real;70-real;72-real;75-real;80-real;86-real;87-real;89-real;90
– CUDA NVCC Flags: -D_WINDOWS -Xcompiler=" /EHsc" --use_fast_math
– Configuring done (7.9s)
– Generating done (0.0s) -
按步骤3成功安装bitsandbytes,再次测试成功未报错