|Note: Some of the information on this page is for our legacy systems only. The page is scheduled for an update to make it applicable to Graham.|
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently.
Testing Theano 0.9 (new pygpu backend) on Copper/Mosaic
A test version of Theano v0.9.0b1 is installed on Copper/Mosaic. To use this Theano, please do:
This will load python 2.7.10 module together with some useful python packages (e.g. OpenCV, Hickle, ZMQ, Lasagne, Cython, mpi4py, etc)
Theano on Mosaic and Copper
Currently, Mosaic and Copper cluster have CUDA7.5 and python/intel/2.7.10 module which includes Theano 0.7. To use this Theano, please do before submitting jobs:
module unload intel/12.1.3 mkl/10.3.9 openmpi/intel/1.6.2 module load intel/15.0.3 module load hdf/serial/126.96.36.199 module unload cuda module load cuda/7.5.18 module load python/intel/2.7.10
You still need to edit “.theanorc” under /home/username by adding “device = gpu” under [global]:
[global] floatX = float32 device = gpu
Theano with cuDNN
cuDNN is an NVIDIA library with functionality used by deep neural network. It provides optimized versions of some operations like the convolution.
To make theano to use cuDNN, you should set the environment variables LD_LIBRARY_PATH, LIBRARY_PATH and CPATH.
Example for cuDNN v4:
On Copper or Mosaic: export LD_LIBRARY_PATH=/opt/sharcnet/testing/cudnn/cudnn4:$LD_LIBRARY_PATH export CPATH=/opt/sharcnet/testing/cudnn/cudnn4:$CPATH export LIBRARY_PATH=/opt/sharcnet/testing/cudnn/cudnn4:$LD_LIBRARY_PATH
By default, Theano will detect if it can use cuDNN. If so, it will use it. If not, Theano optimizations will not introduce cuDNN ops. So Theano will still work if the user did not introduce them manually.
Installing an updated version of theano is easy.
After you login to Mosaic or Copper and setup the modules:
module unload intel mkl openmpi cuda module load intel/15.0.3 module load hdf/serial/188.8.131.52 module load cuda/7.5.18 module load python/intel/2.7.10
you can get the latest Theano form github:
git clone https://github.com/Theano/Theano.git
cd to Theano folder and run:
python setup.py build python setup.py install --user
This will install the Theano in your /home/yourname/.local folder and make it default version when you import theano in python.
Flushing output of Python print
Sometimes you may not see the output in the file, which specified when submitting job, until PYTHON flush the output buffer to it. If you want an unbuffered output (immediately writing output into file), you can add "-u" option after "python" command:
python -u code.py