examples/EMAN2_w_theano.md
... ...
@@ -0,0 +1,66 @@
1
+## Using the Theano python module in EMAN2 for neural network particle picking
2
+It is possible to use GPU-accelerated neural network particle picking in EMAN2 versions 2.2 and later in the SBGrid software installation.
3
+*First you must 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.
4
+
5
+### Download and install the Nvidia CUDA Toolkit for CUDA
6
+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](https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=CentOS). 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. This which does require admin privileges.
7
+
8
+### Set the CUDA_HOME variable with a path to your installed CUDA Toolkit.
9
+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.
10
+
11
+If your CUDA Toolkit installation is at : /usr/local/cuda
12
+
13
+For *bash* :
14
+```
15
+ export CUDA_HOME=/usr/local/cuda
16
+```
17
+
18
+For *tcsh* :
19
+```
20
+ setenv CUDA_HOME /usr/local/cuda
21
+```
22
+
23
+### Configure your ~/.theanorc for your GPUs
24
+
25
+There are many options available for this and they are [described here](http://deeplearning.net/software/theano/library/config.html#envvar-THEANORC)
26
+
27
+A simple configuration would be :
28
+
29
+```
30
+[global]
31
+floatX = float32
32
+device = gpu
33
+```
34
+
35
+### Test your configuration
36
+
37
+Finally, you can test your configuration to be sure it is working properly.
38
+run **e2.py** and then **import theano**. If configured properly, your GPU should be listed.
39
+
40
+```
41
+ $ e2.py
42
+Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
43
+Type "copyright", "credits" or "license" for more information.
44
+
45
+IPython 5.3.0 -- An enhanced Interactive Python.
46
+? -> Introduction and overview of IPython's features.
47
+%quickref -> Quick reference.
48
+help -> Python's own help system.
49
+object? -> Details about 'object', use 'object??' for extra details.
50
+Welcome to the interactive EMAN2 Python interface, provided by ipython
51
+
52
+NOTE: that you should NOT be running this program if your intent is to run other
53
+ EMAN2 programs. To do that, quit e2.py and just type the name of the EMAN2 program
54
+ directly at the system command line. This interface is for people who know some
55
+ Python programming.
56
+
57
+In [1]: import theano
58
+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:
59
+ https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29
60
+
61
+Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled, cuDNN not available)
62
+```
63
+
64
+Once that is working, you can find a tutorial here : [http://blake.bcm.edu/emanwiki/EMAN2/Programs/convnet_pickparticle](http://blake.bcm.edu/emanwiki/EMAN2/Programs/convnet_pickparticle),
65
+
66
+Please email *bugs@sbgrid.org* if you have any questions or problems.