Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
1. [HCC-DOCS](index.html)
2. [HCC-DOCS Home](HCC-DOCS-Home_327685.html)
3. [HCC Documentation](HCC-Documentation_332651.html)
4. [Running Applications](Running-Applications_7471153.html)
<span id="title-text"> HCC-DOCS : Running Theano </span>
========================================================
Created by <span class="author"> Adam Caprez</span>, last modified on
Jun 14, 2018
Theano is available on HCC resources via the modules system. CPU
versions are available on Sandhills and Tusker; both CPU and GPU
versions are available on Crane. Additionally, installs for both Python
2.7 and 3.6 are provided.
### Initial Setup
Theano attempts to write to a `~/.theano` directory in some
circumstances, which can cause errors as the `/home` filesystem is
read-only on HCC machines. As a workaround, create the directory on
`/work` and make a symlink from `/home`:
**Create & symlink .theano directory**
``` syntaxhighlighter-pre
mkdir -p $WORK/.theano
ln -s $WORK/.theano $HOME/.theano
```
This only needs to be done once on each HCC machine.
### Running the CPU version
To use the CPU version, simply load the module and run your Python code.
You can choose between the Python 2.7, 3.5 or 3.6 environments:
**Python 2.7 version**
``` syntaxhighlighter-pre
module load theano/py27/1.0
python my_python2_script.py
```
or
**Python 3.5 version**
``` syntaxhighlighter-pre
module load theano/py35/1.0
python my_python3_script.py
```
or
**Python 3.6 version**
``` syntaxhighlighter-pre
module load theano/py36/1.0
python my_python3_script.py
```
<span style="color: rgb(0,0,0);font-size: 16.0px;font-weight: bold;">
</span>
<span
style="color: rgb(0,0,0);font-size: 16.0px;font-weight: bold;">Running
the GPU version</span>
To use the GPU version, first create a `~/.theanorc` file with the
following contents (or append to an existing file as needed):
**\~/.theanorc**
``` syntaxhighlighter-pre
[global]
device = cuda
```
Next, load the theano module:
**Load the theano module**
``` syntaxhighlighter-pre
module load theano/py27/0.9
```
To test the GPU support, start an interactive job on a GPU node and
import the theano module within the Python interpreter. You should see
output similar to the following:
**GPU support test**
``` syntaxhighlighter-pre
Python 2.7.15 | packaged by conda-forge | (default, May 8 2018, 14:46:53)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import theano
Using cuDNN version 7005 on context None
Mapped name None to device cuda: Tesla K20m (0000:03:00.0)
```