Skip to content

Instantly share code, notes, and snippets.

@revilokeb
Last active March 14, 2018 23:57
Show Gist options
  • Save revilokeb/58f3419340652bbe73ab07903fdc9426 to your computer and use it in GitHub Desktop.
Save revilokeb/58f3419340652bbe73ab07903fdc9426 to your computer and use it in GitHub Desktop.
Setting up Tensorflow Serving with CUDA 7.5 / cuDNN5 on Docker - error "missing dependency ... eigen3/Eigen/Core..."
# Create docker image with TF serving on GPU
# Ubuntu 14.04 LTS with nvidia-docker (https://github.com/NVIDIA/nvidia-docker)
# docker: docker bash
# host: bash on host machine
#host, pull nvidia-docker latest
nvidia-docker pull nvidia/cuda
#docker, start docker bash
nvidia-docker run --rm -ti -v /myhosthome:/mydockerhome nvidia/cuda:latest bash
#docker, install CUDA samples to check CUDA install, not strictly necessary, https://devblogs.nvidia.com/parallelforall/nvidia-docker-gpu-server-application-deployment-made-easy/
apt-get update && apt-get install -y --no-install-recommends \
cuda-samples-$CUDA_PKG_VERSION
rm -rf /var/lib/apt/lists/*
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
make
#docker, check GPUs
./deviceQuery
nvidia-smi
#docker, to prepare for TF serving GPU, https://tensorflow.github.io/serving/setup
sudo apt-get update && sudo apt-get install -y \
build-essential \
curl \
git \
libfreetype6-dev \
libpng12-dev \
libzmq3-dev \
pkg-config \
python-dev \
python-numpy \
python-pip \
software-properties-common \
swig \
zip \
zlib1g-dev \
nano
#host, download cudnn5 to host machine /myhosthome/cudnn5_download
#docker
cp /myhosthome/cudnn5_download/include/cudnn.h /usr/local/cuda/include/
cp /myhosthome/cudnn5_download/lib64/* /usr/local/cuda/lib64/
#docker, install bazel, first install Oracle JDK 8 (http://www.bazel.io/docs/install.html#install-on-ubuntu)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
echo "deb http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install bazel
sudo apt-get upgrade bazel
#docker, install TF serving (https://tensorflow.github.io/serving/setup)
git clone --recurse-submodules https://github.com/tensorflow/serving
#docker, modify CROSSTOOLS as in https://github.com/tensorflow/serving/issues/17, i.e. adding the line cxx_builtin_include_directory: "/usr/local/cuda-7.5/targets/x86_64-linux/include" to tensorflow/third_party/gpus/crosstool/CROSSTOOL
# without this modification I am getting the error as described in https://github.com/tensorflow/tensorflow/issues/1157
cd serving
cd tensorflow
./configure
cd ..
#docker, build TF serving
bazel build -c opt --config=cuda tensorflow_serving/...
#host, commit container
nvidia-docker commit XXXXXXXXXXXXXX tf_serving_cuda7.5_cudnn5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment