Skip to content

Commit f1ad3e5

Browse files
authored
Remove /usr/local/cuda/compat from LD_LIBRARY_PATH (#1092)
* Remove /usr/local/cuda/compat from LD_LIBRARY_PATH http://b/203659565 * Add CUDA stubs to LD_LIBRARY_PATH to allow building on a CPU-only machine * Add symlink for libcuda.so
1 parent a4cc4b4 commit f1ad3e5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Dockerfile.tmpl

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ ENV CUDA_MAJOR_VERSION=11
1616
ENV CUDA_MINOR_VERSION=0
1717
# NVIDIA binaries from the host are mounted to /opt/bin.
1818
ENV PATH=/opt/bin:${PATH}
19+
# Add CUDA stubs to LD_LIBRARY_PATH to support building the GPU image on a CPU machine.
20+
ENV LD_LIBRARY_PATH_NO_STUBS="$LD_LIBRARY_PATH"
21+
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64/stubs"
22+
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1
1923
{{ else }}
2024
FROM ${BASE_IMAGE_REPO}/${CPU_BASE_IMAGE_NAME}:${BASE_IMAGE_TAG}
2125
{{ end }}
@@ -38,9 +42,6 @@ ADD clean-layer.sh /tmp/clean-layer.sh
3842
ADD patches/nbconvert-extensions.tpl /opt/kaggle/nbconvert-extensions.tpl
3943
ADD patches/template_conf.json /opt/kaggle/conf.json
4044

41-
# Adds the libcuda.so to LD_LIBRARY_PATH which is necessary for the GPU mxnet package.
42-
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/compat
43-
4445
{{ if eq .Accelerator "gpu" }}
4546
# b/200968891 Keeps horovod once torch is upgraded.
4647
RUN pip uninstall -y horovod && \
@@ -566,3 +567,6 @@ LABEL kaggle-lang=python
566567

567568
# Correlate current release with the git hash inside the kernel editor by running `!cat /etc/git_commit`.
568569
RUN echo "$GIT_COMMIT" > /etc/git_commit && echo "$BUILD_DATE" > /etc/build_date
570+
571+
# Remove the CUDA stubs.
572+
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH_NO_STUBS"

0 commit comments

Comments
 (0)