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 39 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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ keys/setup
!Cargo.toml
!contracts/
!setup_2\^26.key
!setup_2\^24.key
# It's required to remove .git from contracts,
# otherwise yarn tries to use .git parent directory that
# doesn't exist.
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
runs-on: ${{ fromJSON('["matterlabs-ci-runner", "matterlabs-ci-runner-arm"]')[contains(matrix.platforms, 'arm')] }}
strategy:
matrix:
components:
- contract-verifier
- verified-sources-fetcher
platforms:
- linux/amd64
components:
- contract-verifier
- verified-sources-fetcher
platforms:
- linux/amd64

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ jobs:
runs-on: ${{ fromJSON('["matterlabs-ci-runner", "matterlabs-ci-runner-arm"]')[contains(matrix.platforms, 'arm')] }}
strategy:
matrix:
components:
- server-v2
- external-node
- snapshots-creator
platforms:
- linux/amd64
include:
- components: external-node
platforms: linux/arm64
components:
- server-v2
- external-node
- snapshots-creator
platforms:
- linux/amd64
include:
- components: external-node
platforms: linux/arm64

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
Expand Down
13 changes: 10 additions & 3 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 All @@ -51,6 +51,7 @@ jobs:
- witness-vector-generator
- prover-fri-gateway
- proof-fri-compressor
- proof-gpu-fri-compressor
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
Expand Down Expand Up @@ -80,11 +81,17 @@ jobs:
ci_run zk

# We need the CRS only for the fri compressor.
- name: download CRS
- name: download CRS for CPU compressor
if: matrix.component == 'proof-fri-compressor'
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved
run: |
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key

- name: download CRS for GPU compressor
if: matrix.component == 'proof-gpu-fri-compressor'
run: |
ci_run curl --retry 5 -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^24.key


- name: login to Docker registries
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
run: |
Expand Down Expand Up @@ -138,7 +145,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.

3 changes: 3 additions & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -961,3 +961,6 @@ vec
zksync_merkle_tree
TreeMetadata
delegator
Bbellman
Sbellman
DCMAKE
2 changes: 1 addition & 1 deletion core/lib/config/src/configs/fri_proof_compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct FriProofCompressorConfig {

/// Path to universal setup key file
pub universal_setup_path: String,
/// https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
/// https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^24.key
pub universal_setup_download_url: String,

// Whether to verify wrapper proof or not.
Expand Down
46 changes: 46 additions & 0 deletions docker/proof-gpu-fri-compressor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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++ 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 && \
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/

RUN cd prover && BELLMAN_CUDA_DIR=$PWD/bellman-cuda 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 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
4 changes: 2 additions & 2 deletions etc/env/file_based/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ proof_compressor:
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
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
prover_group:
group_0:
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/zk/src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const IMAGES = [
'witness-vector-generator',
'prover-fri-gateway',
'proof-fri-compressor',
'proof-gpu-fri-compressor',
'snapshots-creator',
'verified-sources-fetcher'
];
Expand Down Expand Up @@ -79,6 +80,7 @@ function defaultTagList(image: string, imageTagSha: string, imageTagShaTS: strin
'witness-vector-generator',
'prover-fri-gateway',
'proof-fri-compressor',
'proof-gpu-fri-compressor',
'snapshots-creator'
].includes(image)
? ['latest', 'latest2.0', `2.0-${imageTagSha}`, `${imageTagSha}`, `2.0-${imageTagShaTS}`, `${imageTagShaTS}`]
Expand Down
Loading
Loading