Search code examples
gputheanotheano-cuda

Theano setting in .theanorc file different beetween gpu and cuda


To configure theano we create a .theanorc file in your home folder and add the following to set up theano to run on GPU.

[global]
device = gpu
floatx = float32

but sometime i save in configure that smbd put device = cuda, what's the difference? As i understans, if you use cuda, it should work faster because cuda drivers will manage gpu more better,not getting other jobs for gpu at calculation time


Solution

  • Setting device=gpu in your .theanorc file instructs Theano to use the cuda backend. On the other hand, setting device=cuda instructs theano to use the libgpuarray backend. Both lead to the use of the GPU (in contrast to setting device=cpu in your .theanorc file which would lead to the use of the CPU), and the difference is the low-level API they use to communicate with it. The libgpuarray backend is the newer one of the two that is a wrapper that allows Theano to communicate with both cuda (for NVIDIA GPUs) and opencl (for non-NVIDIA GPUs).

    Note that the cuda backend will be deprecated in the next release of Theano and it is recommended that you always use the libgpuarray backend henceforth.