Ubuntu16.04+Theano环境
安装Anaconda:
- 官网下载Anaconda
- 切换到下载目录
cd ~/下载/
- 用bash运行下载好的.sh文件
bash Anaconda2--Linux-x86_64.sh
- 进入欢迎界面
Welcome to Anaconda2 (by Continuum Analytics, Inc.) In order to continue the installation process, please review the license agreement. Please, press ENTER to continue
>>> - 按回车
================ Anaconda License ================ Copyright , Continuum Analytics, Inc. All rights reserved under the -clause BSD License: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright no tice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documen tation and/or other materials provided with the distribution. * Neither the name of Continuum Analytics, Inc. nor the names of it s contributors may be used to endorse or promote products derived fro m this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED T O, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CONTINUUM ANALYTICS, INC. BE LIAB LE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENT --更多--
可以按q退出
- 显示是否同意条款,输入yes
Do you approve the license terms? [yes|no] >>> yes
- 跳出是否使用默认安装路径,直接回车(如果要改直接输入想要的安装路径)
Anaconda2 will now be installed into this location: /home/ziven/anaconda2 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/ziven/anaconda2] >>>
- 等待安装
- 安装完成,选择是否配置环境变量【注意:默认是no】,因此这里要输入yes,否则之后要手动添加环境变量
Python :: Continuum Analytics, Inc. creating default environment... installation finished. Do you wish the installer to prepend the Anaconda2 install location to PATH in your /home/ziven/.bashrc ? [yes|no] [no] >>> yes
- Anaconda安装完成
Prepending PATH=/home/ziven/anaconda2/bin to PATH in /home/ziven/.bashrc A backup will be made to: /home/ziven/.bashrc-anaconda2.bak For this change to become active, you have to open a new terminal. Thank you for installing Anaconda2! Share your notebooks and packages on Anaconda Cloud! Sign up for free: https://anaconda.org
- 输入
anacron -V
可显示版本
Anacron 2.3 Copyright (C) Itai Tzur <itzur@actcom.co.il> Copyright (C) Sean 'Shaleh' Perry <shaleh@debian.org> Copyright (C) Pascal Hakim <pasc@redellipse.net> Mail comments, suggestions and bug reports to <pasc@redellipse.net>.
安装CUDA:
- 确保GPU为CUDA所支持的GPU
lspci | grep -i nvidia
参照GPU支持列表
- 确定系统版本
uname -m && cat /etc/*release
- 确定gcc版本
gcc --version
- 选择显卡驱动
- 下载CUDA Toolkit,建议使用.deb
- 切换到下载目录
sudo dpkg -i cuda-repo-<distro>_<version>_<architecture>.deb
- 更新apt源
sudo apt-get update sudo apt-get upgrade
安装cuda
sudo apt-get install cuda
再次更新apt源
sudo apt-get update sudo apt-get upgrade
- 更新软件包
sudo apt-get cuda
- 选择最新安装的显卡驱动
- 如果没有新的显卡驱动可以如下安装
sudo apt-get install cuda-drivers
- 添加环境变量
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
检测安装
cd /usr/local/cuda-8.0/samples/ sudo make
- 使用deviceQuery检测安装
cd ./bin/x86_64/linux/release/ ./deviceQuery
- 可以看到显卡信息和最后的PASS即可
./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected CUDA Capable device(s) Device : "GeForce 940MX" CUDA Driver Version / Runtime Version 8.0 / 8.0 CUDA Capability Major/Minor version number: 5.0 Total amount of global memory: MBytes ( bytes) ( ) Multiprocessors, () CUDA Cores/MP: CUDA Cores GPU Max Clock rate: MHz (1.24 GHz) Memory Clock rate: Mhz Memory Bus Width: -bit L2 Cache Size: bytes Maximum Texture Dimension Size (x,y,z) 1D=(), 2D=(, ), 3D=(, , ) Maximum Layered 1D Texture Size, (num) layers 1D=(), layers Maximum Layered 2D Texture Size, (num) layers 2D=(, ), layers Total amount of constant memory: bytes Total amount of shared memory per block: bytes Total number of registers available per block: Warp size: Maximum number of threads per multiprocessor: Maximum number of threads per block: Max dimension size of a thread block (x,y,z): (, , ) Max dimension size of a grid size (x,y,z): (, , ) Maximum memory pitch: bytes Texture alignment: bytes Concurrent copy and kernel execution: Yes with 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 PCI Domain ID / Bus ID / location ID: / / Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = , Device0 = GeForce 940MX Result = PASS
- SElinux报错的话需要
- 然后跑一下bandwidthTest看一下
./bandwidthTest
显示PASS即可
- CUDA安装完成
安装theano:
conda install theano pip install nose_parameterized
- 配置.theanorc:
cd ~ vim .theanorc
- 写入并保存:
[global] floatX=float32 device=gpu base_compiledir=~/external/.theano/ allow_gc=False warn_float64=warn [mode]=FAST_RUN [nvcc] fastmath=True [cuda] root=/usr/local/cuda
创建一个test.py:
from theano import function, config, shared, sandbox import theano.tensor as T import numpy import time vlen = * * # x #cores x # threads per core iters = rng = numpy.random.RandomState() x = shared(numpy.asarray(rng.rand(vlen), config.floatX)) f = function([], T.exp(x)) print(f.maker.fgraph.toposort()) t0 = time.time() for i in range(iters): r = f() t1 = time.time() print("Looping %d times took %f seconds" % (iters, t1 - t0)) print("Result is %s" % (r,)) if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]): print('Used the cpu') else: print('Used the gpu')
- 如果最后一行显示Used the gpu则表示GPU已启用
- 进入Python检查tehano:
import theano theano.test()
- 结果为ok则安装成功
Ubuntu16.04+Theano环境的更多相关文章
- ubuntu16.04 ROS环境下配置和运行SVO
ubuntu16.04 ROS环境下配置和运行SVO https://blog.csdn.net/nnUyi/article/details/78005552
- Ubuntu16.04 lnmp 环境搭建
Ubuntu16.04 lnmp 环境搭建 nginx 安装 sudo apt-add-repository ppa:nginx/stablesudo apt-add-repository ppa:o ...
- Python在ubuntu16.04上环境搭建
1.anaconda3安装 mkdir anaconda cd anaconda wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linu ...
- ubuntu16.04 英文环境安装google chrome
1.下载google wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 2.安装缺少的依赖 ...
- ubuntu16.04 英文环境安装中文输入法
1. 安装语言包 System Settings–>Language Support–>Install/Remove Languages 选中chinese,点击Apply应用即可,等待下 ...
- ubuntu16.04 开发环境搭建
1.更换源 sudo gedit /etc/apt/sources.list 2.更新系统 sudo apt-get update sudo apt-get dist-upgrade 3.移动 ...
- cartographer Ubuntu16.04 ros环境配置
首先要正确安装 ROS ,然后第12步应注意,proto的版本是个关键容易出错. 1.添加ROS源http:/packages.ros.org/ros/ubuntu xenial main ( ...
- R在ubuntu16.04上环境搭建
1.R安装 sudo apt-get update sudo apt-get remove vim-common sudo apt-get install vimapt-cache show r-ba ...
- Ubuntu16.04+cuda8.0rc+opencv3.1.0+caffe+Theano+torch7搭建教程
https://blog.csdn.net/jywowaa/article/details/52263711 学习中用到深度学习的框架,需要搭建caffe.theano和torch框架.经过一个月的不 ...
随机推荐
- Apache处理请求步骤及过程
Apache请求处理循环详解 : 1.Post-Read-Request阶段: 在正常请求处理流程中,这是模块可以插入钩子的第一个阶段.对于那些想很早进入处理请求的模块来说,这个阶段可以被利用. 2. ...
- lwip移植到stm32上-enc28j60,103mcu(2)
前面小玩了一下ucos和lwip,但是都还不是真正的网络多任务,真正的网络多任务应该是什么样子的呢?应该是有一个专门的任务负责网络的通讯,他负责将数据发送出去,将数据接收回来,而其他的需要用到网络的任 ...
- IOS开发之IOS8.0最新UIAlertController
最近苹果更新的IOS8 对以前进行了很大的修改, 更新的API也让人捉急,据说iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.比如全新的UIPrese ...
- poj2528 Mayor's posters(线段树区间覆盖)
Mayor's posters Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 50888 Accepted: 14737 ...
- EntityFrameWork分页
EF分页代码 using System; using System.Collections.Generic; using System.Linq; using System.Web; using Sy ...
- Android布局及属性归总(查询用)
常见布局 LinearLayout 线性布局 子元素任意,组织成一个单一的水平或垂直行,默认为水平方向TableLayout 表格布局 子元素为<Tabl ...
- 使用PopupMenu创建弹出式菜单
PopupMenu代表弹出式菜单,它会在指定组件上弹出PopupMenu,默认情况下,PopupMenu会显示在该组件的下方或上方.PopupMenu可增加多个菜单项,并可为菜单项增加子菜单. 使用P ...
- iOS 开源库介绍
1. Github-iOS备忘 2. iOS 第三方开源库的吐槽和备忘 3. 移动开发的后台服务支持平台 4. iOS 开源库 之 AFNetWorking 2.x 5. iOS 之 二维码 ZXin ...
- 关于mysql中触发器old和new如何更好的区别我有话要说?
1.当使用insert语句的时候,如果原表中没有数据的话,那么对于插入数据后表来说新插入的那条数据就是new,如图所示: 2.当使用delete语句的时候,删除的那一条数据相对于删除数据后表的数据来说 ...
- 黄聪:VPS用轻松备份工具备份Wordpress,文件夹通配符
db;log;wp-admin;wp-includes;temp;upgrade;twentyfourteen;twentyfifteen;twentysixteen;twentythirteen;t ...