Dair
Dair

Reputation: 16240

Segmentation fault running tensorflow-gpu

If I do:

➜  ~ 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;"

(note: this is all the output I get)

Currently I have installed tensorflow-gpu using pip3 install tesnorflow-gpu. I have followed advice here to prevent segmentation faults by putting the following in my .zshrc file.

# 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

Lastly, I have disable SIP. None of this seems to work though. Any thoughts on how to make it run?

Upvotes: 1

Views: 1458

Answers (1)

Dair
Dair

Reputation: 16240

So I looked at yaroslavvb comment here and changed my .zshrc file to this:

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

Got rid of the link (I still have SIP disabled, maybe I should set it back?)

This gives:

➜  ~ 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

I then realized I still needed to install cudnn which I did by downloading it from Nvidia and following here.

This then gave:

➜  ~ python3 -c "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:135] successfully opened CUDA library libcudnn.5.dylib locally
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

Upvotes: 4

Related Questions