deepin安装cuda-10.2

deepin安装cuda-10.2

    • 1. 下载文件
    • 2. 禁用默认闭源驱动
    • 3. 安装
    • 4. 测试

参考文章:https://www.findhao.net/easycoding/2562.html

1. 下载文件

首先到 https://developer.nvidia.com/cuda-downloads ,选择ubuntu 18.04 runfile 格式

deepin安装cuda-10.2_第1张图片

复制下面的wget xxx命令在终端中运行下载文件。

2. 禁用默认闭源驱动

# 使用vim或者其他编辑器添加配置文件
sudo vim /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
# 编辑内容如下
blacklist nouveau
options nouveau modeset=0
# 卸载之前安装的nvidia相关东西
sudo apt purge nvidia-*
sudo reboot

3. 安装

重启后,先通过ctrl + alt + F2进入tty2

# 关闭dm
sudo service lightdm stop
# 修改为可执行权限
chmod 777 cuda_10.2.89_440.33.01_linux.run

安装cuda

bash cuda_10.2.89_440.33.01_linux.run --silent --toolkit --toolkitpath=$HOME/opt/cuda10.2 --defaultroot=$HOME/opt/cuda10.2 --samples --samplespath=$HOME/

没有报错,就说明安装成功了。在系统的/usr/local/下创建toolkit10的链接:

sudo ln -s ~/opt/cuda10.2 /usr/local/cuda

可以在~/.bashrc或者/etc/profile中加入以下内容,来自动设置环境变量:

CUDA_HOME=/usr/local/cuda/
export PATH=$PATH:$CUDA_HOME/bin/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64

想要立即生效,修改完成后执行:

source ~/.bashrc
# 或者
source /etc/profile

4. 测试

cd ~/NVIDIA_CUDA-10.2_Samples/7_CUDALibraries/batchCUBLAS/
make

如果显示g++错误,可能是没有安装g++:

sudo apt install g++ -y

然后重新执行make编译操作

编译成功后执行

./batchCUBLAS

如果成功,会输出如下结果,最后为0 error(s)

batchCUBLAS Starting...

GPU Device 0: "Turing" with compute capability 7.5


 ==== Running single kernels ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbf800000, -1) beta= (0x40000000, 2)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00027514 sec  GFLOPS=15.2445
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0x0000000000000000, 0) beta= (0x0000000000000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00005603 sec  GFLOPS=74.8604
@@@@ dgemm test OK

 ==== Running N=10 without streams ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbf800000, -1) beta= (0x00000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00008988 sec  GFLOPS=466.636
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbff0000000000000, -1) beta= (0x0000000000000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00037408 sec  GFLOPS=112.124
@@@@ dgemm test OK

 ==== Running N=10 with streams ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0x40000000, 2) beta= (0x40000000, 2)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00007415 sec  GFLOPS=565.665
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbff0000000000000, -1) beta= (0x0000000000000000, 0)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00035191 sec  GFLOPS=119.188
@@@@ dgemm test OK

 ==== Running N=10 batched ==== 

Testing sgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0x3f800000, 1) beta= (0xbf800000, -1)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00004315 sec  GFLOPS=971.944
@@@@ sgemm test OK
Testing dgemm
#### args: ta=0 tb=0 m=128 n=128 k=128  alpha = (0xbff0000000000000, -1) beta= (0x4000000000000000, 2)
#### args: lda=128 ldb=128 ldc=128
^^^^ elapsed = 0.00049591 sec  GFLOPS=84.5778
@@@@ dgemm test OK

Test Summary
0 error(s)

你可能感兴趣的:(deepin安装cuda-10.2)