Configure theano the windows and pygpu

For the first time to build on the windows theano, in order to achieve accelerated computing gpu, repeatedly stepped on a pit configuration operating environment, specially recorded.

A, GPU driver installation

 1.1 to enter the NVIDIA driver download to download and install qualifying.

Two, CUDA download and install

2.1 from NVIDIA official website choose a CUDA version to download.

2.2 Use the following command to see if the installation was successful:

  

nvcc -V

 

2.3 Configuration path environment

I installed the 10.1 it is:

   C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp; 

Three, CUDNN download and install

3.1 This is the download address . According to its own CUDA version installed select the appropriate version of CUDNN.

3.2 I unpacked into the directory C: \ Cuda10.1 the directory.

Four, Anacond installation

4.1 Download: https://www.anaconda.com/download/

4.2 Installation anacond

4.3 system path variable increases

  C:\Anaconda3 

  C:\Anaconda3\Scripts

  C:\Anaconda3\Library\bin

4.4 anacond runtime configuration

conda create -n env_name37 anaconda python=3.7

  

4.5 Replacing anacond operating environment on the windows menu

  Anaconda Prompt (env_name37) 

4.6 Installation theano

  

conda install Theano

  

4.7 in the directory C: Create a profile \ Users \ [Your_User] under .theanorc

The document reads as follows:

[global]
device = cuda
floatX=float32

[nvcc]
flags=--machine=64

[cuda]
root = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1

[dnn]
library_path = C:\cuda10.1\lib\x64
include_path = C:\cuda10.1\include

[lib]
cnmem=100

 

五、Theano 1.0.3 issue with pygpu: ERROR (theano.gpuarray): Could not initialize pygpu, support disabled 出错处理

5.1 In the run python import theano be wrong:

ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\theano\gpuarray\__init__.py", line 227, in 
    use(config.device)
  File "C:\ProgramData\Anaconda3\lib\site-packages\theano\gpuarray\__init__.py", line 214, in use
    init_dev(device, preallocate=preallocate)
  File "C:\ProgramData\Anaconda3\lib\site-packages\theano\gpuarray\__init__.py", line 99, in init_dev
    **args)
  File "pygpu\gpuarray.pyx", line 658, in pygpu.gpuarray.init
  File "pygpu\gpuarray.pyx", line 587, in pygpu.gpuarray.pygpu_init
pygpu.gpuarray.GpuArrayException: b'Could not load "nvrtc64_70.dll": \xd5\xd2\xb2\xbb\xb5\xbd\xd6\xb8\xb6\xa8\xb5\xc4\xc4\xa3\xbf\xe9\xa1\xa3\r\n'

  This is because I'm using a 10.1 cuda and pygpu 0.7.6 does not support. Although the code has been modified on git, but did not generate a new version. We need to manually compile their own to solve this problem.

5.2 git source available

conda install cmake
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15 Win64"

5.3 manually compile

  Generate new gpuarray.dll project with VS compiler gpuarray.vcxproj 

       Cover C: / Anaconda3 / Library / bin directory under the same name

       Then re-run import theano will get the following error:

pygpu.gpuarray.GpuArrayException: b'Could not load "nvrtc64_101.dll": The specified module could not be found.\r\n'

5.4 manually generate nvrtc64_101.dll

 The C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ nvrtc64_101_0.dll file \ under v10.1 bin \ directory copy to C: / Anaconda3 / Library / bin directory, and renamed nvrtc64_101.dll

    Then re-run import theano will get the following error:

pygpu.gpuarray.GpuArrayException: (b'Missing Blas library', 5)

5.5 manually generate cublas64_101.dll  

    The C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ cublas64_10.dll file \ under v10.1 bin \ directory copy to C: / Anaconda3 / Library / bin directory, and renamed cublas64_101.dll

   Then re-run import theano success.

*如果还有其它什么错,通常是 path 变量中没有包含需要执行的文件的目录。

5.6 download check_blas.py

   Download: https://raw.githubusercontent.com/Theano/Theano/master/theano/misc/check_blas.py

   run:

python check_blas.py

 The results finally succeeded:

 

 

Guess you like

Origin www.cnblogs.com/citycomputing/p/11615104.html