Win10 Theano Install Guide

本文详细介绍了如何使用Miniconda安装Theano,并配置其使用GPU加速的方法。包括安装必要的依赖库,如CUDA和Visual Studio 2015等步骤。此外,还提供了验证GPU是否正确配置的示例代码。

basic install guide

1. download miniconda

2. conda install libpython mingw

3. conda install theano

now you can run theano correctly.

Enable GPU

1. download and install cuda8.0

2. downlaod and install vs2015

2. download and install Windows Kits

3. add path "LIB" = "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.14393.0\ucrt\x64"

    add path "INCLUDE" = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\ucrt";

4. add "C:/user/your_user_name/.theanorc.txt":

1 [global] 
2 profile_optimizer=True
3 profile=True
4 floatX = float32 
5 device = gpu 
6 [nvcc] 
7 compiler_bindir=D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
8 [dnn]
9 enable=auto

5. theano gpu cpu test:

 1 from theano import function,config,shared,sandbox
 2 import theano.tensor as T 
 3 import numpy 
 4 import time
 5 print config.profile
 6 
 7 vlen=10*30*768
 8 iters=1000
 9 rng=numpy.random.RandomState(22)
10 x=shared(numpy.asarray(rng.rand(vlen),config.floatX))
11 f=function([],T.exp(x))
12 print (f.maker.fgraph.toposort())
13 t0=time.time()
14 for i in range(iters):
15     r=f()
16 t1=time.time()
17 print("loop %d time took "% iters, t1-t0,'seconds')
18 print("results is",r)
19 if numpy.any([isinstance(x.op,T.Elemwise) for x in f.maker.fgraph.toposort()]):
20     print ('used the cpu')
21 else:
22     print ('used the gpu')

 

转载于:https://www.cnblogs.com/ZJUT-jiangnan/p/4135059.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值