Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change device used of theano

Tags:

python

theano

I tried to change the device used in theano-based program.

from theano import config
config.device = "gpu1"

However I got error

Exception: Can't change the value of this config parameter after initialization!

I wonder what is the best way of change gpu to gpu1 in code ?

Thanks

like image 463
Alex Gao Avatar asked May 12 '15 07:05

Alex Gao


1 Answers

Another possibility which worked for me was setting the environment variable in the process, before importing theano:

import os    
os.environ['THEANO_FLAGS'] = "device=gpu1"    
import theano
like image 50
aKzenT Avatar answered Oct 20 '22 00:10

aKzenT