google-deepmind / dnc

A TensorFlow implementation of the Differentiable Neural Computer.
Apache License 2.0
2.5k stars 443 forks source link

GPU usage #5

Closed angelo337 closed 7 years ago

angelo337 commented 7 years ago

hi there, is it possible to detect if the DNC is using the GPU when is running the train.py thanks

dm-jrae commented 7 years ago

Well you can log the device placement of ops in your graph:

https://www.tensorflow.org/tutorials/using_gpu#logging_device_placement

namely using

tf.Session(config=tf.ConfigProto(log_device_placement=True))

this prints out all op -> device placements. If the device ends in /gpu:0 (or /gpu:X where X is some integer) then it has been placed on the GPU.

angelo337 commented 7 years ago

this is my Output: Device mapping: no known devices.

any advice please? thanks

dm-jrae commented 7 years ago

There is probably a problem with TensorFlow locating your nvidia driver, e.g. this is discussed in: drorlab/tf-singularity#3. Have you had any luck with this?

angelo337 commented 7 years ago

at last i manage to find out a solution on this post:

https://github.com/deepmind/sonnet

all precedure fix it in this nutshell:

cd sonnet/tensorflow git checkout r1.1 ./configure bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg sudo -H pip uninstall tensorflow sudo -H pip install /tmp/tensorflow_pkg/tensorflow-1.1.0rc1-cp27-cp27mu-linux_x86_64.whl cd ../ bazel build --config=opt //:install bazel-bin/install /tmp/sonnet_pkg sudo -H pip uninstall sonnet sudo -H pip install /tmp/sonnet_pkg/sonnet-1.0-py2-none-any.whl python -c 'import sonnet as snt; import tensorflow as tf; print snt.resampler(tf.constant([0.]), tf.constant([0.]))' cd .. $ cd ~/ $ python

import sonnet as snt import tensorflow as tf snt.resampler(tf.constant([0.]), tf.constant([0.]))