Skip to content

Commit

Permalink
feat(hyperchain-wizard): zkStack CLI GPU support (matter-labs#612)
Browse files Browse the repository at this point in the history
## What ❔

Support for creating zk hyperchain via zk cli with GPU-based provers

## Why ❔


## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [X] Code has been formatted via `zk fmt` and `zk lint`.
- [ ] Spellcheck has been run via `cargo spellcheck
--cfg=./spellcheck/era.cfg --code 1`.

---------

Co-authored-by: Igor Borodin <[email protected]>
  • Loading branch information
artmakh and hatemosphere authored Dec 6, 2023
1 parent c4dc1e1 commit c7d4315
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 70 deletions.
35 changes: 35 additions & 0 deletions docker-compose-zkstack-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3.2'
networks:
zkstack:
driver: bridge
services:
geth:
image: "matterlabs/geth:latest"
ports:
- "127.0.0.1:8545:8545"
- "127.0.0.1:8546:8546"
volumes:
- type: bind
source: ./volumes/geth
target: /var/lib/geth/data
networks:
- zkstack
container_name: geth
postgres:
image: "postgres:14"
container_name: postgres
ports:
- "127.0.0.1:5432:5432"
volumes:
- type: bind
source: ./volumes/postgres
target: /var/lib/postgresql/data
environment:
# We bind only to 127.0.0.1, so setting insecure password is acceptable here
- POSTGRES_PASSWORD=notsecurepassword
command:
- "postgres"
- "-c"
- "max_connections=1000"
networks:
- zkstack
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
version: '3.2'
networks:
zkstack:
driver: bridge
zksync-era_zkstack:
external: true
volumes:
artifacts:
services:
zkstack-core:
container_name: zkstack-core
networks:
- zkstack
- zksync-era_zkstack
image: {{orgName}}/server-v2:latest
command: ["--components", "tree_new,eth,data_fetcher,state_keeper,housekeeper,proof_data_handler"]
healthcheck:
Expand All @@ -24,20 +25,23 @@ services:
- "3320:3320" # proof_data_handler api
volumes:
- artifacts:{{artifactsPath}}

zkstack-apis:
networks:
- zkstack
- zksync-era_zkstack
image: {{orgName}}/server-v2:latest
command: ["--components", "http_api,ws_api"]
env_file:
- {{envFilePath}}
environment:
ZKSYNC_HOME: /
FRI_PROVER_GATEWAY_API_URL: http://zkstack-core:3320
ports: # assumes default ports in .env
- "3071:3071" # health
- "3312:3312" # prometheus metrics # we need a separate metrics port for each component
- "3050:3050" # http_api
- "3051:3051" # ws_api

{{#if hasProver}}
# System requirements for CPU proving:
# ~16+ CPU cores
Expand All @@ -46,7 +50,7 @@ services:
# - (PRO-47): Figure out how to properly set metrics ports for each service in env
zkstack-prover-fri-gateway:
networks:
- zkstack
- zksync-era_zkstack
image: matterlabs/prover-fri-gateway:latest
depends_on:
zkstack-core:
Expand All @@ -62,7 +66,7 @@ services:
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}
zkstack-witness-generator-basic-circuits:
networks:
- zkstack
- zksync-era_zkstack
image: matterlabs/witness-generator:latest
command: ["--round", "basic_circuits"]
env_file:
Expand All @@ -72,9 +76,10 @@ services:
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}

zkstack-witness-generator-leaf-aggregation:
networks:
- zkstack
- zksync-era_zkstack
image: matterlabs/witness-generator:latest
command: ["--round", "leaf_aggregation"]
env_file:
Expand All @@ -84,9 +89,10 @@ services:
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}

zkstack-witness-generator-node-aggregation:
networks:
- zkstack
- zksync-era_zkstack
image: matterlabs/witness-generator:latest
command: ["--round", "node_aggregation"]
env_file:
Expand All @@ -96,9 +102,10 @@ services:
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}

zkstack-witness-generator-scheduler:
networks:
- zkstack
- zksync-era_zkstack
image: matterlabs/witness-generator:latest
command: ["--round", "scheduler"]
env_file:
Expand All @@ -108,27 +115,69 @@ services:
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}
zkstack-prover-fri:

zkstack-proof-fri-compressor:
networks:
- zkstack
image: matterlabs/prover-fri:latest
- zksync-era_zkstack
image: matterlabs/proof-fri-compressor:latest
env_file:
- {{envFilePath}}
# ports: # assumes default ports in .env
# - "3312:3312" # prometheus metrics
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}
zkstack-proof-fri-compressor:
witness-vector-generator:
networks:
- zkstack
image: matterlabs/proof-fri-compressor:latest
- zksync-era_zkstack
image: matterlabs/witness-vector-generator:latest
restart: always
env_file:
- {{envFilePath}}
deploy:
mode: replicated
replicas: {{witnessVectorGensCount}}
# ports: # assumes default ports in .env
# - "3312:3312" # prometheus metrics
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}
{{/if}}

{{#ifAnd hasProver hasCPUProver}}
zkstack-prover-cpu-fri:
networks:
- zksync-era_zkstack
image: matterlabs/prover-fri:latest
env_file:
- {{envFilePath}}
# - "3312:3312" # prometheus metrics
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}
{{/ifAnd}}
{{#ifAnd hasProver hasGPUProver}}
zkstack-prover-gpu-fri:
networks:
- zksync-era_zkstack
{{#if needBuildProver}}
build: # Needed for anything that is not NVIDIA CUDA_ARCH 89
dockerfile: ./docker/prover-gpu-fri/Dockerfile
args:
CUDA_ARCH: {{cudaArch}}
{{else}}
image: matterlabs/prover-gpu-fri:latest # Only works for NVIDIA CUDA_ARCH 89
{{/if}}
env_file:
- {{envFilePath}}
# - "3312:3312" # prometheus metrics
volumes:
- artifacts:{{artifactsPath}}
- {{proverSetupArtifacts}}:{{proverSetupArtifacts}}
security_opt: # HACK: Might work on vanilla Ubuntu distros without this
- seccomp:unconfined
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]
{{/ifAnd}}
Loading

0 comments on commit c7d4315

Please sign in to comment.