-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
267 lines (228 loc) · 8.06 KB
/
Dockerfile
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
ARG DEBIAN_FRONTEND="noninteractive"
ARG INSTALLATION_PREFIX=/opt/bsc
ARG RELEASE_TAG
FROM ubuntu:22.04 AS base
ARG INSTALLATION_PREFIX
ARG RELEASE_TAG
LABEL AUTHOR="Programming Models Group at BSC <ompss-fpga-support@bsc.es> (https://pm.bsc.es/ompss-at-fpga)"
RUN apt-get update && apt-get install -y \
# llvm
cmake \
clang-12 \
clang++-12 \
lld-12 \
ninja-build \
# Common
autoconf \
automake \
build-essential \
ca-certificates \
curl \
gperf \
git \
libboost-all-dev \
libiberty-dev \
libltdl-dev \
libsqlite3-dev \
libtool \
pkg-config \
sudo \
vim \
wget \
# AIT
python3 \
python3-pip \
# Needed by Xilinx tools
libgtk2.0-0 \
libncurses5 \
libx11-6 \
libxext6 \
libxrender1 \
libxtst6 \
procps \
# Needed by Petalinux tools
bc \
chrpath \
cpio \
diffstat \
gawk \
gnupg \
gnupg-agent \
libncurses5-dev \
libtool-bin \
locales \
lsb-release \
net-tools \
rsync \
socat \
texinfo \
unzip \
xterm \
zlib1g-dev \
# Extra tools
openssh-client
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 80 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 80 \
&& update-alternatives --install /usr/bin/lld lld /usr/bin/lld-12 80 \
&& python3 -m pip install pip --upgrade \
&& python3 -m pip install wheel --upgrade \
&& python3 -m pip install setuptools --upgrade \
&& export DEBIAN_FRONTEND=noninteractive \
&& export DEBCONF_NONINTERACTIVE_SEEN=true \
&& echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections \
&& echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections \
&& apt-get install --no-install-recommends tzdata
#if is arm64
RUN if [ \"`arch`\" = \"aarch64\" ] || [ \"`arch`\" = \"arm64\" ] ; then \
dpkg --add-architecture amd64 && apt-get update && apt-get install -y \
crossbuild-essential-amd64 \
gfortran-x86-64-linux-gnu \
g++-multilib-x86-64-linux-gnu \
gcc-multilib-x86-64-linux-gnu ; \
elif [ \"`arch`\" = \"x86_64\" ]; then \
apt-get install -y \
crossbuild-essential-arm64 \
gfortran-aarch64-linux-gnu; \
else \
false; \
fi;
#arm32
#RUN apt-get update \
# && apt-get install -y -q \
# crossbuild-essential-armhf \
# gfortran-arm-linux-gnueabihf
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
FROM base as build
ARG INSTALLATION_PREFIX
ARG RELEASE_TAG
## Install dependencies
#LIBNUMA
WORKDIR /tmp/work/
ARG numactl_ver=2.0.18
RUN wget "https://github.com/numactl/numactl/releases/download/v${numactl_ver}/numactl-${numactl_ver}.tar.gz" \
&& tar -zxf numactl-${numactl_ver}.tar.gz \
&& rm numactl-${numactl_ver}.tar.gz
WORKDIR /tmp/work/numactl-${numactl_ver}
RUN autoreconf -ifv
#ARM64
RUN ./configure --prefix=$INSTALLATION_PREFIX/arm64/libnuma --host=aarch64-linux-gnu \
&& make install \
&& make distclean
#ARM32
#RUN ./configure --prefix=$INSTALLATION_PREFIX/arm32/libnuma --host=arm-linux-gnueabihf \
# && make install \
# && make distclean
#X86_64
RUN ./configure --prefix=$INSTALLATION_PREFIX/x86_64/libnuma --host=x86_64-linux-gnu \
&& make install \
&& make distclean
#HWLOC
WORKDIR /tmp/work/
ARG hwloc_ver=2.9.3
RUN wget "https://download.open-mpi.org/release/hwloc/v2.9/hwloc-${hwloc_ver}.tar.gz" \
&& tar -zxf hwloc-${hwloc_ver}.tar.gz \
&& rm hwloc-${hwloc_ver}.tar.gz
WORKDIR /tmp/work/hwloc-${hwloc_ver}
RUN autoreconf -ifv
#ARM64
RUN ./configure --prefix=$INSTALLATION_PREFIX/arm64/hwloc --host=aarch64-linux-gnu \
&& make install \
&& make distclean
#ARM32
#RUN ./configure --prefix=$INSTALLATION_PREFIX/arm32/hwloc --host=arm-linux-gnueabihf \
# && make install \
# && make distclean
#X86_64
RUN ./configure --prefix=$INSTALLATION_PREFIX/x86_64/hwloc --host=x86_64-linux-gnu \
&& make install \
&& make distclean
##PARAVER
##ONLY COMPILE FOR LOCAL MACHINE
#
#WORKDIR /tmp/work/
#
#RUN git clone https://github.com/bsc-performance-tools/paraver-kernel
#
#WORKDIR /tmp/work/paraver-kernel
#RUN ./bootstrap \
# && ./configure --with-boost-libdir=/usr/lib/$(gcc -dumpmachine) --prefix=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/paraver \
# && make -j`nproc` \
# && make install
#
#WORKDIR /tmp/work
#RUN apt-get install -y libwxgtk3.0-gtk3-dev libssl-dev
#RUN git clone https://github.com/bsc-performance-tools/wxparaver
#
#WORKDIR /tmp/work/wxparaver
#RUN ./bootstrap \
# && ./configure --with-boost-libdir=/usr/lib/$(gcc -dumpmachine) --prefix=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/paraver \
# && make -j`nproc` \
# && make install
WORKDIR /tmp/work/
ADD Makefile ./
ADD ait ./ait
ADD llvm ./llvm
ADD nanos6-fpga ./nanos6-fpga
ADD ompss-at-fpga-kernel-module ./ompss-at-fpga-kernel-module
ADD xdma ./xdma
ADD xtasks ./xtasks
ENV CFLAGS=
ENV CXXFLAGS=
ENV LDFLAGS=
#INSTALL TOOLCHAIN
WORKDIR /tmp/work
#X86_64
RUN make \
TARGET=$(test $(arch) != x86_64 && echo x86_64-linux-gnu) \
PREFIX_TARGET=$INSTALLATION_PREFIX/x86_64/ompss-2/${RELEASE_TAG} \
PREFIX_HOST=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss-2/${RELEASE_TAG} \
PLATFORM=qdma \
all \
&& make mrproper
#ARM64
RUN make \
TARGET=$(test $(arch) != aarch64 && echo aarch64-linux-gnu) \
PREFIX_TARGET=$INSTALLATION_PREFIX/arm64/ompss-2/${RELEASE_TAG} \
PREFIX_HOST=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss-2/${RELEASE_TAG} \
NANOS6_CONFIG_FLAGS="--with-libnuma=$INSTALLATION_PREFIX/arm64/libnuma --with-symbol-resolution=indirect" \
hwloc_CFLAGS="-I$INSTALLATION_PREFIX/arm64/hwloc/include" \
hwloc_LIBS="-L$INSTALLATION_PREFIX/arm64/hwloc/lib -lhwloc" \
PLATFORM=zynq \
all \
&& make mrproper
##ARM32
##Assuming no one will compile from an arm32 platform => always setting TARGET
#RUN make \
# TARGET=arm-linux-gnueabihf \
# PREFIX_TARGET=$INSTALLATION_PREFIX/arm32/ompss-2/${RELEASE_TAG} \
# PREFIX_HOST=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss-2/${RELEASE_TAG} \
# NANOS6_CONFIG_FLAGS="--with-libnuma=$INSTALLATION_PREFIX/arm32/libnuma --with-symbol-resolution=indirect" \
# hwloc_CFLAGS="-I$INSTALLATION_PREFIX/arm32/hwloc/include" \
# hwloc_LIBS="-L$INSTALLATION_PREFIX/arm32/hwloc/lib -lhwloc" \
# PLATFORM=zynq \
# all \
# && make mrproper
FROM build AS dist_img
ARG INSTALLATION_PREFIX
ARG RELEASE_TAG
ARG INSTALLATION_PREFIX
COPY --from=build $INSTALLATION_PREFIX $INSTALLATION_PREFIX
LABEL AUTHOR="Programming Models Group at BSC <ompss-fpga-support@bsc.es> (https://pm.bsc.es/ompss-at-fpga)"
RUN adduser --disabled-password --gecos '' ompss \
&& adduser ompss sudo \
&& echo 'ompss:ompss' | chpasswd
ADD ./dockerImageFiles/welcome_ompss_fpga.txt $INSTALLATION_PREFIX
WORKDIR /home/ompss/
USER ompss
ADD --chmod=0775 --chown=ompss:ompss ./dockerImageFiles/example ./example/
RUN echo "cat $INSTALLATION_PREFIX/welcome_ompss_fpga.txt" >>.bashrc \
&& echo "export PATH=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss-2/${RELEASE_TAG}/llvm/bin:\$PATH" >>.bashrc \
&& echo "export PATH=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss-2/${RELEASE_TAG}/ait/bin:\$PATH" >>.bashrc \
&& echo "export PYTHONPATH=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss-2/${RELEASE_TAG}/ait" >>.bashrc
# && echo "export PATH=$INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/wxparaver/bin:\$PATH" >>.bashrc \
# && ln -s $INSTALLATION_PREFIX/$(arch | sed 's/aarch64/arm64/g' | sed 's/armhf/arm32/g')/ompss/${RELEASE_TAG}/nanos6-fpga/share/doc/nanox/paraver_configs/ompss ./example/paraver_configs
CMD ["bash"]