From a525f048b7fdde0807f5caea3b8fa998019ae140 Mon Sep 17 00:00:00 2001 From: Michal Czyz Date: Wed, 24 Jan 2024 19:48:29 +0100 Subject: [PATCH] Update flow --- .github/workflows/ci.yml | 60 ++++++++++++++++----------------- Dockerfile | 67 ++++++++++++++++++++++++------------- scripts/install-chipyard.sh | 9 +++++ scripts/install-conda.sh | 13 +++++++ 4 files changed, 94 insertions(+), 55 deletions(-) create mode 100644 scripts/install-chipyard.sh create mode 100644 scripts/install-conda.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33dbef6..02acbf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,8 @@ on: pull_request: jobs: - smoke-tests: - name: Smoke Test + install-chipyard: + name: Install Chipyard runs-on: ubuntu-latest container: image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest @@ -17,15 +17,24 @@ jobs: env: DEBIAN_FRONTEND: "noninteractive" steps: - - name: Smoke test - id: smoke_test + - name: install chipyard + id: install_chipyard run: | - echo "Smoke test" - # pushd tests - # make -j`nproc` - # popd + git clone https://github.com/ucb-bar/chipyard.git + pushd chipyard + git checkout 1.11.0 + ./build-setup.sh riscv-tools -s 2 -s 3 -s 4 -s 5 -s 6 -s 7 -s 8 -s 9 + popd + - name: upload artifact + id: upload_artifact + uses: actions/upload-artifact@v3 + with: + name: chipyard + path: chipyard + binary-tests: name: Binary test + needs: install-chipyard runs-on: ubuntu-latest container: image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest @@ -40,6 +49,11 @@ jobs: env: DEBIAN_FRONTEND: "noninteractive" steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: chipyard + path: ./chipyard - name: Binary test id: binary_test run: | @@ -52,6 +66,7 @@ jobs: # popd coremark: name: Coremark + needs: install-chipyard runs-on: ubuntu-latest container: image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest @@ -61,6 +76,11 @@ jobs: env: DEBIAN_FRONTEND: "noninteractive" steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: chipyard + path: ./chipyard - name: Coremark run: | echo "Coremark" @@ -71,26 +91,4 @@ jobs: # cat riscv-coremark/build-coremark.sh # ./build.sh # popd - verilator_configs: - name: Verilator ChipConfig - runs-on: ubuntu-latest - container: - image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest - defaults: - run: - shell: bash - env: - DEBIAN_FRONTEND: "noninteractive" - strategy: - fail-fast: false - matrix: - CONFIG: ["RocketConfig", "MegaBoomConfig"] - steps: - - name: Verilator ${{ matrix.CONFIG }} - run: | - echo "Verilator config" - # cd chipyard - # source env.sh - # pushd sims/verilator - # make CONFIG=${{ matrix.CONFIG }} -j`nproc` - # popd + diff --git a/Dockerfile b/Dockerfile index 4c3e5fc..c9f2b10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,34 +2,53 @@ FROM ubuntu:22.04 -SHELL ["/bin/bash", "-c"] +SHELL [ "/bin/bash", "--login", "-c" ] -# Install dependencies for ubuntu-req.sh RUN apt -qqy update && \ DEBIAN_FRONTEND=noninteractive apt install -qqy --no-install-recommends \ - ca-certificates build-essential gcc g++ python3 git cmake autoconf bison flex help2man wget + autoconf \ + bison \ + build-essential \ + ca-certificates \ + cmake \ + curl \ + flex \ + g++ \ + gcc \ + git \ + help2man \ + kmod \ + pbzip2 \ + python3 \ + sudo \ + wget RUN update-ca-certificates -WORKDIR /root -RUN apt -qqy update && \ - DEBIAN_FRONTEND=noninteractive apt install -qqy --no-install-recommends \ - ca-certificates curl build-essential git sudo pbzip2 kmod -RUN update-ca-certificates +COPY scripts/install-conda.sh /install-conda.sh +COPY scripts/install-chipyard.sh /install-chipyard.sh +RUN chmod +x install-conda.sh install-chipyard.sh + +RUN . ./install-conda.sh +RUN echo "source activate base" > ~/.bashrc +ENV PATH=/root/conda/bin:$PATH +RUN conda init bash +RUN conda activate base + +ENTRYPOINT ["/bin/bash"] + +# FIXME: There is problem with activating and using conda in dockerfiles. + +# RUN conda activate base && git clone https://github.com/ucb-bar/chipyard.git && \ +# cd chipyard && \ +# git checkout 1.11.0 && \ +# ./build-setup.sh riscv-tools -s 1 -s 2 -s 3 -s 4 -s 5 -s 6 -s 7 -s 8 -s 9 && \ +# cd .. +# RUN ./install-chipyard.sh +# RUN ["/bin/bash", "--login", "-c", "conda init"] +# RUN source /root/.bashrc && conda activate base +# RUN ["/bin/bash", "--login", "-c", "conda activate base"] +# RUN ["/bin/bash", "-c", "cd chipyard && ./build-setup.sh riscv-tools -s 6 -s 7 -s 8 -s 9"] + -# Install Chipyard and run ubuntu-req.sh to install necessary dependencies -# FIXME: Using a branch, because I updated the install-conda.sh script, -# which is no longer maintained. Fix this in the future. -RUN git clone https://github.com/antmicro/chipyard.git && \ - cd chipyard && \ - git checkout mczyz/deps - -RUN ./chipyard/.github/scripts/install-conda.sh -# RUN source ~/.bashrc -# RUN bash -RUN echo "shell is "$0 -RUN ["/bin/bash", "--login", "-c", "conda activate base"] -RUN ["/bin/bash", "--login", "-c", "cd chipyard && ./build-setup.sh riscv-tools -s 6 -s 7 -s 8 -s 9"] -RUN ["/bin/bash", "--login", "-c", "cd chipyard && source ./env.sh"] - -ENTRYPOINT ["chipyard/scripts/entrypoint.sh"] +# ENTRYPOINT ["chipyard/scripts/entrypoint.sh"] diff --git a/scripts/install-chipyard.sh b/scripts/install-chipyard.sh new file mode 100644 index 0000000..205ad71 --- /dev/null +++ b/scripts/install-chipyard.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# conda activate base + +git clone https://github.com/ucb-bar/chipyard.git +cd chipyard + git checkout 1.11.0 + ./build-setup.sh riscv-tools -s 1 -s 2 -s 3 -s 4 -s 5 -s 6 -s 7 -s 8 -s 9 +cd .. diff --git a/scripts/install-conda.sh b/scripts/install-conda.sh new file mode 100644 index 0000000..cfc8572 --- /dev/null +++ b/scripts/install-conda.sh @@ -0,0 +1,13 @@ + +set -ex +set -o pipefail + +curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" +bash Miniforge3-$(uname)-$(uname -m).sh -b -p "${HOME}/conda" + +export PATH=/root/conda/bin/:$PATH + +conda install -n base conda-libmamba-solver +conda config --set solver libmamba +conda install -n base conda-lock==1.4.0 +# conda init bash