From 9734455acd0d6e0cba44477f889ec8165e7f3003 Mon Sep 17 00:00:00 2001 From: ludamad Date: Mon, 15 Apr 2024 12:57:35 -0400 Subject: [PATCH] fix: make earthly more parallel (#5747) If you have FROM +dependency, its a good idea to prefetch above it with BUILD +later-target commands --- barretenberg/cpp/Earthfile | 5 ++++- boxes/Earthfile | 2 +- noir/Earthfile | 7 ++++--- yarn-project/Earthfile | 8 ++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/barretenberg/cpp/Earthfile b/barretenberg/cpp/Earthfile index 3d1dbc3aece..1d72f8838c6 100644 --- a/barretenberg/cpp/Earthfile +++ b/barretenberg/cpp/Earthfile @@ -187,6 +187,7 @@ bench-binaries: # Runs on the bench image, sent from the builder runner bench-ultra-honk: + BUILD +wasmtime # prefetch FROM +source COPY --dir +bench-binaries/* . # install SRS needed for proving @@ -198,6 +199,7 @@ bench-ultra-honk: RUN cd wasm && wasmtime run --env HARDWARE_CONCURRENCY=16 -Wthreads=y -Sthreads=y --dir=".." ./bin/ultra_honk_bench --benchmark_filter="construct_proof_ultrahonk_power_of_2/20$" bench-client-ivc: + BUILD +wasmtime # prefetch FROM +source COPY --dir +bench-binaries/* . # install SRS needed for proving @@ -232,9 +234,10 @@ test-clang-format: RUN ./format.sh check test: + BUILD +test-clang-format + BUILD ./srs_db/+build # prefetch FROM +source COPY --dir +test-binaries/build build - BUILD +test-clang-format FROM +preset-release-assert-test COPY --dir ./srs_db/+build/. srs_db RUN cd build && GTEST_COLOR=1 ctest -j$(nproc) --output-on-failure diff --git a/boxes/Earthfile b/boxes/Earthfile index e96e5e681c8..35ebe466c69 100644 --- a/boxes/Earthfile +++ b/boxes/Earthfile @@ -15,4 +15,4 @@ build: ENV AZTEC_CLI=/usr/src/yarn-project/cli/aztec-cli-dest RUN yarn && yarn build RUN npx -y playwright@1.42 install --with-deps - ENTRYPOINT ["/bin/sh", "-c"] \ No newline at end of file + ENTRYPOINT ["/bin/sh", "-c"] diff --git a/noir/Earthfile b/noir/Earthfile index 099db3102f2..9e1f7610b82 100644 --- a/noir/Earthfile +++ b/noir/Earthfile @@ -26,13 +26,14 @@ nargo: SAVE IMAGE aztecprotocol/nargo packages: + BUILD ../barretenberg/ts/+build # prefetch FROM node:20 RUN curl https://sh.rustup.rs -sSf | bash -s -- -y RUN echo 'source $HOME/.cargo/env' >> $HOME/.bashrc RUN apt update && apt install -y jq libc++1 - # `noir-repo` is nested inside of `noir` so we copy `bb.js` as such to account + # `noir-repo` is nested inside of `noir` so we copy `bb.js` as such to account # for the extra nested folder specified in portalled package paths COPY ../barretenberg/ts/+build/build /usr/src/../barretenberg/ts @@ -105,8 +106,8 @@ build: # FROM scratch # COPY --from=builder /usr/src/noir/README.md /usr/src/noir/README.md -# TODO -# test: +# TODO +# test: # FROM rust:bullseye # ARG COMMIT_HASH # ENV COMMIT_HASH=${COMMIT_HASH} diff --git a/yarn-project/Earthfile b/yarn-project/Earthfile index 7659858058d..6825755a732 100644 --- a/yarn-project/Earthfile +++ b/yarn-project/Earthfile @@ -29,6 +29,11 @@ deps: RUN ln -s /usr/src/yarn-project/node_modules /usr/src/node_modules build: + # Prefetch targets to not wait for +deps. + BUILD ../barretenberg/cpp/+preset-release + BUILD ../noir/+nargo + BUILD ../noir-projects/+build + BUILD ../l1-contracts/+build FROM +deps RUN apt update && apt install -y jq curl perl && rm -rf /var/lib/apt/lists/* && apt-get clean @@ -82,6 +87,9 @@ all: # for use with yarn-project/end-to-end and its e2e_mode=cache option export-end-to-end: + # Prefetch targets to build in parallel. + BUILD +end-to-end + BUILD +aztec ARG EARTHLY_GIT_HASH # pushes the foundry image to local docker images FROM ../foundry/+build