Skip to content

Setup Theano for GPUs

Suhas Srinivasan edited this page Dec 26, 2018 · 1 revision

A little additional setup is required for Theano to work properly on GPUs.
Create a .theanorc file in your home directory and enter the following lines:

[global]
floatX = float32
device = cuda0

[gpuarray]
preallocate = 0.75 

floatX sets the size of floating point numbers during GPU computation.
device select the computation device. It can be changed to CPU if required.
preallocate when set to 0 <= N <= 1, uses the specified fraction of the total GPU memory (the highest tested value for stable operation was 0.85).
You can use the script test_theano_mode.py to check if Theano is configured properly and if it can use the GPU or the CPU.