Skip to content

Commit c5695f9

Browse files
authored
[Dockerfile] Add docker images based ubuntu22.04 with cuda11.7 and fix build failure with GCC11.2. (#451)
1 parent cbca951 commit c5695f9

File tree

6 files changed

+161
-5
lines changed

6 files changed

+161
-5
lines changed

cibuild/dockerfiles/Dockerfile.base-py3.6-cu112-ubuntu18.04

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ RUN apt-get update && \
2020
RUN pip install astor==0.8.1
2121
RUN pip install numpy==1.16.6
2222
RUN pip install protobuf==3.17.3
23-
RUN pip --no-deps keras-preprocessing==1.0.5
23+
RUN pip install --no-deps keras-preprocessing==1.0.5
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --allow-unauthenticated \
5+
build-essential \
6+
libcurl3-dev \
7+
libfreetype6-dev \
8+
libhdf5-serial-dev \
9+
libzmq3-dev \
10+
pkg-config \
11+
rsync \
12+
software-properties-common \
13+
sudo \
14+
zlib1g \
15+
unzip \
16+
zip \
17+
zlib1g-dev \
18+
wget \
19+
cmake \
20+
git \
21+
curl \
22+
libssl-dev \
23+
libcurl4-openssl-dev \
24+
openjdk-8-jre-headless \
25+
autoconf \
26+
automake \
27+
libtool \
28+
libffi-dev \
29+
&& apt-get clean && \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
#install python
33+
WORKDIR /home/workdir
34+
RUN wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz \
35+
&& tar -xzvf Python-3.8.6.tgz \
36+
&& cd Python-3.8.6 \
37+
&& ./configure --prefix=/usr/local/python3 --enable-optimizations \
38+
&& make -j96 \
39+
&& make install
40+
RUN rm -f /usr/bin/python \
41+
&& rm -f /usr/bin/pip \
42+
&& ln -s /usr/local/python3/bin/python3.8 /usr/bin/python \
43+
&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip \
44+
&& rm -rf /home/workdir
45+
46+
RUN python -m pip --no-cache-dir install --upgrade \
47+
"pip<20.3" \
48+
setuptools==52.0.0
49+
50+
RUN pip install wheel==0.37.1
51+
52+
RUN pip install \
53+
astor==0.8.1 \
54+
numpy==1.16.6 && \
55+
protobuf==3.17.3 && \
56+
pip install --no-deps \
57+
keras-preprocessing==1.0.5
58+
59+
# install bazel
60+
WORKDIR /home/workdir
61+
62+
ARG BAZEL_VERSION=0.26.1
63+
64+
RUN wget -O /home/workdir/installer.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh \
65+
&& wget -O /home/workdir/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" \
66+
&& chmod +x /home/workdir/installer.sh \
67+
&& /home/workdir/installer.sh \
68+
&& rm -rf /home/workdir
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
ARG UBUNTU_VERSION=22.04
2+
3+
FROM ubuntu:${UBUNTU_VERSION} AS base
4+
5+
ENV PATH /root/bin:$PATH
6+
7+
RUN apt-get update && apt-get install -y --no-install-recommends \
8+
build-essential \
9+
libcurl3-dev \
10+
libfreetype6-dev \
11+
libhdf5-serial-dev \
12+
libzmq3-dev \
13+
pkg-config \
14+
rsync \
15+
software-properties-common \
16+
sudo \
17+
zlib1g \
18+
unzip \
19+
zip \
20+
zlib1g-dev \
21+
wget \
22+
git \
23+
openjdk-8-jre-headless \
24+
autoconf \
25+
automake \
26+
libtool \
27+
libffi-dev \
28+
&& apt-get clean \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
#install python
32+
WORKDIR /home/workdir
33+
RUN wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz \
34+
&& tar -xzvf Python-3.8.6.tgz \
35+
&& cd Python-3.8.6 \
36+
&& ./configure --prefix=/usr/local/python3 --enable-optimizations \
37+
&& make -j96 \
38+
&& make install
39+
RUN rm -f /usr/bin/python \
40+
&& rm -f /usr/bin/pip \
41+
&& ln -s /usr/local/python3/bin/python3.8 /usr/bin/python \
42+
&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip \
43+
&& rm -rf /home/workdir
44+
45+
RUN python -m pip --no-cache-dir install --upgrade \
46+
"pip<20.3" \
47+
setuptools==52.0.0
48+
49+
RUN pip install wheel==0.37.1
50+
51+
RUN pip install astor==0.8.1
52+
RUN pip install numpy==1.16.6
53+
RUN pip install protobuf==3.17.3
54+
RUN pip install --no-deps keras-preprocessing==1.0.5
55+
56+
# install bazel
57+
WORKDIR /home/workdir
58+
59+
ARG BAZEL_VERSION=0.26.1
60+
61+
RUN wget -O /home/workdir/installer.sh https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh \
62+
&& wget -O /home/workdir/LICENSE.txt "https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE" \
63+
&& chmod +x /home/workdir/installer.sh \
64+
&& /home/workdir/installer.sh \
65+
&& rm -rf /home/workdir

docs/DeepRec-Compile-And-Install.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
**CPU Base Docker Image**
66

7-
```
8-
alideeprec/deeprec-base:deeprec-base-cpu-py36-ubuntu18.04
9-
```
7+
| GCC Version | Python Version | IMAGE |
8+
| 7.5.0 | 3.6.9 | alideeprec/deeprec-base:deeprec-base-cpu-py36-ubuntu18.04 |
9+
| 11.2.0 | 3.8.6 | alideeprec/deeprec-base:deeprec-base-cpu-py38-ubuntu22.04 |
10+
1011

1112
**GPU Base Docker Image**
1213

third_party/hwloc/hwloc_fix.patch

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/hwloc/topology.c b/hwloc/topology.c
2+
index 6e51aa4..f2e6ac4 100644
3+
--- a/hwloc/topology.c
4+
+++ b/hwloc/topology.c
5+
@@ -41,9 +41,11 @@
6+
#include <sys/param.h>
7+
#endif
8+
9+
+#if defined(__GNUC__) && (__GNUC__ <= 10)
10+
#ifdef HAVE_SYS_SYSCTL_H
11+
#include <sys/sysctl.h>
12+
#endif
13+
+#endif
14+
15+
#ifdef HWLOC_WIN_SYS
16+
#include <windows.h>

third_party/hwloc/workspace.bzl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
load("//third_party:repo.bzl", "third_party_http_archive")
44

5+
# Sanitize a dependency so that it works correctly from code that includes
6+
# TensorFlow as a submodule.
7+
def clean_dep(dep):
8+
return str(Label(dep))
9+
510
def repo():
611
third_party_http_archive(
712
name = "hwloc",
@@ -11,6 +16,7 @@ def repo():
1116
],
1217
sha256 = "64def246aaa5b3a6e411ce10932a22e2146c3031b735c8f94739534f06ad071c",
1318
strip_prefix = "hwloc-2.0.3",
14-
build_file = "//third_party/hwloc:BUILD.bazel",
19+
patch_file = clean_dep("//third_party/hwloc:hwloc_fix.patch"),
20+
build_file = clean_dep("//third_party/hwloc:BUILD.bazel"),
1521
system_build_file = "//third_party/hwloc:BUILD.system",
1622
)

0 commit comments

Comments
 (0)