-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Dockerfile.openblas
122 lines (111 loc) · 3.69 KB
/
Dockerfile.openblas
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# FROM must be called before other ARGS except for ARG BASE_IMAGE
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
ARG CMAKE_VER
ARG CCACHE_TAR_NAME
RUN if [ -z "${CMAKE_VER}" ]; then echo "Error: ARG CMAKE_VER not specified."; exit 1; fi \
&& if [ -z "${CCACHE_TAR_NAME}" ]; then echo "Error: ARG CCACHE_TAR_NAME not specified."; exit 1; fi
# Non-interactive dpkg
ENV DEBIAN_FRONTEND=noninteractive
# Open3D dependencies
RUN apt-get update && apt-get install -y \
apt-utils \
autoconf \
build-essential \
ccache \
clang-7 \
git \
libblas-dev \
libc++-7-dev \
libc++abi-7-dev \
libglu1-mesa-dev \
liblapack-dev \
liblapacke-dev \
libosmesa6-dev \
libsdl2-dev \
libtbb-dev \
libtool \
libudev-dev \
libxi-dev \
ninja-build \
wget \
xorg-dev \
&& rm -rf /var/lib/apt/lists/*
# No virtual environment is needed, default to python 3.6
RUN apt-get update && apt-get install -y \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/local/bin/python \
&& ln -s /usr/bin/python3-config /usr/local/bin/python-config \
&& ln -s /usr/bin/pip3 /usr/local/bin/pip
# Python dependencies
RUN python -m pip install -U \
pip=="21.1.1" \
wheel=="0.35.1" \
setuptools=="50.3.2" \
yapf=="0.30.0" \
pytest=="6.0.1" \
scipy=="1.5.4"
# CMake
# PWD is /, camke will be installed to /root/${CMAKE_VER}/bin/cmake
RUN CMAKE_VER_NUMBERS=$(echo "${CMAKE_VER}" | cut -d"-" -f2) \
&& wget -q https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER_NUMBERS}/${CMAKE_VER}.tar.gz \
&& tar -xf ${CMAKE_VER}.tar.gz \
&& cp -ar ${CMAKE_VER} ${HOME}
ENV PATH=${HOME}/${CMAKE_VER}/bin:${PATH}
# Download ccache from GCS bucket
# If it doesn't exist on the cloud, an empty ${CCACHE_DIR} will be created.
# Example directory structure:
# - CCACHE_DIR = ~/.cache/ccache
# - CCACHE_DIR_NAME = ccache
# - CCACHE_DIR_PARENT = ~/.cache
RUN CCACHE_DIR=$(ccache -p | grep cache_dir | grep -oE "[^ ]+$") \
&& CCACHE_DIR_NAME=$(basename ${CCACHE_DIR}) \
&& CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \
&& mkdir -p ${CCACHE_DIR_PARENT} \
&& cd ${CCACHE_DIR_PARENT} \
&& (wget -q https://storage.googleapis.com/open3d-ci-cache/${CCACHE_TAR_NAME}.tar.gz || true) \
&& if [ -f ${CCACHE_TAR_NAME}.tar.gz ]; then tar -xf ${CCACHE_TAR_NAME}.tar.gz; fi \
&& mkdir -p ${CCACHE_DIR}
# We need to set ccache size explicitly with -M, otherwise the defualt size is
# *not* determined by ccache's default, but the downloaded ccache file's config.
RUN ccache -M 5G \
&& ccache -s
# Open3D repo
# Always keep /root/Open3D as the WORKDIR
COPY . /root/Open3D
WORKDIR /root/Open3D
# `docker build` will build Open3D. The unit tests will be executed later in
# during `docker run`
WORKDIR /root/Open3D
RUN mkdir build \
&& cd build \
&& cmake \
-DUSE_BLAS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_GUI=ON \
-DBUILD_WEBRTC=OFF \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DBUILD_FILAMENT_FROM_SOURCE=ON \
-DGLIBCXX_USE_CXX11_ABI=ON \
-DBUILD_TENSORFLOW_OPS=OFF \
-DBUILD_PYTORCH_OPS=OFF \
-DBUILD_UNIT_TESTS=ON \
-DCMAKE_INSTALL_PREFIX=~/open3d_install \
.. \
&& make -j$(nproc) \
&& make install-pip-package -j$(nproc) \
&& make install -j$(nproc)
# Compress ccache folder, move to / directory (optional)
RUN ccache -s \
&& CCACHE_DIR=$(ccache -p | grep cache_dir | grep -oE "[^ ]+$") \
&& CCACHE_DIR_NAME=$(basename ${CCACHE_DIR}) \
&& CCACHE_DIR_PARENT=$(dirname ${CCACHE_DIR}) \
&& cd ${CCACHE_DIR_PARENT} \
&& tar -czf ${CCACHE_TAR_NAME}.tar.gz ${CCACHE_DIR_NAME} \
&& mv ${CCACHE_TAR_NAME}.tar.gz /