我按照此说明配置 Cuda,但这一步我尝试编写这些行
To configure the CUDA environment for all users (and applications) on your system create the file (use sudo and a text editor of your choice)
/etc/profile.d/cuda.sh
with the following content,
export PATH=$PATH:/usr/local/cuda/bin
export CUDADIR=/usr/local/cuda
但得到了"/etc/profile.d/cuda.sh" is a directory
我尝试运行 Cuda 示例并得到了
Error: target directory missing
Usage: cuda-install-samples-11.1.sh <target directory>
Will append NVIDIA_CUDA-11.1_Samples to <target directory>
我试图在 bashrc 中编写以下内容
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
PATH=${CUDA_HOME}/bin:${PATH}
export PATH
编辑
我尝试使用此命令运行示例来测试 cuda
./cuda-install-samples-11.1.sh
但得到了
Error: target directory missing
Usage: cuda-install-samples-11.1.sh <target directory>
Will append NVIDIA_CUDA-11.1_Samples to <target directory>
编辑 2
我试图运行这个命令
./cuda-install-samples-11.1.sh /home/user/NVIDIA_CUDA-11.1_Samples
但得到了
bash: ./cuda-install-samples-11.1.sh: No such file or directory
该目录
/etc/profile.d/cuda.sh
应该是一个文件,因此首先删除该目录,但在删除目录时要非常小心:将以下内容添加到(每个用户)的底部
~/.profile
或将其添加到名为/etc/profile.d/cuda.sh
(全局)的文件中并重新启动系统:然后对于
cuda-install-samples-11.1.sh <target directory>
使用.run
文件或.deb
文件安装时的命令,默认~/NVIDIA_CUDA-11.1_Samples
情况下运行该命令:或者在运行上述命令之前,通过运行确保它是可执行的: