cupy安装不要再使用pip install cupy
了,
已经替换成基于版本安装了pip install cupy-cuda12x
,详见cupy官网。
安装完成后,在import cupy
之后报错,找不到 'vector_types.h':
CompileException: /home/zoe/venv/lib/python3.10/site-packages/cupy/_core/include/cupy/_cuda/cuda-12.4/cuda_fp16.h(129): catastrophic error: cannot open source file "vector_types.h"
#include "vector_types.h"
^
1 catastrophic error detected in the compilation of "/tmp/tmpj2ipaghf/e51b12159fb86782de36519c3d354c9de068af57.cubin.cu".
Compilation terminated.
你还需要安装一个CUDA的头文件,其中12.6
可以替换成你用的cupy版本。
pip install "nvidia-cuda-runtime-cu12==12.6.*"
参考:
[1]: https://github.com/cupy/cupy/issues/8466
[2]: https://docs.cupy.dev/en/latest/install.html#cupy-always-raises-nvrtc-error-compilation-6