pythontheano

Change `base_compiledir` to save compiled files in another directory


theano.base_compiledir refers to the directory where the compiled files are stored.

Is there a way where I could permanently set theano.base_compiledir to a different location, perhaps by modifying the content of some internal Theano files ?

http://deeplearning.net/software/theano/library/config.html does explain ways for configuring theano in some aspect but I still couldn't address my question.

I am using Ubuntu.


Solution

  • As the documentation explains, you can set this, or any other Theano config flag, permanently by altering either the THEANO_FLAGS environment variable (e.g. in your ~/.bashrc file) or using a ~/.theanorc file.

    For the former, add a line like this to your ~/.bashrc file:

    export THEANO_FLAGS="base_compiledir=/some/path"
    

    For the latter, create a ~/.theanorc file with contents that look like this:

    [global]
    base_compiledir=/some/path
    

    In either case, you'll probably want to add a bunch of other flags such as device=, floatX=, etc.

    If you alter your ~/.bashrc file the changes won't take effect in any active terminals unless you run source ~/.bashrc in each one or simply close the terminals and start new ones.