-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
227 lines (194 loc) · 8.23 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
# syntax = docker/dockerfile:1.0-experimental
# Stage #1: build all executables
FROM ubuntu:jammy
SHELL ["/bin/bash", "-c"]
RUN apt-get update
RUN mkdir toolsrc
RUN mkdir /opt/cad
WORKDIR /toolsrc
RUN apt-get -y install wget make gcc g++
RUN wget https://download.open-mpi.org/release/hwloc/v2.8/hwloc-2.8.0.tar.gz
RUN tar -xzvf hwloc-2.8.0.tar.gz
WORKDIR hwloc-2.8.0
RUN ./configure
RUN make
RUN make install
# Xyce and Trilinos takes the longest to execute, in the interest of caching, this should go first.
# install Trilinos
WORKDIR /toolsrc
# basic dependencies
RUN apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get install -y \
sudo wget gcc g++ gfortran make bison flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool \
autoconf automake git \
libhwloc15 libopenmpi-dev openmpi-bin openmpi-common \
python3 python3-pip libpython3-all-dev
RUN wget https://github.com/Kitware/CMake/releases/download/v3.29.6/cmake-3.29.6-linux-x86_64.sh
RUN bash cmake-3.29.6-linux-x86_64.sh --prefix=/usr/local --exclude-subdir --skip-license
RUN git clone --depth=1 https://github.com/trilinos/Trilinos.git --branch trilinos-release-15-1-1
RUN git clone --depth=1 https://github.com/Xyce/Xyce.git --branch Release-7.8.0
WORKDIR Trilinos
RUN mkdir build
RUN mkdir /opt/trilinos
WORKDIR build
RUN cmake \
-D PYTHON_EXECUTABLE=/usr/bin/python3 \
-D CMAKE_C_COMPILER=mpicc \
-D CMAKE_CXX_COMPILER=mpic++ \
-D CMAKE_Fortran_COMPILER=mpif77 \
-D CMAKE_INSTALL_PREFIX="/opt/trilinos" \
-D TPL_AMD_INCLUDE_DIRS="/usr/include/suitesparse" \
-D AMD_LIBRARY_DIRS="/usr/lib" \
-D MPI_BASE_DIR="/usr" \
-C /toolsrc/Xyce/cmake/trilinos/trilinos-MPI-base.cmake \
/toolsrc/Trilinos
RUN cmake --build . -j 40 -t install
# install Xyce
WORKDIR /toolsrc
WORKDIR Xyce
RUN mkdir build
WORKDIR build
RUN cmake \
-D CMAKE_INSTALL_PREFIX=/opt/cad \
-D Trilinos_ROOT=/opt/trilinos \
/toolsrc/Xyce
RUN cmake --build . -j 16 -t install
RUN make xycecinterface
RUN make install
# install OpenRoad
WORKDIR /toolsrc
RUN git clone --recursive https://www.github.com/The-OpenROAD-Project/OpenROAD-flow-scripts.git
WORKDIR OpenROAD-flow-scripts
RUN SUDO_USER="root" ./setup.sh
RUN ./build_openroad.sh --local --install-path /opt/openroad --nice
RUN mv dependencies /opt/or-tools
# install ACT
WORKDIR /toolsrc
RUN apt-get install -y libedit-dev zlib1g-dev m4 git gcc g++ make libboost-all-dev
RUN git clone --recursive https://www.github.com/asyncvlsi/actflow.git
WORKDIR actflow
ENV ACT_HOME=/opt/cad
ENV VLSI_TOOLS_SRC=/toolsrc/actflow
WORKDIR actsim
RUN ./grab_xyce.sh /toolsrc/Xyce/build
RUN sed -i 's/make/make CXX=mpic++ CC=mpicc CC_COMPILER=mpicc CXX_COMPILER=mpic++ C_COMPILER_NAME=mpicc CXX_COMPILER_NAME=mpic++/g' build.sh
WORKDIR /toolsrc/actflow
RUN echo "g++" > CXX_COMPILER
RUN CXX="g++" CC="gcc" CXX_COMPILER="g++" CC_COMPILER="gcc" ./build
# install ACT-06
RUN apt-get install -y libedit-dev zlib1g-dev m4 git gcc g++ make
WORKDIR /toolsrc
RUN --mount=type=secret,id=user --mount=type=secret,id=token git clone https://$(cat /run/secrets/user):$(cat /run/secrets/token)@git.broccolimicro.io/Broccoli/act-06.git --branch v1.0.1
WORKDIR act-06/prsim
RUN ./grab_xyce.sh /toolsrc/Xyce/build
WORKDIR ..
RUN XYCE_INSTALL="/opt/cad" ENABLE_MPI=1 make
RUN cp prsim/prsim chan.py measure.py sim2vcd.py tlint/tlint spi2act/spi2act.py v2act/v2act /opt/cad/bin
# install graphviz DOT
RUN apt-get install -y graphviz
# install Haystack
RUN echo "Haystack"
WORKDIR /toolsrc
RUN git clone --recursive https://github.com/broccolimicro/haystack.git --branch v0.2.2
WORKDIR haystack
WORKDIR lib
RUN make
WORKDIR ../bin
RUN make
RUN cp hsesim/hsesim /opt/cad/bin
RUN cp hseenc/hseenc /opt/cad/bin
RUN cp hseplot/plot /opt/cad/bin
RUN cp bubble/bubble /opt/cad/bin
RUN cp prsim/prsim /opt/cad/bin/prsimh # don't overwrite act's prsim
RUN cp gated/gated /opt/cad/bin
RUN cp prsize/prsize /opt/cad/bin
# install go
WORKDIR /toolsrc
RUN apt-get -y install wget
RUN /usr/bin/wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
RUN tar -C /opt -xzf go1.19.1.linux-amd64.tar.gz
RUN GOPATH=/opt/go /opt/go/bin/go install golang.org/x/tools/gopls@latest
RUN GOPATH=/opt/go /opt/go/bin/go install golang.org/x/lint/golint@latest
# install gaw
RUN apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get install -y libgtk-3-dev libcanberra-gtk3-module
WORKDIR /toolsrc
RUN git clone https://git.broccolimicro.io/Broccoli/waveview.git --branch v1.0.0
WORKDIR waveview
RUN ./configure --prefix=/opt/cad
RUN make
RUN make install
# install gtkwave
RUN apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get install -y gtkwave
# install prspice
WORKDIR /toolsrc
RUN git clone https://github.com/nbingham1/prspice.git --branch v0.0.2
WORKDIR prspice
RUN make
RUN cp prdbase prspice /opt/cad/bin
# install pr
WORKDIR /toolsrc
RUN git clone https://github.com/broccolimicro/pr.git --branch v0.0.6
RUN cp pr/pr pr/scripts/* /opt/cad/bin
# install magic layout tool
WORKDIR /toolsrc
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tcsh m4 csh libx11-dev tcl-dev tk-dev libcairo2-dev mesa-common-dev libglu1-mesa-dev libncurses-dev
RUN git clone https://www.github.com/RTimothyEdwards/magic.git
WORKDIR magic
RUN ./configure --prefix=/opt/magic
RUN make
RUN make install
ADD share/* /opt/cad/share
# install floret
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y libqhull-dev zlib1g-dev
WORKDIR /toolsrc
RUN git clone --recursive https://github.com/broccolimicro/floret.git --branch v1.1.2
WORKDIR floret
RUN make
RUN cp floret-linux /opt/cad/bin/floret
# Stage 2: Copy everything over to final image
FROM ubuntu:jammy
SHELL ["/bin/bash", "-c"]
RUN mkdir toolsrc
RUN apt-get update --fix-missing; DEBIAN_FRONTEND=noninteractive apt-get -y install wget make gcc g++ gfortran make cmake autoconf automake git libhwloc15 libopenmpi-dev openmpi-bin openmpi-common python3 python3-pip bison libgtk-3-dev libcanberra-gtk3-module gtkwave tcsh m4 csh libx11-dev tcl-dev tk-dev libcairo2-dev mesa-common-dev libglu1-mesa-dev libncurses-dev libedit-dev zlib1g-dev m4 git gcc g++ make libboost-all-dev graphviz sudo vim flex libfl-dev libfftw3-dev libsuitesparse-dev libblas-dev liblapack-dev libtool; apt-get update --fix-missing
WORKDIR /toolsrc
COPY --from=0 /toolsrc/OpenROAD-flow-scripts/etc/DependencyInstaller.sh /toolsrc/etc/DependencyInstaller.sh
COPY --from=0 /toolsrc/OpenROAD-flow-scripts/tools/OpenROAD/etc/DependencyInstaller.sh /toolsrc/tools/OpenROAD/etc/DependencyInstaller.sh
RUN ./etc/DependencyInstaller.sh -base
RUN ./tools/OpenROAD/etc/DependencyInstaller.sh -base
COPY --from=0 /opt/* /opt
WORKDIR /toolsrc
COPY --from=0 /toolsrc/hwloc-2.8.0 /toolsrc/hwloc-2.8.0
WORKDIR /toolsrc/hwloc-2.8.0
RUN make install
# Clean up source code folder
RUN rm -rf /toolsrc
# install editors
WORKDIR "/"
ADD home template
# Connect user home directory of host machine
RUN mkdir "/host"
WORKDIR "/host"
RUN rm -rf /opt/cad/conf
RUN mkdir /opt/cad/conf
ENV USER "bcli"
ENV USER_ID "1000"
ENV GROUP_ID "1000"
ENV MEMBERS ""
RUN echo "version: 17"
CMD exec /bin/bash -c "echo \"127.0.0.1 bcli-$USER\" >> /etc/hosts; \
echo \"$MEMBERS\" | sed 's/[0-9]* \\(adm\|cdrom\|sudo\|dip\|plugdev\|lxd\|docker\|dialout\|sambashare\|lpadmin\\) \?//g' | sed 's/ /\n/g' | xargs -n 2 /usr/sbin/groupadd -g; \
/usr/sbin/useradd -u $USER_ID -g $USER $USER; \
echo \"$MEMBERS\" | sed 's/[0-9]* \\(adm\|cdrom\|sudo\|dip\|plugdev\|lxd\|docker\|dialout\|sambashare\\) \?//g' | sed 's/ [0-9]\+ /,/g' | sed 's/[0-9]\+ //g' | xargs -I{} /usr/sbin/usermod -aG {} $USER; \
cp -r /template /home/$USER; \
chown -R $USER:$USER /home/$USER; \
echo \"$USER ALL=NOPASSWD: /usr/bin/apt-get install *\" > /etc/sudoers.d/apt-get; \
echo \"$USER ALL=NOPASSWD: /usr/bin/apt install *\" > /etc/sudoers.d/apt; \
ln -s /host/.ssh /home/$USER/.ssh; \
awk '/\[user\]/,/\[[^u]/' /host/.gitconfig | head -n -1 > /home/$USER/gitconfig; \
cat /home/$USER/.gitconfig >> /home/$USER/gitconfig; \
mv /home/$USER/gitconfig /home/$USER/.gitconfig; \
trap : TERM INT; sleep infinity & wait"
# In case we need to add a password for sudo.
# However, its possible for someone to break out of the docker container and
# have root access on the host if they are given sudo access in the container.
# So, we really shouldn't give them sudo access
# /usr/sbin/usermod -p \$(openssl passwd -1 'bcli') $USER; \