7

I'm trying to run the example seq2seq by Tensorflow, but it won't use the GPU. Here are the step I took to install Tensorflow on a Linux system with Tesla K20x

git clone --recurse-submodules https://github.com/tensorflow/tensorflow
./configure # Yes GPU
bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu # The GPU is being used)
bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_x86_64.whl

After all of this step, I have tensorflow installed. I then try to run the seq2seq example, by

bazel run -c opt //tutorials/models/rnn/translate:translate

but it will not use the GPU. I then try the example

bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu

and it gives an error

bazel-bin/tensorflow/cc/tutorials_example_trainer: error while loading shared libraries: /path/to/home/.cache/bazel/_bazel_hduong/9e8a6e75473e7bf5c9d1c8a084e2a0e9/tensorflow/bazel-out/local_linux-opt/bin/tensorflow/cc/../../_solib_local/_U_S_Sthird_Uparty_Sgpus_Scuda_Ccudart___Uthird_Uparty_Sgpus_Scuda_Slib64/libcudart.so.7.0: file too short

Was wondering if anyone know what might cause the program to not use the GPU? Any help is appreciated.

Thank you.

1
  • you would need to run ./configure inside tensorflow folder. Then you can mention your cuda driver's path and don't forget to mention the cuda compatibility version. Commented Aug 18, 2016 at 20:20

3 Answers 3

5

The issue looks to be that when you bazel run the translation example, it rebuilds without GPU support. Try adding --config=cuda to the bazel run command, as follows:

$ bazel run -c opt --config=cuda //tensorflow/models/rnn/translate:translate

Without this option, Bazel will recompile the entire TensorFlow runtime without GPU support, and use this version when it runs the example application.

Sign up to request clarification or add additional context in comments.

Comments

1

it occurs since the cuda is not properly linked. Enter the following command in the terminal

sudo ldconfig /usr/local/cuda/lib64

Comments

1

I’m guessing you should install it with a GPU version

pip install tensorflow-gpu

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.