Tensor Stream Does Not Use GPU

I am trying to run the seq2seq example from Tensorflow, but it will not use the GPU. Here is 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 this step, I have tensorflow installed. Then I try to run the seq2seq example,

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

but he will not use the GPU. Then i will try an example

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

and he 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 

I wonder if anyone knows what can cause a program not to use a GPU? Any help is appreciated.

Thanks.

+5
source share
3 answers

The problem is that when you bazel run translation example, it is restored without the support of the GPU. Try adding --config=cuda to the bazel run command, as shown below:

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

Without this option, Bazel will recompile the entire TensorFlow environment without GPU support and use this version when launching the sample application.

+5
source

this happens because cuda is not properly connected. Enter the following command into the terminal

sudo ldconfig /usr/local/cuda/lib64

+1
source

I assume you should install it with the GPU version

 pip install tensorflow-gpu 
+1
source

Source: https://habr.com/ru/post/1237001/


All Articles