forked from Waterloo-Aquadrone/aquadrone-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileNvidia
103 lines (84 loc) · 3.99 KB
/
DockerfileNvidia
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Originally used by UW Robohub
# Copied with verbal permission from Alex Werner
ARG BASE_IMAGE
FROM $BASE_IMAGE
## TODO: This could be in a seperate Dockerfile
## ship every docker image with support for nvidia docker 2 to avoid having too many different images
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
RUN apt-get update && apt-get install -q -y --no-install-recommends \
libxau6 \
libxdmcp6 \
libxcb1 \
libxext6 \
libx11-6 && \
rm -rf /var/lib/apt/lists/*
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# below sourced from https://gitlab.com/nvidia/opengl/blob/ubuntu14.04/1.0-glvnd/runtime/Dockerfile
# TODO check for updates
RUN apt-get update && apt-get install -q -y --no-install-recommends \
git \
ca-certificates \
make \
automake \
autoconf \
libtool \
pkg-config \
python \
libxext-dev \
libx11-dev \
mesa-utils \
x11proto-gl-dev && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/libglvnd && cd /opt/libglvnd && \
git clone --branch=v1.0.0 https://github.com/NVIDIA/libglvnd.git . && \
./autogen.sh && \
./configure --prefix=/usr/local --libdir=/usr/local/lib/x86_64-linux-gnu && \
make -j"$(nproc)" install-strip && \
find /usr/local/lib/x86_64-linux-gnu -type f -name 'lib*.la' -delete
RUN apt-get update && apt-get install -q -y --no-install-recommends \
gcc-multilib \
libxext-dev \
libx11-dev && \
rm -rf /var/lib/apt/lists/*
#COPY --from=glvnd /usr/local/lib/x86_64-linux-gnu /usr/local/lib/x86_64-linux-gnu
#COPY --from=glvnd /usr/local/lib/i386-linux-gnu /usr/local/lib/i386-linux-gnu
COPY 10_nvidia.json /usr/local/share/glvnd/egl_vendor.d/10_nvidia.json
# TODO: This and below needs automatic detection of nvidia devices in the system
RUN echo '/usr/local/lib/x86_64-linux-gnu' >> /etc/ld.so.conf.d/glvnd.conf && \
echo '/usr/local/lib/i386-linux-gnu' >> /etc/ld.so.conf.d/glvnd.conf && \
ldconfig
ENV LD_LIBRARY_PATH /usr/local/lib/x86_64-linux-gnu:/usr/local/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# ==================
# below sourced from https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/8.0/runtime/Dockerfile
#RUN NV1=$(lsb_release -is | sed -e 's/\(.*\)/\L\1/'); echo $NV1
RUN export NV1=$(lsb_release -is | sed -e 's/\(.*\)/\L\1/') \
&& export NV2=$(lsb_release -rs | sed -e 's/\.//') && echo ${NV1}${NV2} \
&& apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/${NV1}${NV2}/x86_64/7fa2af80.pub && \
echo "deb http://developer.download.nvidia.com/compute/cuda/repos/${NV1}${NV2}/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \
echo "deb http://developer.download.nvidia.com/compute/machine-learning/repos/${NV1}${NV2}/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list
ENV CUDA_VERSION 8.0.61
ENV CUDA_PKG_VERSION 8-0=$CUDA_VERSION-1
RUN apt-get update && apt-get install -y --no-install-recommends \
cuda-nvrtc-$CUDA_PKG_VERSION \
cuda-nvgraph-$CUDA_PKG_VERSION \
cuda-cusolver-$CUDA_PKG_VERSION \
cuda-cublas-8-0=8.0.61.2-1 \
cuda-cufft-$CUDA_PKG_VERSION \
cuda-curand-$CUDA_PKG_VERSION \
cuda-cusparse-$CUDA_PKG_VERSION \
cuda-npp-$CUDA_PKG_VERSION \
cuda-cudart-$CUDA_PKG_VERSION && \
ln -s cuda-8.0 /usr/local/cuda && \
rm -rf /var/lib/apt/lists/*
# nvidia-docker 1.0 - remove after testing
#LABEL com.nvidia.volumes.needed="nvidia_driver"
#LABEL com.nvidia.cuda.version="${CUDA_VERSION}"
#
#RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
# echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
# put this in /etc/environment
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# nvidia-container-runtime
ENV NVIDIA_REQUIRE_CUDA "cuda>=8.0"