Install Theano and configure GPU detailed tutorials in the WIN10 environment

Source: Internet
Author: User
Tags theano nvcc

A Software and Environment

(1) installation date 2016/12/23;

(2) raw material VS2013,cuda-8.0(preferably download cuda7.5, currently theano-0.8.2 support for cuda-8 is not very good),anaconda3-4.2.0( in a position);

(3) the environment is WIN10.

Two Installation steps

(1) install the VS2013. This is nothing to say, download The version is the next step, OK on the line, remember the installation location is OK, I here the installation directory is D:\software\VS2013:

then right-click on My Computer -"Properties -" Advanced system settings -"environment variable, then edit the system variable Path, Add two paths D:\software\VS2013\VC\bin and D:\software\VS2013\Common7\IDE, separated by semicolons,

Click OK.

(2) cuda installation. This also nothing to say, to the official web download cuda, and all the way next + OK, note if the installation process win10 prompt to block an action , be sure to either allow this operation or allow the program to operate, or cuda will fail to install. Cuda official website address is

http://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/#axzz46v2MC6l8,

for https://developer.nvidia.com/cuda-downloads,

( Note: This is the cuda-8 version, the current version of the Theano support is not very good, but does not affect the use, it is best to download cuda7.5, I don't bother to reload again, so I use the cuda-8)

also be sure to remember the Cuda installation path, my path is C:\Program files\nvidia GPU Computing toolkit\cuda\v8.0,

(3) Right-click My Computer -"Properties -" Advanced system settings -"environment variable, you can see the system variable added two variables Cuda_ PATH and cuda_path_v8_0,

then edit the system variables Path, add two paths %cuda_path%\lib\x64 and %cuda_path%\bin, separated by semicolons ,

Click OK.

Open the command line, enter nvcc-v, and if it appears, install successfully:

and can go to the directory C:\ProgramData\NVIDIA Corporation\cuda samples\v8.0\1_utilities\devicequery down with VS2013 Open and run the test sample devicequery_vs2013.vcxproj file (note that C:\ProgramData is a hidden folder and you need to click C Disk - "View - "option - view, check Show hidden files, folders, and drives, click OK. )

the figure shows viewing options for the C:\ProgramData folder

the location of the devicequery_vs2013.vcxproj is shown

the figure is running results in the VS2013

Last Act Result = Pass indicates that the installation configuration was successful.

(4) install anaconda3-4.2.0, this is very simple, is the way to determine, remember the installation location, such as I was installed in D:\software\Anaconda3,

then right-click My Computer -"Properties -" Advanced system settings -"environment variable, add PATH to the user variable , and add Paths D:\software\Anaconda3,D:\software\Anaconda3\Scripts and d:\ Software\anaconda3\library\bin, click OK.

Enter Python after entering the command line , andif the message appears, the installation succeeds:

Close the command line.

(5) install MinGW and libpython. After opening the command line, enter conda install MinGW libpython , now Libpython has supported python3.5 , there is no need to configure the python3.4 environment anymore. Note If the installation MinGW is slow, you can ctl+c and exit the command line, and then go to the command line to modify the Anaconda image, here is the recommended Tsinghua image, by typing in the command line:

Conda config--add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

Conda Config--set show_channel_urls Yes

, then Conda install MinGW Libpython .

after that you can see the MinGW folder in the Anaconda3 installation directory,

( Note: Online said need to add MinGW path to the environment variable, in fact, no, wait for the Theano configuration file to be marked out MinGW Location )

(6) install the Theano. First open the command line, enter conda install scipy, and then enter the pip install Theano . (Why enter conda install scipy I do not understand, but online advice). Then create a new ". Theanorc.txt" document under the Personal home folder. The Personal home folder is the folder path that is displayed when you open the command line, such as my C:\Users\15540:

Note The Theano configuration file is . Theanorc.txt, note that the previous point is to have, and the file name is . Theanorc, . txt is the file type, don't get it wrong. Open the . Theanorc.txt to write the following information:

[Global]

Openmp=false

device = GPU

Optimizer_including=cudnn

Floatx = float32

Allow_input_downcast=true

[Lib]

Cnmem = 0.8

[Blas]

ldflags=

[GCC]

Cxxflags=-id:\software\anaconda3\mingw

[NVCC]

Flags =-ld:\software\anaconda3\libs

Compiler_bindir = D:\software\VS2013\VC\bin

Fastmath = True

Note the need toCxxflags=-id:\software\anaconda3\mingwyou'll have to change.Anaconda3inMinGWthe location,flags =-ld:\software\anaconda3\libschange it for you.Anaconda3inLibsthe location,Compiler_bindir = D:\software\VS2013\VC\binchange it for you.VS2013inVC\binthe location;Cnmem = 0.8This online says set as1, but there seems to be a problem, it is recommended to set less1the value, as I set here to0.8, which prevents the subsequent displayCnmem is disabledup.

(7) update cudnn file, to the online search cudnn download down (to the official website registration can be downloaded, the official website is https:// DEVELOPER.NVIDIA.COM/CUDNN). Extract the downloaded files, extract the cuda folder, which contains 3 folders,. Set three folders to replace the corresponding files within the system, overwrite the replacement can be, for example, my file directory is C:\Program files\nvidia GPU Computing toolkit\cuda\v8.0. Overwrite the back import Theano will not appear CuDNN not available hint.

(8)TestTheano. Open the command line and enterpython, in the inputImport Theano, if it appearsunicodedecodeerror: ' utf-8 ' codec can ' t decode byte 0xd5 in position 11:invalid continuation byteThis coding problem because of the drop-inNVCCThe returned string is used by thecwindowsdefault default encoding, directly foundTheanoin the corresponding error file, the source error to change the place*.decode ("GBK")we can. For example, mine is inTheanounder the__init__.pyThe encoding problem that occurs, is modified to:

(If the above error occurs, close the command line to modify the error, re-enter the command again) the following screen indicates success.

( Note: You can see that there are still warning, but it does not affect the use, the cause of warning is mainly cuda-8 to the current version of the Theano support is not good cause, but believe that the later update Theano will solve this problem, if you really can not accept this warning Install cuda7.5, same steps )

Three Other questions

(1) do not add PYTHONPATH variable in environment variable , otherwise it is easy to appear after import Theano Configparser could not find or have no problem with this component (as I am here);

(2) It is recommended to restart the computer after the installation of Cuda;

(3) If there is any problem after entering the command line, it is suggested to restart the command line after modifying the problem.

(4) If there are other problems, try restarting the computer after the import Theano, if there is a problem, is generally the configuration file . theanorc.txt Problem (I do not configure the method is not entirely suitable for you), the following list some of my reference articles:

http://blog.csdn.net/u011821462/article/details/50145221

http://blog.csdn.net/stormragewang/article/details/51261465

http://blog.csdn.net/voidfaceless/article/details/53711550

Install Theano and configure GPU detailed tutorials in the WIN10 environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.