Deploy this BOSH release to bring up Tensorflow on any supported infrastructure (vSphere, Google Compute, Amazon EC2, Microsoft Azure, OpenStack, and more).
Go to file
starkandwayne-bot 9085d95628 Updating CODE_OF_CONDUCT.md 2019-01-15 15:41:09 -05:00
.final_builds release v0.1.0 2017-09-11 06:09:06 +00:00
ci correctly use cloud-config network 2017-09-21 15:43:20 +10:00
config Add Keras-2.0.8 2017-09-11 20:54:38 +10:00
jobs install wheels 2017-09-11 04:23:00 +00:00
manifests release v0.1.0 2017-09-11 06:09:06 +00:00
packages https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/pip_package/setup.py says autograd (and its future dep) are deps 2017-09-11 15:41:43 +10:00
releases/tensorflow release v0.1.0 2017-09-11 06:09:06 +00:00
src Initial scaffold 2017-09-11 06:58:09 +10:00
.gitignore Initial scaffold 2017-09-11 06:58:09 +10:00
CODE_OF_CONDUCT.md Updating CODE_OF_CONDUCT.md 2019-01-15 15:41:09 -05:00
LICENSE.md Initial scaffold 2017-09-11 06:58:09 +10:00
README.md another server example 2017-09-11 20:27:34 +10:00
Rakefile Initial scaffold 2017-09-11 06:58:09 +10:00

README.md

Run Tensorflow on any infrastructure using BOSH

Deploy this BOSH release to bring up Tensorflow on any supported infrastructure (vSphere, Google Compute, Amazon EC2, Microsoft Azure, OpenStack, and more).

STATUS: This BOSH release packages tensorflow and its python dependencies and makes python/tensorflow available. See Usage section. I'm still investigating useful ways to use a cluster of Tensorflow servers.

Install

export BOSH_ENVIRONMENT=<bosh-alias>
export BOSH_DEPLOYMENT=tensorflow
bosh deploy manifests/tensorflow.yml --vars-store tmp/creds.yml

If your BOSH has Credhub, then you can omit --vars-store flag. It is used to generate any passwords/credentials/certificates required by manifests/tensorflow.yml.

Usage

SSH into the running instance:

bosh ssh tensorflow/0

Then activate the virtualenv containing tensorflow:

cd /var/vcap/packages/tensorflow
for dir in $(ls -d /var/vcap/packages/*/bin); do export PATH=$dir:$PATH; done
for dir in $(ls -d /var/vcap/packages/*/lib); do export LD_LIBRARY_PATH=$dir:${LD_LIBRARY_PATH:-}; done
. venv/bin/activate
python

To verify, run a hello world in the python repl:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

To see a simple TensorFlow cluster in action, execute the following:

import tensorflow as tf
hello = tf.constant("Hello, distributed TensorFlow!")
server = tf.train.Server.create_local_server()
sess = tf.Session(server.target)  # Create a session on the server.
sess.run(hello)

To explicitly run a server on a specific port without any peers:

import tensorflow as tf
hello = tf.constant("Hello, distributed TensorFlow!")
cluster = tf.train.ClusterSpec({"local": ["localhost:2222"]})
server = tf.train.Server(cluster, job_name="local", task_index=0)
sess = tf.Session(server.target)  # Create a session on the server.
sess.run(hello)