Theano的安装及GPU的配置
2015-09-08 22:22
253 查看
折腾了一天,我滴个去啊,终于是搞好了。安装的时候跟系统和电脑上有些软件有关联,
VS: VS2013
Anaconda:Anaconda-2.0.1-Windows-x86_64
mingw: mingw-w64-install.exe
到Anoconda网站下载Anaconda-2.0.1-Windows-x86_64,以前的Anaconda版本带MinGW环境,2.0.1版本的Anaconda好像不带MinGW了。
安装的时候勾选把Anaconda加到环境变量中。
安装完检查一下,打开cmd命令行(也可以在Anaconda的命令窗口进行):
正常会返回Python的版本信息
运行安装程序,在Architecture的地方选择 x86_64,安装目录最好是C:\mingw-w64\x86_64。默认的安装目录有空格,最好自己改一下。
MinGW安装不会将MinGW的路径添加到环境变量PATH中,手动将C:\mingw64\bin; 添加到PATH环境变量中。
安装完检查一下,打开cmd命令行:
正常的话也会返回各自的版本信息
Theano就安装到Python环境中,这里就是Anaconda中。
配置文件内容:
import的时候稍等几秒(Theano要进行编译),应该不会有错误。
按照Deeplearning给出的测试例子,编辑一个test.py文件:
执行这个文件,应该能得到正确结果。
如果不考虑GPU,BLAS等问题,现在就大功告成了!
基本上跟“瞭望清晨”的博客上写的差不多,大家可以参开该博客。
Win7配置CUDA并搭建基于Theano框架的GPU加速环境
多谢各位博主的分享,在此一并感谢了。
参考:
Window7 (64位) 上安装Theano 0.7的快捷方法
Win7配置CUDA并搭建基于Theano框架的GPU加速环境
使用GPU和Theano加速深度学习
Theano(Deep Learning Tool) 利用GPU来进行加速的配置及使用
1.Theano的安装
系统环境:win7 64 旗舰版VS: VS2013
Anaconda:Anaconda-2.0.1-Windows-x86_64
mingw: mingw-w64-install.exe
1.1 安装Anaconda
Anaconda包含了Theano所需的各种Python库,使用Anaconda来安装Python环境最方便。到Anoconda网站下载Anaconda-2.0.1-Windows-x86_64,以前的Anaconda版本带MinGW环境,2.0.1版本的Anaconda好像不带MinGW了。
安装的时候勾选把Anaconda加到环境变量中。
安装完检查一下,打开cmd命令行(也可以在Anaconda的命令窗口进行):
C:\Windows\system32>python --version
正常会返回Python的版本信息
1.2 安装MinGW
MinGW含有gcc,g++,ld等常用编译器。直接到MinGW网站下载一个Intaller(一定要64位的):mingw-w64-install.exe。运行安装程序,在Architecture的地方选择 x86_64,安装目录最好是C:\mingw-w64\x86_64。默认的安装目录有空格,最好自己改一下。
MinGW安装不会将MinGW的路径添加到环境变量PATH中,手动将C:\mingw64\bin; 添加到PATH环境变量中。
安装完检查一下,打开cmd命令行:
where gcc where ld
正常的话也会返回各自的版本信息
1.3 安装theano
打开cmd命令行:pip install theano
Theano就安装到Python环境中,这里就是Anaconda中。
1.4 配置gcc的编译环境
在home下(cmd的那个路径)新建一个.theanorc.txt文件,例如home路径是C:\Users\myname。配置文件内容:
[global] openmp=False [blas] ldflags= [gcc] cxxflags = -IC:\mingw-w64\x86_64\mingw64\include cxxflags = -LC:\Anaconda
1.5 检查
打开cmd命令行:python >>>import theano
import的时候稍等几秒(Theano要进行编译),应该不会有错误。
按照Deeplearning给出的测试例子,编辑一个test.py文件:
import numpy as np import time import theano A = np.random.rand(1000,10000).astype(theano.config.floatX) B = np.random.rand(10000,1000).astype(theano.config.floatX) np_start = time.time() AB = A.dot(B) np_end = time.time() X,Y = theano.tensor.matrices('XY') mf = theano.function([X,Y],X.dot(Y)) t_start = time.time() tAB = mf(A,B) t_end = time.time() print "NP time: %f[s], theano time: %f[s] (times should be close when run on CPU!)" %( np_end-np_start, t_end-t_start) print "Result difference: %f" % (np.abs(AB-tAB).max(), )
执行这个文件,应该能得到正确结果。
如果不考虑GPU,BLAS等问题,现在就大功告成了!
2.Theano中GPU的配置
今天有点晚了,下次有时间再补充完整。基本上跟“瞭望清晨”的博客上写的差不多,大家可以参开该博客。
Win7配置CUDA并搭建基于Theano框架的GPU加速环境
多谢各位博主的分享,在此一并感谢了。
参考:
Window7 (64位) 上安装Theano 0.7的快捷方法
Win7配置CUDA并搭建基于Theano框架的GPU加速环境
使用GPU和Theano加速深度学习
Theano(Deep Learning Tool) 利用GPU来进行加速的配置及使用
相关文章推荐
- CRSCTL 与 SRVCTL区别
- 程序员如何在复杂代码中查找到程序的bug?
- c++ 面试题
- 1087. All Roads Lead to Rome (30)
- Websocket实例
- 杭州面试总结
- Jdk5.0泛型
- 模拟ATM机(缺少文件操作部分,不能实现真正意义上的存储)
- android 实现应用卸载反馈
- POJ 3237(树链剖分)
- hdu 4279 Number(找规律)
- Vim配置
- PWM实现ADC和DAC
- JQuery的工具方法
- Android控件之Spinner用法实例分析
- 状态管理
- 用Nagios监控OSSIM中MySQL数据库
- 秋意浓
- 二十三种设计模式之创建型模式之单态模式
- 好用的视频编码转换工具