python导入

时间:2016-08-12 18:44:30

标签: python macos tensorflow

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

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

我已经安装了CUDA并识别了我的GPU。我可以在deviceQuery中成功编译/Developer/NVIDIA/CUDA-7.5/samples/1_Utilities/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输出的要点,以及使用stacktrace here的诊断(崩溃)报告的要点。 / p>

1 个答案:

答案 0 :(得分:3)

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

&#34;加载libcuda.dylib有一个错误 - 默认的cuda install会创建libcuda.dylib,但tensorflow会尝试加载libcuda.1.dylib。这失败了,使用LD_LIBRARY_PATH,如果NULL崩溃。如果将libcuda.dylib复制到libcuda.1.dylib,则加载正常。&#34;

使用pull请求为其他所有人修复崩溃非常容易 - 即使用<script type="text/javascript"> $(function() { $("#myTable").tablesorter(); }); </script> <table id="myTable" class="tablesorter"> <thead> <tr> <th>Subscription Product Name</th> <th>Type</th> <th>Has Fees</th> </tr> </thead> <tbody> @foreach (var categories in Model.Categories) { foreach (product p in categories) { <tr> <td> @p.name </td> <td> @p.type </td> <td> @DisplayThumbsUpDown(p.hasfees) </td> </tr> } } </tbody> </table> @helper DisplayThumbsUpDown(HasFees fees) { switch (fees) { case HasFees.Yes: <img src="/lib/images/thumbs-up.png">break; case HasFees.No: <img src="/lib/images/thumbs-down.png">break; default: <span>&mdash;</span>break; } }进行编译以确切地查看哪一行尝试使用null值,并将类似的内容添加到代码中

-c dbg