2015-11-28 201 views
5

我想通過Tensorflow運行示例seq2seq,但它不會使用GPU。以下是我在Tesla K20x Linux系統上安裝Tensorflow的步驟:Tensorflow不使用GPU

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 

完成此步驟後,我安裝了tensorflow。然後我嘗試

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

運行seq2seq例子,但它不會使用GPU。然後我嘗試的例子

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

,並給出了一個錯誤

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 

想知道是否有人知道什麼可能導致程序無法使用GPU?任何幫助表示讚賞。

謝謝。

+0

你需要tensorflow文件夾內運行./configure安裝。然後,您可以提及您的cuda驅動程序的路徑,不要忘記提及cuda兼容性版本。 –

回答

5

這個問題看起來是,當你翻譯的例子是bazel run時,它不需要GPU支持就可以重建。嘗試添加--config=cudabazel run命令,如下所示:

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

沒有這個選項,巴澤爾將重新編譯沒有GPU支持整個TensorFlow運行,當它運行示例應用程序使用此版本。

1

由於cuda未正確鏈接,因此發生。在終端

sudo ldconfig /usr/local/cuda/lib64

1

輸入以下命令我猜你應該用GPU版本

pip install tensorflow-gpu