Skip to main content

Link to section 'Tensorflow on Hammer' of 'Tensorflow' Tensorflow on Hammer

Link to section 'Tensorflow Modules' of 'Tensorflow' Tensorflow Modules

A set of stable tensorflow builds are provided on Hammer. At present, tensorflow is part of the ML-Toolkit packages. You must load one of the learning modules before you can load the tensorflow module. We recommend getting an interactive job for running Tensorflow.

  • First, load a desired learning module:
    $ module load learning/conda-5.1.0-py36-cpu
  • To list available tensorflow modules:
    $ module spider ml-toolkit-cpu/tensorflow
  • To show default tensorflow module:
    $ module show ml-toolkit-cpu/tensorflow
  • To load default tensorflow module:
    $ module load ml-toolkit-cpu/tensorflow
  • To test that tensorflow is available:
    $ python -c "import tensorflow as tf"
  • Important: The tensorflow modules previosuly available, such as tensorflow/1.2.0_py27-cpu and tensorflow/1.2.0_py35-cpu, are deprecated and will not work with the ml-toolkit-cpu modules. Please update your job scripts to use the ml-toolkit-cpu/tensorflow module.
  • Link to section 'Install' of 'Tensorflow' Install

    Downloading and installing Tensorflow in user's home directory using anaconda environments is recommended. Installing Tensorflow in your home directory has the advantage that it can be upgraded to newer versions easily. Therefore, researchers will have access to the latest libraries when needed.

    • We recommend getting an interactive job for installing and running Tensorflow.
    • First load the necessary modules and define which tensorflow version to install:
      $ module purge
      $ module load anaconda/5.1.0-py36
      $ module list $ export TF_BINARY_URL="" 
    • Create an anaconda environment using conda-env-mod. The script also prints a list of modules that should be loaded to use the custom environment, please note down these module names.
      $ conda-env-mod create -n my_tf_env
    • Activate the anaconda environment.
      $ module load use.own
      $ module load conda-env/my_tf_env-py3.6.4
    • Now install Tensorflow binaries in your home directory:
      $ pip install --ignore-installed --upgrade $TF_BINARY_URL
    • Wait for installation to finish.
    • If the installation finished successfully, you can now proceed with the examples below. If not, please look at common installation problems and how to resolve them.

    Link to section 'Testing the installation' of 'Tensorflow' Testing the installation

    • Check that you have the anaconda module and your custom environment loaded using the command module list. Otherwise, load the necessary modules:
      $ module load anaconda/5.1.0-py36
      $ module load use.own
      $ module load conda-env/my_tf_env-py3.6.4 
    • Save the following code as
      # filename:
      import tensorflow as tf
      hello = tf.constant('Hello, TensorFlow!')
      sess = tf.Session()
    • Run the example
      $ python
    • This will produce an output like the following:
      < ... tensorflow build related information ... >
      < ... hardware information ... >
      Hello, TensorFlow!

    Link to section 'Tensorboard' of 'Tensorflow' Tensorboard

    • You can visualize data from a Tensorflow session using Tensorboard. For this, you need to save your session summary as described in the Tensorboard User Guide.
    • Launch Tensorboard:
      $ python -m tensorboard.main --logdir=/path/to/session/logs
    • When Tensorboard is launched successfully, it will give you the URL for accessing Tensorboard.
      <... build related warnings ...> 
      TensorBoard 0.4.0 at
    • Follow the printed URL to visualize your model.
    • Please note that due to firewall rules, the Tensorboard URL may only be accessible from Hammer nodes. If you cannot access the URL directly, you can use Firefox browser in Thinlinc.
    • For more details, please refer to the Tensorboard User Guide.

    Thanks for letting us know.

    Please don’t include any personal information in your comment. Maximum character limit is 250.
    Characters left: 250
    Thanks for your feedback.