Theano里配置GPU的新方法
来源:互联网 发布:jenkins mac 安装包 编辑:程序博客网 时间:2024/06/07 06:31
这几天在研究pylearn2,里面有要用到GPU,之前一直很疑惑:明明显卡是支持CUDA的,CUDA也成功安装了,也可以检测得到GPU,为什么在python程序里面就是没法运用GPU
运行下面这个检测程序
# -*- coding: utf-8 -*-"""Created on Tue Sep 29 08:09:11 2015@author: Administrator"""import theanoimport theanofrom theano import function, config, sharedimport theano.tensor as Timport numpyimport timevlen = 10 * 30 * 768 # 10 x #cores x # threads per coreiters = 100rng = numpy.random.RandomState(22)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 xrange(iters): r = f()t1 = time.time()#print("Looping %d times took %f seconds" % (iters, t1 - t0))print theano.config.deviceprint("Result is %s" % (r,))if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]): print isinstance(x.op, T.Elemwise) print('Used the cpu')else: print('Used the gpu')
显示的也是CPU
因此,我只能怀疑是.theanorc.txt的配置出了问题,好在还有另外一种方式来配置GPU,那就是设置如下的环境变量
里面的具体内容为:
nvcc.compiler_bindir=E:\\Microsoft Visual Studio 12.0\\VC\\bin,base_compilerdir=path_to_a_directory_without_such_characters,floatX=float32,device=gpu,nvcc.fastmath=True,nvcc.flags=-LE:\\Anaconda\\libs,gcc.cxxflags = -IE:\\Anaconda\\MinGW,blas.ldflags=,flags = -arch=sm_30
nvcc fatal:Cannot find compiler 'cl.exe' in PATH
再在path里面加入cl.exe的路径,这样就配置完成了,在cmd里面运行一下
大功告成!
0 0
- Theano里配置GPU的新方法
- Theano的安装及GPU的配置
- Theano-艰辛的GPU配置之路
- Win7_64环境theano的GPU配置
- theano的gpu配置.theanorc文件[备忘]
- 配置使用GPU加速的Theano环境
- Theano+GPU配置
- Theano运行GPU配置
- 装theano,配置GPU
- theano gpu配置
- 搭建gpu的theano
- Windows8-64bit环境下Theano的GPU配置
- win8+ubuntu双系统下配置theano的GPU模块
- 转载安装theano后GPU配置的各种坑
- Theano 配置记(Anaconda+Theano 0.7+GPU加速+VS2010)
- Deep Learning: win7安装Theano,配置GPU
- Ubuntu16.04lts 安装Theano配置GPU
- Ubuntu 16.04 LTS 安装Theano配置GPU
- 【Java数据结构】二分查找
- Kafka深入解析Log存储
- 实际试验遇到的一些python问题,包括图片格式转换,python中调用linux命令行,用python画图等等。
- Caffe框架,了解三个文件
- 未释放kafka资源导致的问题
- Theano里配置GPU的新方法
- Code First for Mysql 错误:未为提供程序“MySql.Data.MySqlClient”找到任何 MigrationSqlGenerator。请在目标迁移配置类中使用 SetSql
- CADisplayLink
- 招行网银常见问题汇总
- 单例模式
- C++单例模式实现方式
- 展讯SC7730:Camera兼容引起的打开失败问题
- 设计模式
- 答大一学生:我的专业真这么烂吗?