布置theano(Windows10,無cuda)


軟件包准備

1、Anaconda 下載地址,包含python、numpy、scipy、nose、pip等包,嗯,很爽。

2、tdm64-gcc 下載地址,windows下的gcc、g++編譯器,用來theano性能優化的,不然速度會很慢(官方文檔如是說)

3、theano源碼 下載地址,github上的實時更新的thenao源碼,可以下載zip包,或者clone。

一、安裝

Anaconda、tdm64-gcc一路下一步安裝即可,沒有什么特殊需要注意的。

下載theano源碼后進入其根目錄例如:theano-master,cmd執行如下命令進行安裝:

python setup.py develop

 

二、配置theanorc.txt

編輯thenaorc.txt 存放在用戶的根目錄,知道根目錄在哪可以cmd執行如下命令進行查看:

echo  %USERPROFILE%

theanorc.txt內容如下(只配置了gcc、g++路徑,用來theano的優化):

[cxx]
flags=C:\TDM-GCC-64\bin
以上C:\TDM-GCC-64\bin路徑為tdm-gcc編譯器的bin目錄,按照你自己的路徑來配置。

三、測試theano安裝成功

cmd打開python,執行:

import theano
theano.test()

import theano執行失敗證明theano安裝不成功,我在theano.test()時出現如下錯誤

ERROR: Failure: ImportError (No module named nose_parameterized)

安裝nose_parameterized即可,cmd執行:

pip install nose_parameterized

后記

1、LINK : fatal error LNK1181: cannot open input file 'cublas.lib' 的問題

可能是因為cuda安裝的該版本(我的是7.5),這個版本的cublas.lib只有64位的,這樣如果你的anacanda安裝的是32位就會在編譯的時候報錯,鏈接不了。

2、theano 提示 g++ not detected !

導入theano包后出現如下警告:

WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.

解決辦法:

conda install mingw libpython

 

3、安裝cudnn

cudnn下載地址

解壓縮,復制到cuda的相應的文件夾里即可。

4、配置文件

[global]
device = cpu
floatX = float32
exception_verbosity=high

[lib]
cnmem = .95

[cuda]  
root=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.0\bin  


[nvcc]
flags=-LD:\Anaconda2\libs
compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
fastmath = True

[traceback]
limit=20

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM