Hprc banner tamu.png

SW:Keras

From TAMU HPRC
Revision as of 10:07, 20 March 2018 by Yangliu (talk | contribs) (Keras on Ada)
Jump to: navigation, search

Keras

Description

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.

Access

Keras is open to all HPRC users.

Anaconda and Keras Packages

TAMU HPRC currently supports the user of Keras though the Anaconda modules. There are a variety of Anaconda modules available on Ada and Terra.

While several versions of Anaconda have some Keras environments installed, it is simplest to use exactly the versions in the following sections.

You can learn more about the module system on our SW:Modules page.

You can explore the available Anaconda environments on a per-module basis using the following:

[NetID@ada ~]$ module load Anaconda/[SomeVersion]
[NetID@ada ~]$ conda info --envs

Keras on Ada

For module Anaconda/3-5.0.0.1 (Python 3), there are a keras-gpu-2.1.4 environment using GPUs and a keras-2.1.4 environment using only CPUs on Ada. Please note that your program using GPUs should be run on GPU nodes.

To load keras-gpu-2.1.4 for python 3.6:

[NetID@terra ~]$ module load Anaconda/3-5.0.0.1
[NetID@terra ~]$ source activate keras-gpu-2.1.4
[NetID@terra ~]$ [run your Python program accessing Keras]
[NetID@terra ~]$ source deactivate

To load keras-2.1.4 for python 3.6:

[NetID@terra ~]$ module load Anaconda/3-5.0.0.1
[NetID@terra ~]$ source activate keras-2.1.4
[NetID@terra ~]$ [run your Python program accessing Keras]
[NetID@terra ~]$ source deactivate

This version can be run on any of the 64GB or 256GB compute nodes.

Keras on Terra

For module Anaconda/3-5.0.0.1 (Python 3), there are a keras-gpu-2.1.2 environment using GPUs and a keras-2.0.5 environment on Terra. For module Anaconda/2-5.0.1 (Python 2), there are keras-gpu-2.1.5 environment using GPUs and a keras-2.1.5 environemnt using only CPUS on Terra. Your program using GPUs should run on GPU nodes.

To load keras-gpu-2.0.5 for python 3.6:

[NetID@terra ~]$ module load Anaconda/3-5.0.0.1
[NetID@terra ~]$ source activate keras-gpu-2.0.5
[NetID@terra ~]$ [run your Python program accessing Keras]
[NetID@terra ~]$ source deactivate

To load keras-gpu-2.1.2 for python 3.6:

[NetID@terra ~]$ module load Anaconda/3-5.0.0.1
[NetID@terra ~]$ source activate keras-gpu-2.1.2
[NetID@terra ~]$ [run your Python program accessing Keras]
[NetID@terra ~]$ source deactivate

To load keras-gpu-2.1.5 for python 2.7:

[NetID@terra ~]$ module load Anaconda/2-5.0.1
[NetID@terra ~]$ source activate keras-gpu-2.1.5
[NetID@terra ~]$ [run your Python program accessing Keras]
[NetID@terra ~]$ source deactivate

To load keras-2.1.5 for python 2.7:

[NetID@terra ~]$ module load Anaconda/2-5.0.1
[NetID@terra ~]$ source activate keras-2.1.5
[NetID@terra ~]$ [run your Python program accessing Keras]
[NetID@terra ~]$ source deactivate

Example Keras Script

As with any job on the system, Keras should be used via the submission of a job file. Scripts using Keras are written in Python, and thus Keras scripts should not be written directly inside a job file or entered in the shell line by line. Instead, a separate file for the Python/Keras script should be created, which can then be executed by the job file.

To create a new script file, simply open up the text editor of your choice.

Below is an example script (entered in the text editor of your choice):

TO BE PROVIDED


It is recommended to save this script with a .py file extension, but not necessary.

Once saved, the script can be tested on a login node by entering:

[NetID@terra ~]$ python testscript.py