Skip to content

Commit

Permalink
feat: Parallel native/wasm bb builds. Better messaging around using c…
Browse files Browse the repository at this point in the history
…i cache. (#4766)

Ignore badly named branch name. Public ECR is a bit of a no go as it has
a bunch of restrictions that is a problem:
* Only us-east-1.
* Missing various API's, like ability to retag remote images without
pulling.
* No lifecycle policies.

It was actually the second point that made me give up on public ecr
right now.

* Once upon a time, we published our deployment containers to a private
ECR repo in eu-west-2. Removes all references to the old private ECR
repo from dockerfiles and build stuff, now just using the
`aztecprotocol` dockerhub org.
* Makes `./bootstrap.sh` require an explicit command, one of
`full|fast|clean`. Add warnings when trying to use cache but can't, or
not using cache but can. By being explicit users are made aware of the
option of a `fast` bootstrap.
* barretenberg now builds native/wasm/wasm-threads together in parallel,
with pretty line coloring to distinguish output.
* New amis for build-instances (Ubuntu 22 with upgraded aws-cli).
  • Loading branch information
charlielye authored and AztecBot committed Feb 28, 2024
1 parent b0e822f commit 7b1e6e2
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 32 deletions.
6 changes: 3 additions & 3 deletions acir_tests/Dockerfile.bb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-compile-acir-tests as noir-acir-tests
FROM aztecprotocol/barretenberg-x86_64-linux-clang-assert
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0-alpine
RUN apk update && apk add git bash curl jq coreutils
Expand All @@ -10,7 +10,7 @@ COPY . .
# Run every acir test through native bb build prove_then_verify flow for UltraPlonk.
# This ensures we test independent pk construction through real/garbage witness data paths.
RUN FLOW=prove_then_verify ./run_acir_tests.sh
# This flow is essentially the GoblinUltraHonk equivalent to the UltraPlonk "prove and verify". (This functionality is
# This flow is essentially the GoblinUltraHonk equivalent to the UltraPlonk "prove and verify". (This functionality is
# accessed via the goblin "accumulate" mechanism).
RUN FLOW=accumulate_and_verify_goblin ./run_acir_tests.sh
# This is a "full" Goblin flow. It constructs and verifies four proofs: GoblinUltraHonk, ECCVM, Translator, and merge
Expand Down
4 changes: 2 additions & 2 deletions acir_tests/Dockerfile.bb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/bb.js
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-compile-acir-tests as noir-acir-tests
FROM aztecprotocol/bb.js
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0
COPY --from=0 /usr/src/barretenberg/ts-build /usr/src/barretenberg/ts
Expand Down
6 changes: 3 additions & 3 deletions acir_tests/Dockerfile.bb.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang-sol
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir-compile-acir-tests as noir-acir-tests
FROM aztecprotocol/barretenberg-x86_64-linux-clang-assert
FROM aztecprotocol/barretenberg-x86_64-linux-clang-sol
FROM aztecprotocol/noir-compile-acir-tests as noir-acir-tests

FROM node:18.19.0-alpine
RUN apk update && apk add git bash curl jq
Expand Down
2 changes: 1 addition & 1 deletion acir_tests/Dockerfile.noir_acir_tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# However, the noir subrepo has no concept of the aztec build pipeline, so the Dockerfile wouldn't make sense there.
# So, it lives here.
# This chains off the nargo build, and creates a container with a compiled set of acir tests.
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/noir
FROM aztecprotocol/noir
RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* && apt-get clean
ENV PATH="/usr/src/noir/target/release:${PATH}"
WORKDIR /usr/src/noir/test_programs
Expand Down
46 changes: 30 additions & 16 deletions cpp/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ fi
# Download ignition transcripts.
(cd ./srs_db && ./download_ignition.sh 0)

# Install wasi-sdk.
./scripts/install-wasi-sdk.sh

# Attempt to just pull artefacts from CI and exit on success.
./bootstrap_cache.sh && exit
[ -n "${USE_CACHE:-}" ] && ./bootstrap_cache.sh && exit

# Pick native toolchain file.
ARCH=$(uname -m)
Expand All @@ -54,23 +57,34 @@ echo "# Building with preset: $PRESET"
echo "# When running cmake directly, remember to use: --build --preset $PRESET"
echo "#################################"

# Build native.
cmake --preset $PRESET -DCMAKE_BUILD_TYPE=RelWithAssert
cmake --build --preset $PRESET --target bb
function build_native {
cmake --preset $PRESET -DCMAKE_BUILD_TYPE=RelWithAssert
cmake --build --preset $PRESET --target bb
}

function build_wasm {
cmake --preset wasm
cmake --build --preset wasm
}

function build_wasm_threads {
cmake --preset wasm-threads
cmake --build --preset wasm-threads
}

g="\033[32m" # Green
b="\033[34m" # Blue
p="\033[35m" # Purple
r="\033[0m" # Reset

(build_native > >(awk -v g="$g" -v r="$r" '$0=g"native: "r $0')) &
(build_wasm > >(awk -v b="$b" -v r="$r" '$0=b"wasm: "r $0')) &
(build_wasm_threads > >(awk -v p="$p" -v r="$r" '$0=p"wasm_threads: "r $0')) &

wait

if [ ! -d ./srs_db/grumpkin ]; then
# The Grumpkin SRS is generated manually at the moment, only up to a large enough size for tests
# If tests require more points, the parameter can be increased here.
(cd ./build && cmake --build . --parallel --target grumpkin_srs_gen && ./bin/grumpkin_srs_gen 8192)
cd ./build && cmake --build . --parallel --target grumpkin_srs_gen && ./bin/grumpkin_srs_gen 8192
fi

# Install wasi-sdk.
./scripts/install-wasi-sdk.sh

# Build WASM.
cmake --preset wasm
cmake --build --preset wasm

# Build WASM with new threading.
cmake --preset wasm-threads
cmake --build --preset wasm-threads
2 changes: 0 additions & 2 deletions cpp/bootstrap_cache.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
set -eu

[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1

cd "$(dirname "$0")"
source ../../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null

Expand Down
2 changes: 1 addition & 1 deletion cpp/dockerfiles/Dockerfile.bench
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-x86_64-linux-clang
FROM aztecprotocol/barretenberg-x86_64-linux-clang
WORKDIR /usr/src/barretenberg/cpp
RUN apk update && apk add curl libstdc++ jq
RUN ./scripts/ci/ultra_honk_bench.sh
2 changes: 1 addition & 1 deletion ts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM 278380418400.dkr.ecr.eu-west-2.amazonaws.com/barretenberg-wasm-linux-clang
FROM aztecprotocol/barretenberg-wasm-linux-clang

FROM node:18.19.0-alpine
COPY --from=0 /usr/src/barretenberg /usr/src/barretenberg
Expand Down
2 changes: 1 addition & 1 deletion ts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ -n "$CMD" ]; then
fi

# Attempt to just pull artefacts from CI and exit on success.
./bootstrap_cache.sh && exit
[ -n "${USE_CACHE:-}" ] && ./bootstrap_cache.sh && exit

yarn install --immutable
echo "Building with command 'yarn $BUILD_CMD'..."
Expand Down
2 changes: 0 additions & 2 deletions ts/bootstrap_cache.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
set -eu

[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1

cd "$(dirname "$0")"
source ../../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null

Expand Down

0 comments on commit 7b1e6e2

Please sign in to comment.