分段故障运行tensorflow-gpu

时间:2017-02-21 19:59:01

标签: python tensorflow

如果我这样做:

➜  ~ python3 -c "import tensorflow;"
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.8.0.dylib locally
[1]    625 segmentation fault  python3 -c "import tensorflow;"

(注意:这是所有我得到的输出)

目前我使用tensorflow-gpu安装了pip3 install tesnorflow-gpu。我已按照建议here通过将以下内容放入.zshrc文件来防止出现细分错误。

# CUDA
export PATH=/Developer/NVIDIA/CUDA-8.0/bin:$PATH
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-8.0/lib:$DYLD_LIBRARY_PATH

# Fixes bug in tensorflow 
sudo ln -sf /usr/local/cuda/lib/libcuda.dylib /usr/local/cuda/lib/libcuda.1.dylib

最后,我已禁用SIP。但这似乎都不起作用。关于如何让它运行的任何想法?

1 个答案:

答案 0 :(得分:4)

所以我查看了yaroslavvb评论here并将我的{-# SPECIALIZE mean :: [Double] -> Double #-} mean :: Fractional a => [a] -> a mean xs = s / n where (s , n) = foldl' k (0,0) xs k (s, n) x = s `seq` n `seq` (s + x, n + 1) 文件更改为:

.zshrc

摆脱了链接(我仍然禁用SIP,也许我应该将其设置回来?)

这给出了:

export CUDA_HOME=/usr/local/cuda
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib
export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
export PATH=$DYLD_LIBRARY_PATH:$PATH

然后我意识到我仍然需要安装➜ ~ python3 -c "import numpy; import tensorflow;" I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.8.0.dylib locally I tensorflow/stream_executor/dso_loader.cc:126] Couldn't open CUDA library libcudnn.5.dylib. LD_LIBRARY_PATH: /usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib I tensorflow/stream_executor/cuda/cuda_dnn.cc:3517] Unable to load cuDNN DSO I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.8.0.dylib locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.1.dylib locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.8.0.dylib locally 我从Nvidia下载following here.

然后给出了:

cudnn