EMAN2_w_theano

GPU-accelerated Neural network particle picking in EMAN2

EMAN2 uses uses the Theano python module for GPU-accelerated neural network particle picking in versions 2.2 and later. This is possible with the SBGrid installation but you must first configure your machine with the Nvidia CUDA Toolkit and a configuration file describing your GPUs. Due to distribution restrictions we cannot install Nvidia nvcc compilers directly.

Download and install the Nvidia CUDA Toolkit

Because the Theano module installed in EMAN2 requires the nvcc compiler and these are not re-distributable, you must first download the Nvidia CUDA Toolkit. You can find that here. It is not necessary to have administrator privileges to install this, but you may want to ask your local administrator to assist to ensure you have the proper drivers for your GPU. Nvidia driver installation requires admin privileges.

Set the CUDA_HOME variable

For Theano to find the Nvidia nvcc compiler and the CUDA libraries required, the CUDA_HOME variable must be set in your shell with the correct path to the CUDA Toolkit.

If your CUDA Toolkit installation is at : /usr/local/cuda

In a bash shell:

  export CUDA_HOME=/usr/local/cuda

In a tcsh shell:

  setenv CUDA_HOME /usr/local/cuda

Configure your ~/.theanorc file

The ~/.theanorc file specifies the configuration attributes for theano. There are many options available for this and they are described in detail here

A simple configuration would be :

[global]
floatX = float32
device = gpu

Test your configuration

Finally, you can test your configuration to be sure it is working properly. run e2.py and then import theano. If configured properly, your GPU should be listed.

 $ e2.py
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
Type "copyright", "credits" or "license" for more information.

IPython 5.3.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
Welcome to the interactive EMAN2 Python interface, provided by ipython

NOTE: that you should NOT be running this program if your intent is to run other
  EMAN2 programs. To do that, quit e2.py and just type the name of the EMAN2 program
  directly at the system command line. This interface is for people who know some
  Python programming.

In [1]: import theano
WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10).  Please switch to the gpuarray backend. You can get more information about how to switch at this URL:
 https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled, cuDNN not available)

Once that is working, you can find a tutorial here : http://blake.bcm.edu/emanwiki/EMAN2/Programs/convnet_pickparticle.

Please email bugs@sbgrid.org if you have any questions or problems.