【问题标题】:Tensorflow 0.10 (CUDA) on OSX segfaults on python importTensorFlow 0.10 (CUDA) on OSX segfaults on python import
【发布时间】:2016-08-12 18:44:29
【问题描述】:

我一直在尝试在我的 El Capitan Macbook Pro(2013 年末,GeForce GT 750M)上启动并运行 tensorflow 0.10,但到目前为止没有成功。我尝试了official tensorflow documentation's instructions 和其他一些人的方法,包括this onethis one

作为参考,我正在尝试在 OSX 10.11.5 上使用 Python3、CUDA 7.5 和 tensorflow 0.10。

我已经安装了 CUDA,它可以识别我的 GPU。我可以在/Developer/NVIDIA/CUDA-7.5/samples/1_Utilities/deviceQuery 中成功编译deviceQuery 示例。它运行时的输出是:

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GT 750M"
  CUDA Driver Version / Runtime Version          7.5 / 7.5
  CUDA Capability Major/Minor version number:    3.0
  Total amount of global memory:                 2048 MBytes (2147024896 bytes)
  ( 2) Multiprocessors, (192) CUDA Cores/MP:     384 CUDA Cores
  GPU Max Clock rate:                            926 MHz (0.93 GHz)
  Memory Clock rate:                             2508 Mhz
  Memory Bus Width:                              128-bit
  L2 Cache Size:                                 262144 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
  Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 7.5, CUDA Runtime Version = 7.5, NumDevs = 1, Device0 = GeForce GT 750M
Result = PASS

我还下载了 cudnn-7.5 库和头文件,并将这些文件放在 /usr/local/cuda/libinclude 的正确位置。

在 python3 交互式 REPL 中,如果我输入 import tensorflow,我会得到以下输出:

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.7.5.dylib locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.5.dylib locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.7.5.dylib locally
Segmentation fault: 11

我的问题是,我需要做什么才能成功导入没有段错误的模块?如果有帮助,我在 python3 REPL here 中发布了运行该命令的dtruss 输出的要点,以及带有堆栈跟踪here 的诊断(崩溃)报告的要点。

【问题讨论】:

  • 你能得到如here描述的堆栈跟踪吗
  • 已编辑以包含该内容。
  • 你能看看这个解决方案是否有效吗? github.com/tensorflow/tensorflow/issues/…
  • 是的......似乎已经做到了。在此处添加答案,我会接受。非常感谢!

标签: python macos tensorflow


【解决方案1】:

此评论中描述了问题:https://github.com/tensorflow/tensorflow/issues/2940#issuecomment-238952433

“加载 libcuda.dylib 时存在错误 - 默认 cuda 安装会创建 libcuda.dylib,但 tensorflow 会尝试加载 libcuda.1.dylib 。这失败了,使用 LD_LIBRARY_PATH 如果 NULL 崩溃。如果你复制libcuda.dylib 到 libcuda.1.dylib 加载正常。”

使用拉取请求为其他所有人修复崩溃非常容易——即使用-c dbg 编译以准确查看哪一行正在尝试使用空值,并将类似的内容添加到代码中

if (mystring == NULL) { return; }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 2014-10-23
    • 2021-09-10
    • 2013-04-01
    • 2020-06-20
    相关资源
    最近更新 更多