您的位置:首页 > 其它

win764位+NVIDIA Quadro 600+VS2010+anaconda+cuda5.5.20 成功配置使用GPU

2017-03-24 13:42 281 查看
本人电脑属性:

win7旗舰版 64位 12G内存 NVIDIA Quadro 600双显卡

安装步骤:

0、由于本人失败了n次,所以这次是刚装好系统的状态。

1、先安装VS2010,添加环境变量Path: C:\Program
Files (x86)\Microsoft Visual Studio 10.0\VC\bin;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64;

2、在C盘安装anaconda,添加环境变量Path:C:\Anaconda\MinGW\bin;C:\Anaconda\MinGW\x86_64-w64-mingw32\lib;
    重启电脑。注意:总的环境变量Path最后没有分号!

3、在http://download.csdn.net/detail/yeyang911/7523003 下载zip文件
,解压之后里面有theano 的文件夹,把theano文件夹放在C:/Anaconda/Lib/site-packages里面,新建环境变量:PYTHONPATH:
C:\Anaconda\Lib\site-packages\theano  注意:没有分号。在home目录下(cmd可以看到,我的是C:\Users\Administrator),创建(如已经存在则修改)
.theanorc.txt 文件内容如下(就是名字叫做.theanorc的文本文档,注意前面有个.):



保存。然后在Anaconda的Spyder命令行中里输入如下命令:

import theano
print theano.config.blas.ldflags

如果无显示则正常,说明theano安装成功。不成功则重新使用别的theano文件夹。

4、CUDA的配置:http://blog.csdn.net/yeyang911/article/details/17450963 完成之后为了使用GPU,我们要再次修改上面的
.theanorc.txt,将其中的内容改为: 


保存,重启电脑。在cmd中运行python:

import theano

theano.test ( )

如果出现:会一直test吧反正没有error 就说明gpu成功






5、为了更确定成功使用gpu 在spyder中输入:

from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768 # 10 x #cores x # threads per core
iters = 1000

rng = 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 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')

如果出现[b]Used the gpu则成功使用gpu![/b]






总结:每个人情况不一样 使用的软件版本也不一样 大家多试试软件的版本 只要是英伟达的显卡通过gpuz软件测试支持cuda 的都可以配置gpu 的。

感谢参考:http://www.cnblogs.com/hanahimi/p/4127026.html

http://blog.csdn.net/yeyang911/article/details/17450963
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: