前言:
当前你们对“ubuntu1604gtx1070”可能比较关怀,咱们都需要知道一些“ubuntu1604gtx1070”的相关内容。那么小编在网络上收集了一些有关“ubuntu1604gtx1070””的相关文章,希望小伙伴们能喜欢,姐妹们一起来了解一下吧!Step1. 准备工作
sudo apt install vim
sudo apt-get update
Step2. 安装CUDA9.1
[1]
lspci | grep -i nvidia
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1b81 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 10f0 (rev a1)
[2]
uname -m && cat /etc/*release
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL=""
SUPPORT_URL=""
BUG_REPORT_URL=""
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
[3]
gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[4]
sudo apt-get install linux-headers-$(uname -r)
[sudo] sanray 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
linux-headers-4.13.0-26-generic 已经是最新版 (4.13.0-26.29~16.04.2)。
linux-headers-4.13.0-26-generic 已设置为手动安装。
下列软件包是自动安装的并且现在不需要了:
linux-headers-4.10.0-28 linux-headers-4.10.0-28-generic linux-image-4.10.0-28-generic
linux-image-extra-4.10.0-28-generic
使用'sudo apt autoremove'来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 180 个软件包未被升级。
[5]
修改软件下载源(这一步非常重要,国外网站很可能无法下载或者速度非常慢)
[6]
下载安装
重启reboot,系统加载NVIDIA drivers
[7]
确认路径存在
ls /usr/local/cuda-9.1/bin/
设置环境路径
export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}
[8]
cd /usr/lib/systemd/
sudo mkdir system
cd system/
创建/usr/lib/systemd/system/nvidia-persistenced.service文件
sudo vi nvidia-persistenced.service
[Unit]
Description=NVIDIA Persistence Daemon
Wants=syslog.target
[Service]
Type=forking
PIDFile=/var/run/nvidia-persistenced/nvidia-persistenced.pid
Restart=always
ExecStart=/usr/bin/nvidia-persistenced --verbose
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced
[Install]
WantedBy=multi-user.target
运行
sudo systemctl enable nvidia-persistenced
[9]
修改rules文件
ls /lib/udev/rules.d/40-vm-hotadd.rules
sudo vim /lib/udev/rules.d/40-vm-hotadd.rules
修改前
# Memory hotadd request
SUBSYSTEM=="memory", ACTION=="add", DEVPATH=="/devices/system/memory/memory[0-9]*", TEST=="state", ATTR{state}="online"
修改后
# Memory hotadd request
# 2018-01-18 be commendted out by wanghonggang(18576671185), for the NVIDIA
# CUDA driver to function properly on POWER9 systems.
#SUBSYSTEM=="memory", ACTION=="add", DEVPATH=="/devices/system/memory/memory[0-9]*", TEST=="state", ATTR{state}="online"
================================================
验证结果
cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 387.34 Tue Nov 21 03:09:00 PST 2017
GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)
nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
安装第三方库
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev \
libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
安装samples
cuda-install-samples-9.1.sh <dir>
ls /usr/local/cuda-9.1/samples/
cd ~/NVIDIA_CUDA-9.1_Samples
make
生成bin文件夹和很多文件
cd ~/NVIDIA_CUDA-9.1_Samples/bin/x86_64/linux/release
检查结果
[错误1]
/usr/local/cuda-9.1/samples/bin/x86_64/linux/release/deviceQuery
/usr/local/cuda-9.1/samples/bin/x86_64/linux/release/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL
[错误2]
/usr/local/cuda-9.1/samples/bin/x86_64/linux/release/deviceQuery
/usr/local/cuda-9.1/samples/bin/x86_64/linux/release/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 38
-> no CUDA-capable device is detected
Result = FAIL
[正确]
/usr/local/cuda-9.1/samples/bin/x86_64/linux/release/deviceQuery
/usr/local/cuda-9.1/samples/bin/x86_64/linux/release/deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1070"
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 6.1
Total amount of global memory: 8106 MBytes (8499691520 bytes)
(15) Multiprocessors, (128) CUDA Cores/MP: 1920 CUDA Cores
GPU Max Clock rate: 1721 MHz (1.72 GHz)
Memory Clock rate: 4004 Mhz
Memory Bus Width: 256-bit
L2 Cache Size: 2097152 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 2 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Supports Cooperative Kernel Launch: Yes
Supports MultiDevice Co-op Kernel Launch: Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 1
Result = PASS
~/NVIDIA_CUDA-9.1_Samples/bin/x86_64/linux/release$ ./bandwidthTest
[CUDA Bandwidth Test] - Starting...
Running on...
Device 0: GeForce GTX 1070
Quick Mode
Host to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes)Bandwidth(MB/s)
3355443212374.0
Device to Host Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes)Bandwidth(MB/s)
3355443212351.9
Device to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes)Bandwidth(MB/s)
33554432191159.3
Result = PASS
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
大量文档在这里
/usr/local/cuda-9.1/doc