Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prover): add GPU feature for compressor #1838

Merged
merged 41 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3b16ddb
add gpu compressor
Artemka374 Apr 30, 2024
a327b34
Merge branch 'main' into afo/gpu-compressors
Artemka374 Apr 30, 2024
1afd5c0
merge fixes
Artemka374 Apr 30, 2024
d252467
add revision for heavy ops repo
Artemka374 May 1, 2024
feeca5f
one more revision change, update imports
Artemka374 May 1, 2024
1cf7bb3
one more revision change, update imports
Artemka374 May 1, 2024
a196bb8
move the gpu part out of the method
Artemka374 May 1, 2024
026746a
add generic const expr
Artemka374 May 1, 2024
64781c4
add import for cpu
Artemka374 May 3, 2024
7b5cfc8
update rev for wrapper
Artemka374 May 3, 2024
0f31e73
reset changes
Artemka374 May 7, 2024
9e5fcb4
add info how to run the compressor
Artemka374 May 7, 2024
56678c7
update imports
Artemka374 May 7, 2024
e4c4ba3
Merge branch 'main' into afo/gpu-compressors
Artemka374 May 7, 2024
2c0a988
update revision
Artemka374 May 7, 2024
a84336a
Merge remote-tracking branch 'origin/afo/gpu-compressors' into afo/gp…
Artemka374 May 7, 2024
528d533
try satisfying lint
Artemka374 May 7, 2024
32b5156
update dockerfile
Artemka374 May 8, 2024
049c3dd
update dockerfile
Artemka374 May 9, 2024
1db57ba
fmt
Artemka374 May 9, 2024
b3b351e
Merge branch 'refs/heads/main' into afo/gpu-compressors
Artemka374 May 9, 2024
dcb80e3
Merge branch 'refs/heads/main' into afo/gpu-compressors
Artemka374 May 9, 2024
0da4604
satisfy lint
Artemka374 May 9, 2024
63d4009
Merge branch 'main' into afo/gpu-compressors
Artemka374 May 13, 2024
f9a5840
Merge branch 'main' into afo/gpu-compressors
Artemka374 May 14, 2024
e19ac67
update images
Artemka374 May 20, 2024
2c34dd7
Merge branch 'main' into afo/gpu-compressors
Artemka374 May 20, 2024
22e2a5d
return back dockerfile
Artemka374 May 20, 2024
0ad0d17
Merge remote-tracking branch 'origin/afo/gpu-compressors' into afo/gp…
Artemka374 May 20, 2024
36ea3ad
update zk tool
Artemka374 May 20, 2024
014ba0e
fmt
Artemka374 May 20, 2024
95f0d83
update dockerfile
Artemka374 May 20, 2024
acd8e22
update cargo.lock
Artemka374 May 20, 2024
087d5bc
address comments
Artemka374 May 20, 2024
646302c
newline
Artemka374 May 20, 2024
6815978
try using 2^24.key once again
Artemka374 May 21, 2024
94ad708
update dockerignore
Artemka374 May 21, 2024
833bb26
return back 2^26 key in some places
Artemka374 May 21, 2024
185b68b
update doc
Artemka374 May 21, 2024
60e654d
rename gpu compressor
Artemka374 May 21, 2024
3c8afb6
fmt
Artemka374 May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build-prover-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
RUNNER_COMPOSE_FILE: "docker-compose-runner-nightly.yml"
ERA_BELLMAN_CUDA_RELEASE: ${{ inputs.ERA_BELLMAN_CUDA_RELEASE }}
CUDA_ARCH: ${{ inputs.CUDA_ARCH }}
runs-on: [matterlabs-ci-runner]
runs-on: [ matterlabs-ci-runner ]
strategy:
matrix:
component:
Expand Down Expand Up @@ -82,6 +82,7 @@ jobs:
- name: download CRS
if: matrix.component == 'proof-fri-compressor'
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved
run: |
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^24.key
ci_run curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key

- name: login to Docker registries
Expand Down Expand Up @@ -137,7 +138,7 @@ jobs:
env:
DOCKER_ACTION: ${{ inputs.action }}
COMPONENT: ${{ matrix.component }}
run: |
run: |
PASSED_ENV_VARS="ERA_BELLMAN_CUDA_RELEASE,CUDA_ARCH" \
ci_run zk docker $DOCKER_ACTION $COMPONENT

Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 29 additions & 7 deletions docker/proof-fri-compressor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
# Will work locally only after prior universal setup key download

FROM matterlabs/zksync-build-base:latest as builder
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04 as builder
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved

ARG DEBIAN_FRONTEND=noninteractive

ARG CUDA_ARCH=89
ENV CUDAARCHS=${CUDA_ARCH}

RUN apt-get update && apt-get install -y curl clang openssl libssl-dev gcc g++ git \
pkg-config build-essential libclang-dev && \
rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \
rustup install nightly-2023-08-21 && \
rustup default nightly-2023-08-21

RUN curl -Lo cmake-3.24.2-linux-x86_64.sh https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2-linux-x86_64.sh && \
chmod +x cmake-3.24.2-linux-x86_64.sh && \
./cmake-3.24.2-linux-x86_64.sh --skip-license --prefix=/usr/local

WORKDIR /usr/src/zksync
COPY . .

RUN cd prover && cargo build --release --bin zksync_proof_fri_compressor
RUN mkdir keys && cd keys && mkdir setup && cd setup && curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2^24.key

RUN cd prover && \
git clone https://github.com/matter-labs/era-bellman-cuda.git --branch main bellman-cuda && \
cmake -Bbellman-cuda/build -Sbellman-cuda/ -DCMAKE_BUILD_TYPE=Release && \
cmake --build bellman-cuda/build/

FROM debian:bookworm-slim
RUN cd prover && BELLMAN_CUDA_DIR=$PWD/bellman-cuda cargo build --features "gpu" --release --bin zksync_proof_fri_compressor
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved

FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/*

# copy VK required for proof wrapping
COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/

# copy universal setup key required for proof compression
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved
COPY setup_2\^26.key /setup_2\^26.key

COPY --from=builder /usr/src/zksync/prover/target/release/zksync_proof_fri_compressor /usr/bin/

ENTRYPOINT ["zksync_proof_fri_compressor"]
47 changes: 47 additions & 0 deletions docker/proof-gpu-fri-compressor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Will work locally only after prior universal setup key download
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04 as builder

ARG DEBIAN_FRONTEND=noninteractive

ARG CUDA_ARCH=89
ENV CUDAARCHS=${CUDA_ARCH}

RUN apt-get update && apt-get install -y curl clang openssl libssl-dev gcc g++ \
pkg-config build-essential libclang-dev && \
rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH

RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \
rustup install nightly-2023-08-21 && \
rustup default nightly-2023-08-21

RUN curl -Lo cmake-3.24.2-linux-x86_64.sh https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2-linux-x86_64.sh && \
chmod +x cmake-3.24.2-linux-x86_64.sh && \
./cmake-3.24.2-linux-x86_64.sh --skip-license --prefix=/usr/local

WORKDIR /usr/src/zksync
COPY . .

RUN cd prover && \
git clone https://github.com/matter-labs/bellman-cuda.git --branch dev bellman-cuda && \
cmake -Bbellman-cuda/build -Sbellman-cuda/ -DCMAKE_BUILD_TYPE=Release && \
cmake --build bellman-cuda/build/ && \
export BELLMAN_CUDA_DIR=$PWD/bellman-cuda
RUN cd prover && cargo build --features "gpu" --release --bin zksync_proof_fri_compressor

FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04

RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/*

# copy VK required for proof wrapping
COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/

# copy universal setup key required for proof compression
COPY setup_2\^24.key /setup_2\^24.key

COPY --from=builder /usr/src/zksync/prover/target/release/zksync_proof_fri_compressor /usr/bin/

ENTRYPOINT ["zksync_proof_fri_compressor"]
18 changes: 9 additions & 9 deletions etc/env/base/fri_proof_compressor.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[fri_proof_compressor]
compression_mode=1
prometheus_listener_port=3321
prometheus_pushgateway_url="http://127.0.0.1:9091"
prometheus_push_interval_ms=100
generation_timeout_in_secs=3600
max_attempts=5
universal_setup_path="../keys/setup/setup_2^26.key"
universal_setup_download_url="https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2^26.key"
verify_wrapper_proof=true
compression_mode = 1
prometheus_listener_port = 3321
prometheus_pushgateway_url = "http://127.0.0.1:9091"
prometheus_push_interval_ms = 100
generation_timeout_in_secs = 3600
max_attempts = 5
universal_setup_path = "../keys/setup/setup_2^24.key"
universal_setup_download_url = "https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2^24.key"
verify_wrapper_proof = true
Loading
Loading