Theano: I have set devices=cuda0, but the program still use cpu

Created on 21 Jun 2017  路  2Comments  路  Source: Theano/Theano

I am using CPU: AMD 8320 GPU: GTX 750 TI
python 2.7 theano 0.9.0 cuda v8.0

I have set .theanorc.txt as follow.

[global]
openmp=False  
device = cuda0

floatX = float32  
allow_input_downcast=True  
[blas]
ldflags=  
[gcc]
cxxflags=-IC:\ProgramData\Anaconda2\MinGW
[nvcc]
flags = -LC:\ProgramData\Anaconda2\libs
compiler_bindir = C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
fastmath = True  


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

[dnn]
library_path = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
include_path = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include
enabled = True

But when I test if I am using GPU, that sill shows that I am using CPU. But there are no errors.
So I have no idea where is wrong.

Using cuDNN version 5110 on context None
Mapped name None to device cuda0: GeForce GTX 750 Ti (0000:01:00.0)
[GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float32, vector)>), HostFromGpu(gpuarray)(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 0.879000 seconds
Result is [ 1.23178029  1.61879349  1.52278066 ...,  2.20771813  2.29967761
  1.62323296]
Used the cpu

Can someone help me!?

Most helpful comment

The script you are using to test does not seem to detect GPU usage correctly.
In fact, since it prints GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float32, vector)>), you can be sure that it actually is using the GPU.
Are you using the latest version of the script at http://deeplearning.net/software/theano/tutorial/using_gpu.html#testing-theano-with-gpu ?

All 2 comments

The script you are using to test does not seem to detect GPU usage correctly.
In fact, since it prints GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float32, vector)>), you can be sure that it actually is using the GPU.
Are you using the latest version of the script at http://deeplearning.net/software/theano/tutorial/using_gpu.html#testing-theano-with-gpu ?

Thats really helpful!!!!!!!!!!
Thanks!

C:\ProgramData\Anaconda2\python.exe "C:/Users/TSWC/Google Drive/FA/Python_101/testgpu.py"
Using cuDNN version 5110 on context None
Mapped name None to device cuda0: GeForce GTX 750 Ti (0000:01:00.0)
[GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float32, (False,))>), HostFromGpu(gpuarray)(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 1.069000 seconds
Result is [ 1.23178029  1.61879349  1.52278066 ...,  2.20771813  2.29967761
  1.62323296]
Used the gpu

Process finished with exit code 0
Was this page helpful?
0 / 5 - 0 ratings