Documentation/Using Tensorflow on the HPC Cluster

From systems
Jump to: navigation, search

Tensorflow on HPC cluster

First you have to create a python environment in conda

In my example i will create environment called project_tensorflow with python version 2 and tensorflow. You have to run this in interactive session.

module load anaconda/conda2
conda create --name project_tensorflow python=2 pip tensorflow

This is how you to activate this environment and start python and load tensorflow on cluster node. And here is code of actually activating that python environment in interactive node

module load anaconda/conda2
source activate project_tensorflow


Tensorflow on HPC cluster Old Style CentOS6 nodes

First you have to create a python environment in conda

In my example i will create environment called project1 with python version 2 and tensorflow. You have to run this in interactive session.

cd /nfs/apps/experimental/Miniconda2/bin/
conda create --name project1 python=2 pip tensorflow

Here is what result of the execution is.

Fetching package metadata: ....
Solving package specifications: ......... 

Package plan for installation in environment /ifs/home/pimri/core/jc4248/.conda/envs/project1:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    mkl-2017.0.3               |                0       129.5 MB
    openssl-1.0.2l             |                0         3.2 MB
    sqlite-3.13.0              |                0         4.0 MB
    zlib-1.2.11                |                0         109 KB
    libprotobuf-3.4.0          |                0         4.3 MB
    python-2.7.13              |                0        11.5 MB
    backports-1.0              |           py27_0           1 KB
    certifi-2016.2.28          |           py27_0         211 KB
    funcsigs-1.0.2             |           py27_0          18 KB
    markdown-2.6.9             |           py27_0          98 KB
    numpy-1.13.1               |           py27_0         6.8 MB
    six-1.10.0                 |           py27_0          16 KB
    werkzeug-0.12.2            |           py27_0         408 KB
    backports.weakref-1.0rc1   |           py27_0           7 KB
    html5lib-0.9999999         |           py27_0         183 KB
    protobuf-3.4.0             |           py27_0         469 KB
    setuptools-36.4.0          |           py27_1         557 KB
    bleach-1.5.0               |           py27_0          21 KB
    pip-9.0.1                  |           py27_1         1.6 MB
    pbr-1.10.0                 |           py27_0         100 KB
    tensorflow-tensorboard-0.1.5|           py27_0         1.6 MB
    mock-2.0.0                 |           py27_0          96 KB
    tensorflow-base-1.3.0      |   py27h0dbb4d0_1        35.9 MB
    tensorflow-1.3.0           |                0           7 KB
    ------------------------------------------------------------
                                           Total:       200.6 MB  

The following NEW packages will be INSTALLED: 

    backports:              1.0-py27_0
    backports.weakref:      1.0rc1-py27_0
    bleach:                 1.5.0-py27_0
    certifi:                2016.2.28-py27_0
    funcsigs:               1.0.2-py27_0
    html5lib:               0.9999999-py27_0
    libprotobuf:            3.4.0-0
    markdown:               2.6.9-py27_0
    mkl:                    2017.0.3-0
    mock:                   2.0.0-py27_0
    numpy:                  1.13.1-py27_0
    openssl:                1.0.2l-0
    pbr:                    1.10.0-py27_0
    pip:                    9.0.1-py27_1
    protobuf:               3.4.0-py27_0
    python:                 2.7.13-0
    readline:               6.2-2                (soft-link)
    setuptools:             36.4.0-py27_1
    six:                    1.10.0-py27_0
    sqlite:                 3.13.0-0
    tensorflow:             1.3.0-0
    tensorflow-base:        1.3.0-py27h0dbb4d0_1
    tensorflow-tensorboard: 0.1.5-py27_0
    tk:                     8.5.18-0             (soft-link)
    werkzeug:               0.12.2-py27_0
    wheel:                  0.29.0-py27_0        (soft-link)
    zlib:                   1.2.11-0 

Proceed ([y]/n)? y 

Fetching packages ...
mkl-2017.0.3-0 100% |#########################################################################################################################| Time: 0:00:49   2.77 MB/s
openssl-1.0.2l 100% |#########################################################################################################################| Time: 0:00:00  15.71 MB/s
sqlite-3.13.0- 100% |#########################################################################################################################| Time: 0:00:00  11.41 MB/s
zlib-1.2.11-0. 100% |#########################################################################################################################| Time: 0:00:00   4.07 MB/s
libprotobuf-3. 100% |#########################################################################################################################| Time: 0:00:00  20.11 MB/s
python-2.7.13- 100% |#########################################################################################################################| Time: 0:00:02   4.21 MB/s
backports-1.0- 100% |#########################################################################################################################| Time: 0:00:00 105.63 kB/s
certifi-2016.2 100% |#########################################################################################################################| Time: 0:00:00   5.01 MB/s
funcsigs-1.0.2 100% |#########################################################################################################################| Time: 0:00:00   1.57 MB/s
markdown-2.6.9 100% |#########################################################################################################################| Time: 0:00:00   3.23 MB/s
numpy-1.13.1-p 100% |#########################################################################################################################| Time: 0:00:00  17.11 MB/s
six-1.10.0-py2 100% |#########################################################################################################################| Time: 0:00:00   1.58 MB/s
werkzeug-0.12. 100% |#########################################################################################################################| Time: 0:00:00   5.46 MB/s
backports.weak 100% |#########################################################################################################################| Time: 0:00:00 806.90 kB/s
html5lib-0.999 100% |#########################################################################################################################| Time: 0:00:00   4.57 MB/s
protobuf-3.4.0 100% |#########################################################################################################################| Time: 0:00:00   6.17 MB/s
setuptools-36. 100% |#########################################################################################################################| Time: 0:00:00   8.10 MB/s
bleach-1.5.0-p 100% |#########################################################################################################################| Time: 0:00:00   2.05 MB/s
pip-9.0.1-py27 100% |#########################################################################################################################| Time: 0:00:00  11.64 MB/s
pbr-1.10.0-py2 100% |#########################################################################################################################| Time: 0:00:00   2.97 MB/s
tensorflow-ten 100% |#########################################################################################################################| Time: 0:00:00  11.72 MB/s
mock-2.0.0-py2 100% |#########################################################################################################################| Time: 0:00:00   4.30 MB/s
tensorflow-bas 100% |#########################################################################################################################| Time: 0:00:01  24.73 MB/s
tensorflow-1.3 100% |#########################################################################################################################| Time: 0:00:00 734.58 kB/s
Extracting packages ...
[bleach     ^[[B         ]|###################################################################################################                                         | [         COMPLETE      ]|############################################################################################################################################| 100 %
Linking packages ...
[      COMPLETE      ]|############################################################################################################################################| 100%
#
# To activate this environment, use:
# $ source activate project1
#
# To deactivate this environment, use:
# $ source deactivate
#
 
 

This is how you to activate this environment and start python and load tensorflow on cluster node. And here is code of actually activating that python environment in interactive node

cd /nfs/apps/experimental/Miniconda2/bin/
source activate project1

Here is result of that activation.

cd /nfs/apps/experimental/Miniconda2/bin/
source activate project1
discarding /nfs/apps/experimental/Miniconda2/bin from PATH
prepending /ifs/home/pimri/core/jc4248/.conda/envs/project1/bin to PATH
(project1)-bash-4.1$ python
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow
>>> print help(tensorflow)