我正在从源代码 (文档) 安装 tensorflow。
Cuda驱动版本:
nvcc: NVIDIA (R) Cuda compiler driver
Cuda compilation tools, release 7.5, V7.5.17
当我运行以下命令时:
bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu
它给了我以下错误:
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:118] Found device 0 with properties:
name: GeForce GT 640
major: 3 minor: 0 memoryClockRate (GHz) 0.9015
pciBusID 0000:05:00.0
Total memory: 2.00GiB
Free memory: 1.98GiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:138] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_init.cc:148] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
I tensorflow/core/common_runtime/gpu/gpu_device.cc:843] Ignoring gpu device (device: 0, name: GeForce GT 640, pci bus id: 0000:05:00.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
F tensorflow/cc/tutorials/example_trainer.cc:128] Check failed: ::tensorflow::Status::OK() == (session->Run({{"x", x}}, {"y:0", "y_normalized:0"}, {}, &outputs)) (OK vs. Invalid argument: Cannot assign a device to node 'Cast': Could not satisfy explicit device specification '/gpu:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
[[Node: Cast = Cast[DstT=DT_FLOAT, SrcT=DT_INT32, _device="/gpu:0"](Const)]])
F tensorflow/cc/tutorials/example_trainer.cc:128] Check failed: ::tensorflow::Status::OK() == (session->Run({{"x", x}}, {"y:0", "y_normalized:0"}, {}, &outputs)) (OK vs. Invalid argument: Cannot assign a device to node 'Cast': Could not satisfy explicit device specification '/gpu:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
[[Node: Cast = Cast[DstT=DT_FLOAT, SrcT=DT_INT32, _device="/gpu:0"](Const)]])
F tensorflow/cc/tutorials/example_trainer.cc:128] Check failed: ::tensorflow::Status::OK() == (session->Run({{"x", x}}, {"y:0", "y_normalized:0"}, {}, &outputs)) (OK vs. Invalid argument: Cannot assign a device to node 'Cast': Could not satisfy explicit device specification '/gpu:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
[[Node: Cast = Cast[DstT=DT_FLOAT, SrcT=DT_INT32, _device="/gpu:0"](Const)]])
F tensorflow/cc/tutorials/example_trainer.cc:128] Check failed: ::tensorflow::Status::OK() == (session->Run({{"x", x}}, {"y:0", "y_normalized:0"}, {}, &outputs)) (OK vs. Invalid argument: Cannot assign a device to node 'Cast': Could not satisfy explicit device specification '/gpu:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
[[Node: Cast = Cast[DstT=DT_FLOAT, SrcT=DT_INT32, _device="/gpu:0"](Const)]])
Aborted (core dumped)
我需要不同的 gpu 来运行它吗?
原文由 Abhijay Ghildyal 发布,翻译遵循 CC BY-SA 4.0 许可协议
我已经安装了 Tensorflow 修订版 1.8。它推荐CUDA 9.0。我正在使用具有 CUDA 计算能力 3.0 的 GTX 650M 卡,现在可以正常工作了。操作系统是 ubuntu 18.04。下面是详细步骤:
安装依赖项
我已经为我的 opencv 3.4 编译包含了 ffmpeg 和一些相关的包,如果不需要,请不要安装运行以下命令:
安装 nvidia 驱动程序
运行以下命令:
重新启动并运行以下命令,它应该会为您提供如下图所示的详细信息:
gcc-6 和 g++-6 检查。
CUDA 9.0 需要 gcc-6 和 g++-6,运行以下命令:
安装 CUDA 9.0
转到 https://developer.nvidia.com/cuda-90-download-archive 。选择选项:Linux->x86_64->Ubuntu->17.04->deb(local)。下载主文件和两个补丁。运行以下命令:
导航到您PC上的第一个补丁并双击它,它会自动执行,第二个补丁也是如此。
将以下内容添加到您的 ~/.bashrc 文件中并重新启动它:
为 CUDA 9.0 安装 cudnn 7.1.4
从 https://developer.nvidia.com/cudnn 下载 tar 文件并将其解压缩到您的下载文件夹下载需要 nvidia 开发的登录名,免费注册运行以下命令:
为 CUDA 9.0 安装 NCCL 2.2.12
从 https://developer.nvidia.com/nccl 下载 tar 文件并将其解压缩到您的下载文件夹下载需要 nvidia 开发的登录名,免费注册运行以下命令:
安装 Bazel(推荐手动安装 bazel,参考: https ://docs.bazel.build/versions/master/install-ubuntu.html#install-with-installer-ubuntu)
从 https://github.com/bazelbuild/bazel/releases 下载“bazel-0.13.1-installer-darwin-x86_64.sh”运行以下命令:
编译 Tensorflow
我们将使用 CUDA、XLA JIT(哦,是的)和 jemalloc 作为 malloc 支持进行编译。所以我们对这些事情输入是。运行以下命令并按照运行配置中的描述回答查询
现在要编译 tensorflow,运行下面的命令,这是超级 RAM 消耗,需要时间。如果您有大量 RAM,您可以从下面的行中删除“–local_resources 2048,.5,1.0”,否则这将适用于 2 GB 的 RAM
编译完成后,您将看到如下图所示的内容,确认编译成功
构建 wheel 文件,在下面运行:
使用pip安装生成的wheel文件
要在设备上探索,现在可以运行 tensorflow,下图是 ipython 终端上的展示