Skip to content

Commit 570a35a

Browse files
committed
Set LD_LIBRARY_PATH environment for the whole container,
as opposed to just the compile line. This allows binaries (e.g. ModelServer) to run on shell in subsequent commands. Set --crosstool_top globally for all "cuda" compiles. Cherry pick from: #980 PiperOrigin-RevId: 203524449
1 parent 8d86143 commit 570a35a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

tensorflow_serving/tools/docker/Dockerfile.devel-gpu

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,21 @@ RUN mkdir -p ${NCCL_INSTALL_PATH} && \
109109
ln -s /usr/lib/x86_64-linux-gnu/libnccl.so.2 ${NCCL_INSTALL_PATH}lib/libnccl.so.2 && \
110110
ln -s /usr/lib/x86_64-linux-gnu/libnccl.so.$TF_NCCL_VERSION ${NCCL_INSTALL_PATH}lib/libnccl.so.$TF_NCCL_VERSION
111111

112+
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1
113+
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH}
114+
112115
# Download TF Serving sources (optionally at specific commit).
113116
WORKDIR /tensorflow-serving
114117
RUN git clone --depth=1 --branch=${TF_SERVING_VERSION_GIT_BRANCH} https://github.com/tensorflow/serving .
115118
RUN if [ "${TF_SERVING_VERSION_GIT_COMMIT}" != "head" ]; then git checkout ${TF_SERVING_VERSION_GIT_COMMIT} ; fi
116119

117120
# Build, and install TensorFlow Serving
118121
ARG TF_SERVING_BUILD_OPTIONS="--copt=-mavx --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0 --verbose_failures"
119-
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
120-
LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH} \
121-
bazel build -c opt --color=yes --curses=yes --config=cuda \
122+
RUN bazel build -c opt --color=yes --curses=yes --config=cuda \
122123
--output_filter=DONT_MATCH_ANYTHING \
123-
--crosstool_top=@local_config_cuda//crosstool:toolchain \
124124
${TF_SERVING_BUILD_OPTIONS} \
125125
tensorflow_serving/model_servers:tensorflow_model_server && \
126126
cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server /usr/local/bin/ && \
127-
rm /usr/local/cuda/lib64/stubs/libcuda.so.1 && \
128127
bazel clean --expunge --color=yes
129128
# Clean up Bazel cache when done.
130129

tools/bazel.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
build:cuda --crosstool_top=@org_tensorflow//third_party/gpus/crosstool
1+
build:cuda --crosstool_top=@local_config_cuda//crosstool:toolchain
22
build:cuda --define=using_cuda=true --define=using_cuda_nvcc=true
33

44
build --action_env PYTHON_BIN_PATH="/usr/bin/python"

0 commit comments

Comments
 (0)