diff --git a/Dockerfile b/Dockerfile index 3e70ce90..b6756194 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,142 +66,124 @@ SHELL ["/bin/bash", "--login", "-c"] # Install top-level AHA and AHA Tools # Seems like this should happen *first*, no? -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs|cut -f 1` tools COPY . /aha WORKDIR /aha -RUN python -m venv . -RUN git branch && git log | head -1 +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` tools \ + && python -m venv . \ + && git branch \ + && git log | head -1 + +# Thunder +# (Doing thunder separately because it caused problems once) +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` pythunder && \ + python -m pip install -e cgra_pnr/thunder # Pono -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` pono COPY ./pono /aha/pono COPY ./aha/bin/setup-smt-switch.sh /aha/pono/contrib/ WORKDIR /aha/pono -RUN pip install Cython==0.29 pytest toml scikit-build==0.13.0 -RUN ./contrib/setup-bison.sh && ./contrib/setup-flex.sh && ./contrib/setup-smt-switch.sh --python && ./contrib/setup-btor2tools.sh -RUN ./configure.sh --python -WORKDIR /aha/pono/build -RUN make -j4 && pip install -e ./python -WORKDIR /aha/pono -# Clean up. Need build/lib and build/python later (WHY???) -# Need pono/build/python later, see "pip install -e pono/build/python" below :( -RUN /bin/rm -rf build/tests/ build/CMakefiles/ CMakeTmp/ - -# RUN ./contrib/setup-bison.sh \ -# && ./contrib/setup-flex.sh \ -# && ./contrib/setup-smt-switch.sh --python \ -# && ./contrib/setup-btor2tools.sh \ -# && ./configure.sh --python \ -# && cd build \ -# && make -j4 \ -# && pip install -e ./python \ -# && /bin/rm -rf /aha/pono/build/tests/ \ -# && /bin/rm -rf /aha/pono/build/CMakefiles/ \ -# && /bin/rm -rf /aha/pono/CMakeTmp/ +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` pono &&\ + pip install Cython==0.29 pytest toml scikit-build==0.13.0 &&\ + ./contrib/setup-bison.sh && ./contrib/setup-flex.sh &&\ + ./contrib/setup-smt-switch.sh --python && ./contrib/setup-btor2tools.sh &&\ + ./configure.sh --python &&\ + (cd /aha/pono/build && make -j4 && pip install -e ./python) &&\ + pip install -e deps/smt-switch/build/python &&\ + echo -n "BEFORE CLEANUP: " && du -hs /aha/pono &&\ + /bin/rm -rf deps build/tests/ build/CMakefiles/ build/CMakeTmp/ &&\ + echo -n "AFTER CLEANUP: " && du -hs /aha/pono # CoreIR -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` CoreIR WORKDIR /aha - COPY ./coreir /aha/coreir WORKDIR /aha/coreir/build -RUN cmake .. && make && make install -# Clean up because coreir build leaves 300M or so of intermediate files -WORKDIR /aha/coreir - -# RUN git clean -ffxdq -# Okay who knew maybe h2h needs contents of e.g. coreir/lib - -# RUN /bin/rm -rf build -# Okay you're killling me here -# I guess we need build/lib (51M) but hopefully not src (111M) or tests (59M) or maybe even bin (51M) +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` CoreIR &&\ + cmake .. && make && make install &&\ + echo -n "BEFORE CLEANUP: " && du -hs /aha/coreir/build &&\ + /bin/rm -rf src bin tests &&\ + echo -n "AFTER CLEANUP: " && du -hs /aha/coreir/build + +# CoreIR cleanup notes +# I guess we need build/lib (51M) but hopefully not build/src (111M) or build/tests (59M) or maybe even build/bin (51M) # FIXME/TODO could probably delete coreir/build/lib and replace with a symlink to coreir/lib? To save 34M. # Lake -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` lake COPY ./BufferMapping /aha/BufferMapping WORKDIR /aha/BufferMapping/cfunc -RUN export COREIR_DIR=/aha/coreir && make lib +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` lake &&\ + export COREIR_DIR=/aha/coreir && make lib # mflowgen ENV GARNET_HOME=/aha/garnet ENV MFLOWGEN=/aha/mflowgen # clockwork -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` clockwork COPY clockwork /aha/clockwork WORKDIR /aha/clockwork ENV COREIR_PATH=/aha/coreir ENV LAKE_PATH=/aha/lake -RUN ./misc/install_deps_ahaflow.sh && \ +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` clockwork && \ + ./misc/install_deps_ahaflow.sh && \ source user_settings/aha_settings.sh && \ make all -j4 && \ source misc/copy_cgralib.sh && \ - rm -rf ntl* + rm -rf ntl* && \ + echo -n "BEFORE CLEANUP: " && du -hs /aha/clockwork && \ + /bin/rm -rf /aha/clockwork/barvinok-0.41/ /aha/clockwork/bin/soda_codes/ && \ + echo -n "AFTER CLEANUP: " && du -hs /aha/clockwork && \ + echo DONE + +# clockwork cleanup notes # Clean up because clockwork build leaves 1.5G intermediate files in "dep" subdir -WORKDIR /aha/clockwork # Okay who knew maybe h2h needs contents of e.g. clockwork/lib -# RUN git clean -ffxdq -RUN du -hs /aha/clockwork -RUN /bin/rm -rf barvinok-0.41/ bin/soda_codes/ -RUN du -hs /aha/clockwork +# RUN /bin/rm -rf /aha/clockwork/barvinok-0.41/ /aha/clockwork/bin/soda_codes/ # Halide-to-Hardware -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` H2H COPY ./Halide-to-Hardware /aha/Halide-to-Hardware WORKDIR /aha/Halide-to-Hardware -RUN export COREIR_DIR=/aha/coreir && make -j2 && make distrib && \ +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` H2H && \ + export COREIR_DIR=/aha/coreir && make -j2 && make distrib && \ rm -rf lib/* # Sam -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` sam WORKDIR /aha/sam -RUN make sam -RUN source /aha/bin/activate && pip install scipy numpy pytest && pip install -e . +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` sam && \ + make sam && \ + source /aha/bin/activate && pip install scipy numpy pytest && pip install -e . -# Install torch (need big tmp folder) -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` torch -WORKDIR /aha -RUN mkdir -p /aha/tmp/torch_install/ # Save (and later restore) existing value for TMPDIR, if any ENV TMPTMPDIR=$TMPDIR ENV TMPDIR=/aha/tmp/torch_install/ -RUN source /aha/bin/activate && pip install --cache-dir=$TMPDIR --build=$TMPDIR torch==1.7.1+cpu -f https://download.pytorch.org/whl/torch_stable.html -RUN rm -rf $TMPDIR + +# Install torch (need big tmp folder) +WORKDIR /aha +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` torch && \ + mkdir -p /aha/tmp/torch_install/ && \ + source /aha/bin/activate && \ + pip install --cache-dir=$TMPDIR --build=$TMPDIR torch==1.7.1+cpu -f https://download.pytorch.org/whl/torch_stable.html && \ + /bin/rm -rf $TMPDIR + +# Restore original value of TMPDIR ENV TMPDIR=$TMPTMPDIR +# BOOKMARK + +# FIXME this is top level stuff why don't we do this FIRST? WORKDIR /aha -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` misc -# FIXME/TODO why not install pono/build/python earlier, i.e. just after pono setup? -RUN source bin/activate && \ +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` misc && \ + source bin/activate && \ pip install urllib3==1.26.15 && \ pip install wheel six && \ pip install systemrdl-compiler peakrdl-html && \ pip install -e . && pip install packaging==21.3 && \ - pip install -e ./pono/deps/smt-switch/build/python && \ - pip install -e pono/build/python/ && \ aha deps install WORKDIR /aha - ENV OA_UNSUPPORTED_PLAT=linux_rhel60 ENV USER=docker - -RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` bashrc -RUN echo "source /aha/bin/activate" >> /root/.bashrc && \ +RUN printf -- "--- TIME %s %s\n" `date +%H:%M` bashrc && \ + echo "source /aha/bin/activate" >> /root/.bashrc && \ echo "source /cad/modules/tcl/init/sh" >> /root/.bashrc -# Maybe don't need to deinit everything if we just clean up after ourselves -# RUN printf -- "--- TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` deinit -# WORKDIR /aha -# RUN git submodule deinit -f --all - -# Okay but what if we delete 2.2G worth of pono deps? -RUN /bin/rm -rf /aha/pono/deps - # END -RUN printf -- "+++ TIME %s SPACE %s %s\n" `date +%H:%M` `du -hs /aha|cut -f 1` end -RUN du -bhx --max-depth=1 / | grep G | sort -rn -RUN du -bhx --max-depth=1 /aha | grep G | sort -rn - -# LATER: delete pono/build, coreir/build etc.? +RUN printf -- "+++ TIME %s %s\n" `date +%H:%M` end