WARNING: nvcc not in path. May need to set CUDA_INC_DIR for installation to succeed
阅读一些博客后,我也做了
!export PATH=/usr/local/cuda/bin:$PATH
和!export CUDA_ROOT=/usr/local/cuda
,但仍会出现相同的错误。
此外,在终止安装时,它还显示
In file included from src/cpp/cuda.cpp:1:0:
src/cpp/cuda.hpp:14:10: fatal error: cuda.h: No such file or directory
#include <cuda.h>
^~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
此脚本也安装了
pycuda
也需要的软件包:!curl https://colab.chainer.org/install | sh -
在2025年,您应该做以下操作:
Runtuntime->更改运行时类型 - >硬件加速器:T4 GPU或更高版本!
!pip install chainer
!pip install pycuda
import pycuda.autoinit
import pycuda.driver as cuda
from pycuda.compiler import SourceModule