安装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环境的更多相关文章

  1. ubuntu16.04 ROS环境下配置和运行SVO

    ubuntu16.04 ROS环境下配置和运行SVO https://blog.csdn.net/nnUyi/article/details/78005552

  2. Ubuntu16.04 lnmp 环境搭建

    Ubuntu16.04 lnmp 环境搭建 nginx 安装 sudo apt-add-repository ppa:nginx/stablesudo apt-add-repository ppa:o ...

  3. Python在ubuntu16.04上环境搭建

    1.anaconda3安装 mkdir anaconda cd anaconda wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linu ...

  4. ubuntu16.04 英文环境安装google chrome

    1.下载google wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 2.安装缺少的依赖 ...

  5. ubuntu16.04 英文环境安装中文输入法

    1. 安装语言包 System Settings–>Language Support–>Install/Remove Languages 选中chinese,点击Apply应用即可,等待下 ...

  6. ubuntu16.04 开发环境搭建

    1.更换源 sudo gedit /etc/apt/sources.list 2.更新系统 sudo apt-get update sudo apt-get dist-upgrade     3.移动 ...

  7. cartographer Ubuntu16.04 ros环境配置

    首先要正确安装 ROS ,然后第12步应注意,proto的版本是个关键容易出错.   1.添加ROS源http:/packages.ros.org/ros/ubuntu xenial main   ( ...

  8. R在ubuntu16.04上环境搭建

    1.R安装 sudo apt-get update sudo apt-get remove vim-common sudo apt-get install vimapt-cache show r-ba ...

  9. Ubuntu16.04+cuda8.0rc+opencv3.1.0+caffe+Theano+torch7搭建教程

    https://blog.csdn.net/jywowaa/article/details/52263711 学习中用到深度学习的框架,需要搭建caffe.theano和torch框架.经过一个月的不 ...

随机推荐

  1. Linux下hosts、host.conf、resolv.conf

    /etc/resolv.conf 该文件是DNS域名解析的配置文件,它的格式很简单,每行以一个关键字开头,后接配置参数. resolv.conf的关键字主要有四个,分别是: nameserver   ...

  2. S3C2440启动代码2440init.s彻底解析

    可以选择nand启动和nor启动,这两者之间的关系通过一个按键来选择 这个OM0有何玄机,在数据手册中有这么一段 位宽RAM启动了(当然,还得设置一些东西,下面就说), Nanaflash启动经历的过 ...

  3. linux 更换yum源

    1.进入存放源配置的文件夹 cd /etc/yum.repos.d 2.备份默认源 mv ./CentOS-Base.repo ./CentOS-Base.repo.bak 3.使用wget下载163 ...

  4. php包管理工具最基本的一些问题

    windows下的 1.先安装windows下的set-up程序 点击一步步的, cmd进入,输入composer能成功显示一幅图说明安装成功 2.在下载,https://getcomposer.or ...

  5. SQLite高级:一库建多表,封装类

    package eoe.database; import android.content.Context; import android.database.sqlite.SQLiteDatabase; ...

  6. MMA

    在32位的系统上,线性地址空间可达到4GB,这4GB一般按照3:1的比例进行分配,也就是说用户进程享有前3GB线性地址空间,而内核独享最后1GB线性地址空间.由于虚拟内存的引入,每个进程都可拥有3GB ...

  7. Bomb(hdu 3555)

    题意:给定一个闭区间,求区间内有多少数中含"49" /* dp[i][j]表示i位数以j为最高位位中的所有不符合数的个数. 然后把数字拆分,乱搞即可. */ #include< ...

  8. checkbox、radio控件和文字不对其

    一般使用html控件的时候  单选按钮和复选框的控件和文字不对齐 给input控件加上   style="vertical-align: middle; margin-top: -2px; ...

  9. Bonferroni校正法

    Bonferroni校正:如果在同一数据集上同时检验n个独立的假设,那么用于每一假设的统计显著水平,应为仅检验一个假设时的显著水平的1/n http://baike.baidu.com/view/12 ...

  10. JavaScript实用功能代码片段

    把平时网站上常用的一些实用功能代码片段通通收集起来,方面网友们学习使用,利用好的话可以加快网友们的开发速度,提高工作效率. 1.原生JavaScript实现字符串长度截取 function cutst ...