gpt4 book ai didi

linux - Linux Mint/Ubuntu 14.04 上 Tensorflow 的 GPU 支持

转载 作者:太空宇宙 更新时间:2023-11-04 12:30:58 24 4
gpt4 key购买 nike

所以我安装了 tensorflow,CPU 版本工作正常,但我似乎无法让 GPU 工作。我通过从 Nvidia 下载 .deb 安装了 Cuda。我复制了cudNN的内容

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
#define CUDNN_MAJOR 6
#define CUDNN_MINOR 0
#define CUDNN_PATCHLEVEL 20
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)

#include "driver_types.h"

我在~/.profile中输入了路径

export CUDA_HOME=/usr/local/cuda
export CUDA_ROOT=/usr/local/cuda
export PATH=$PATH:$CUDA_ROOT/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_ROOT/lib64

哦,Nvidia-smi 显示:

| NVIDIA-SMI 375.39                 Driver Version: 375.39                                            |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1080 Off | 0000:01:00.0 On | N/A |
| 10% 54C P0 42W / 200W | 591MiB / 8105MiB | 4% Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1368 G /usr/bin/X 344MiB |
| 0 3078 G cinnamon 129MiB |
| 0 6549 G /usr/lib/virtualbox/VirtualBox 20MiB |
| 0 15491 G ...bleH2AndQuicRequests/Enabled/*NetworkTime 96MiB |

但我仍然使用 Tensorflow:

>>> python
>>> import tensorflow as tf
>>> sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Device mapping: no known devices.
I tensorflow/core/common_runtime/direct_session.cc:257] Device mapping:

我希望你能告诉我我还能做什么。最诚挚的问候和提前致谢

最佳答案

我认为你安装的只是一个简单的(CPU)版本的tensorflow。您必须安装 gpu 版本的 tensorflow。最简单的方法是使用 Python 和 tensorflow 的 anaconda 发行版。

kmario23 ❯ conda install -c anaconda tensorflow-gpu                         
Fetching package metadata .........
Solving package specifications: ..........

Package plan for installation in environment /home/kmario23/anaconda3:

The following packages will be downloaded:

package | build
---------------------------|-----------------
conda-env-2.6.0 | 0 502 B anaconda
cudatoolkit-7.5 | 0 217.2 MB anaconda
cudnn-5.1 | 0 77.2 MB anaconda
tensorflow-gpu-1.0.1 | py35_4 77.4 MB anaconda
conda-4.3.16 | py35_0 510 KB anaconda
------------------------------------------------------------
Total: 372.4 MB

The following NEW packages will be INSTALLED:

cudatoolkit: 7.5-0 anaconda
cudnn: 5.1-0 anaconda
tensorflow-gpu: 1.0.1-py35_4 anaconda

The following packages will be UPDATED:

conda: 4.2.13-py35_0 conda-forge --> 4.3.16-py35_0 anaconda

Proceed ([y]/n)?

继续并立即安装它。


另外,看看一个简单的包搜索会列出一个单独的 GPU tensorflow 版本。

kmario23 ❯ anaconda search -t conda tensorflow                                                                                                          
Using Anaconda API: https://api.anaconda.org
Run 'anaconda show <USER/PACKAGE>' to get more details:
Packages:
Name | Version | Package Types | Platforms
------------------------- | ------ | --------------- | ---------------
HCC/tensorflow | 1.0.0 | conda | linux-64
HCC/tensorflow-cpucompat | 1.0.0 | conda | linux-64
HCC/tensorflow-fma | 1.0.0 | conda | linux-64
SentientPrime/tensorflow | 0.6.0 | conda | osx-64
: TensorFlow helps the tensors flow
acellera/tensorflow-cuda | 0.12.1 | conda | linux-64
anaconda/tensorflow | 1.0.1 | conda | linux-64
anaconda/tensorflow-gpu | 1.0.1 | conda | linux-64
conda-forge/tensorflow | 1.0.0 | conda | linux-64, win-64, osx-64
: TensorFlow helps the tensors flow

我建议从 anaconda channel anaconda/tensorflow-gpu 安装 tensorflow-gpu

关于linux - Linux Mint/Ubuntu 14.04 上 Tensorflow 的 GPU 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43299549/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com