ubuntu19.10安装cuda-10.1
ubuntu19.10安装cuda-10.1
1.安装N卡驱动:
打开ubuntu的软件和更新,设置N卡驱动
2.查看ubuntu显卡驱动
nvidia-smi
显示:
Sun Feb 23 06:41:41 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.50 Driver Version: 430.50 CUDA Version: 10.1 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce 940M Off | 00000000:01:00.0 Off | N/A |
| N/A 44C P0 N/A / N/A | 306MiB / 2004MiB | 28% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 982 G /usr/lib/xorg/Xorg 23MiB |
| 0 1390 G /usr/lib/xorg/Xorg 102MiB |
| 0 1613 G /usr/bin/gnome-shell 95MiB |
| 0 2036 G ...AAAAAAAAAAAAAAgAAAAAAAAA --shared-files 34MiB |
+-----------------------------------------------------------------------------+
可以看到
CUDA Version: 10.1
3.我们下载CUDA Version: 10.1
ubuntu系统下cuda的下载推荐XDM下载器
下载后,在安装包目录打开终端输入:
sudo dpkg -i cuda-repo-ubuntu1810-10-1-local-10.1.105-418.39_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-1-local-10.1.105-418.39/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
4.至此安装包安装完成,接下来将cuda加入环境变量:
sudo gedit /etc/profile
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH
source /etc/profile
5.打开安装目录/ usr / local / cuda- 10.1
输入nvcc -V,显示cuda版本:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105
6.在编译样例目录/usr/local/cuda-10.1/samples输入make发现出错,出错显示:
make[1]: 进入目录“/usr/local/cuda-10.1/samples/0_Simple/simpleSeparateCompilation”
/usr/local/cuda-10.1/bin/nvcc -ccbin g++ -I../../common/inc -m64 -dc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o simpleDeviceLibrary.o -c simpleDeviceLibrary.cu
In file included from /usr/local/cuda-10.1/bin/../targets/x86_64-linux/include/cuda_runtime.h:83,
from <command-line>:
/usr/local/cuda-10.1/bin/../targets/x86_64-linux/include/crt/host_config.h:129:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported!
129 | #error -- unsupported GNU version! gcc versions later than 8 are not supported!
| ^~~~~
make[1]: *** [Makefile:290:simpleDeviceLibrary.o] 错误 1
make[1]: 离开目录“/usr/local/cuda-10.1/samples/0_Simple/simpleSeparateCompilation”
make: *** [Makefile:51:0_Simple/simpleSeparateCompilation/Makefile.ph_build] 错误 2
重点在:
error -- unsupported GNU version! gcc versions later than 8 are not supported!
7.原因是ubuntu 19.10 gcc版本过高,所以我们需要使用低于8.0的gcc g++
为了解决这个问题,我们可以下载gcc-7 g++-7来结合 update-alternatives 对样例进行编译
首先安装gcc-7 g++-7
sudo apt-get install gcc-7 g++-7
安装完成后我们开始使用update-alternatives进行版本控制,语法如下:
update-alternatives --install <链接> <名称> <路径> <优先级>
对于gcc有,命令行末尾的数字表优先级,数字越大优先级越高
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 20
版本设置:
sudo update-alternatives --config gcc
显示:
有 2 个候选项可用于替换 gcc (提供 /usr/bin/gcc)。
选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/bin/gcc-9 20 自动模式
1 /usr/bin/gcc-7 10 手动模式
2 /usr/bin/gcc-9 20 手动模式
要维持当前值[*]请按<回车键>,或者键入选择的编号:1(我选的1)
update-alternatives: 使用 /usr/bin/gcc-7 来在手动模式中提供 /usr/bin/gcc (gcc)
对于g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 20
版本设置:
sudo update-alternatives --config g++
显示:
有 2 个候选项可用于替换 g++ (提供 /usr/bin/g++)。
选择 路径 优先级 状态
------------------------------------------------------------
* 0 /usr/bin/g++-9 20 自动模式
1 /usr/bin/g++-7 10 手动模式
2 /usr/bin/g++-9 20 手动模式
要维持当前值[*]请按<回车键>,或者键入选择的编号:1(对的我摁的1,就是我)
update-alternatives: 使用 /usr/bin/g++-7 来在手动模式中提供 /usr/bin/g++ (g++)
8.将gcc与g++都切换成gcc-7 g++-7后就可以在样例目录下输入make编译啦
编译完成后,生成的bin文件夹里找到deviceQuery 那一级目录,输入
./deviceQuery
看到类似的即为成功安装:
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce 940M"
CUDA Driver Version / Runtime Version 10.1 / 10.1
CUDA Capability Major/Minor version number: 5.0
Total amount of global memory: 2004 MBytes (2101870592 bytes)
( 3) Multiprocessors, (128) CUDA Cores/MP: 384 CUDA Cores
GPU Max Clock rate: 1176 MHz (1.18 GHz)
Memory Clock rate: 1001 Mhz
Memory Bus Width: 64-bit
L2 Cache Size: 1048576 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 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 1 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
Device supports Compute Preemption: No
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
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 = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1
Result = PASS
写了这么多点个赞呗!
ubuntu19.10安装cuda-10.1的更多相关文章
- [笔记] Ubuntu 18.04安装cuda 10及cudnn 7流程
安装环境 OS:Ubuntu 18.04 64 bit 显卡:NVidia GTX 1080 任务:安装 CUDA 10及cuDNN 7 工具下载 NVidia官网下载下列文件: CUDA 10:cu ...
- Win10安装CUDA 10.2
目录 一.安装VS2015 二.安装CUDA 10.2 2.1 安装前工作 2.2 CUDA 10.2下载安装过程 2.2.1 下载CUDA 10.2 2.2.1.1 官网下载地址 2.2.1.2 网 ...
- ubuntu17.10 安装CUDA
1. 更新apt-get源列表 sudo apt-get update sudo apt-get upgrade 2. 添加驱动源 sudo add-apt-repository ppa:graphi ...
- Ubuntu 18.04安装 CUDA 10.1 、cuDNN 7.6.5、PyTorch1.3
转载请注明出处 BooTurbo https://www.cnblogs.com/booturbo/p/11834661.html 安装平台及环境 CPU:i9-9900k桌面级 GPU:RTX 2 ...
- Ubuntu 18 安装 cuda 10
1.把预先下好的cuda放到某个目录,如Download. 2.Crtl + Alt + F3 进入tty,使用tty登录. 关闭用户图形界面,sudo systemctl set-default m ...
- Ubuntu P40显卡配置CUDA 10.1,CUDNN 7.6,Conda 5.2.0, Tensorflow-gpu 1.8
1. 安装CUDA 禁用nouveau vim /etc/modprobe.d/blacklist.conf 最后两行加入 blacklist nouveau options nouveau mode ...
- window 10 安装paddlepaddle 1.7 GPU版本
window 10 安装paddlepaddle 1.7 GPU版本 1)更新显卡驱动 2)安装cuda 10 https://developer.nvidia.com/cuda-10.0-downl ...
- Windows 10下CUDA及cuDNN的安装 —— Pytorch
Windows 10下CUDA及cuDNN的安装 CUDA简介与下载地址 CUDA(ComputeUnified Device Architecture),是显卡厂商NVIDIA推出的运算平台. CU ...
- Win10 x64 + CUDA 10.0 + cuDNN v7.5 + TensorFlow GPU 1.13 安装指南
Win10 x64 + CUDA 10.0 + cuDNN v7.5 + TensorFlow GPU 1.13 安装指南 Update : 2019.03.08 0. 环境说明 硬件:Ryzen R ...
随机推荐
- kafka创建topic,生产和消费指定topic消息
启动zookeeper和Kafka之后,进入kafka目录(安装/启动kafka参考前面一章:https://www.cnblogs.com/cici20166/p/9425613.html) 1.创 ...
- python基础(一)内置类型及方法
python 内置类型主要包含7大类: 数字 序列 映射 文件 类 实例 异常 其中,最常用数据类型为序列 序列 python中包含7种内建序列 列表(list):由方括号构成,用逗号分隔项目: [a ...
- PHP表单处理、会话管理、文件上传、文件处理、执行函数(10.8 第十六天)
表单处理 服务器接收用户发过来的数据方式: $_GET 接收用户以GET方式发过来的数据 $_POST 接收用户以POST方式发过来的数据 $_COOKIE 接收用户COOKIE $_REQUEST ...
- C++ 大文件读写
//你必须映射一个只包含一小部分文件数据的文件视图.首先映射一//个文件的开头的视图.当完成对文件的第一个视图的访问时,可以取消它的映像,然后映射//一个从文件中的一个更深的位移开始的新视图.必须重复 ...
- 读书笔记 - js高级程序设计 - 第十一章 DOM扩展
对DOM的两个主要的扩展 Selectors API HTML5 Element Traversal 元素遍历规范 querySelector var body = document.query ...
- 漫谈计算机组成原理(七)I/O系统
本文讲什么? 这个系列的文章其实可以分成两个部分,计算机系统的其他硬件结构和CPU. 而我们今天要讲述的内容,就是其他硬件结构中的最后一个部分--I/O(输入输出)系统. 这篇文章主要讲述的就是I/O ...
- 【pwnable.kr】random
pwnable从入门到放弃第七题. ssh random@pwnable.kr -p2222 (pw:guest) 目前为止做的最快的一道题... #include <stdio.h> i ...
- js 一年中多个时间段 天数去重
Date.prototype.format = function() { var s = ''; var mouth = (this.getMonth() + 1)>=10?(this.getM ...
- OFD系列软件说明(免费试用、QQ交流群:877371250)
前言 OFD是一个版式文档格式.所谓版式文档格式是版面呈现效果固定的电子文档格式. 我们今天接触到最多的版式文档就是国际通用的PDF. 国内的就是由工业和信息化部软件司牵头中国电子技术标准化研究院成立 ...
- 精选干货 在java中创建kafka
这个详细的教程将帮助你创建一个简单的Kafka生产者,该生产者可将记录发布到Kafka集群. 通过优锐课的java学习架构分享中,在本教程中,我们将创建一个简单的Java示例,该示例创建一个Kafka ...