Skip to content

Commit

Permalink
Add testool GPU dockers. (scroll-tech#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
silathdiir authored Oct 25, 2023
1 parent 2e06a0f commit 3d1953d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker/
target/
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ stats_copy_circuit: # Print a table with Copy Circuit stats by ExecState/opcode
evm_exec_steps_occupancy: # Print a table for each EVM-CellManager CellType with the top 10 occupancy ExecutionSteps associated
@cargo test -p zkevm-circuits --release get_exec_steps_occupancy --features=test,warn-unimplemented -- --nocapture --ignored

.PHONY: clippy doc fmt test test_benches test-all evm_bench state_bench circuit_benches evm_exec_steps_occupancy stats_state_circuit stats_evm_circuit stats_copy_circuit help
testool_docker_build_inner_prove:
docker build --build-arg TESTOOL_FEATURE=inner-prove -f docker/testool/gpu/Dockerfile -t testool-inner-prove:v0.1 .

testool_docker_build_chunk_prove:
docker build --build-arg TESTOOL_FEATURE=chunk-prove -f docker/testool/gpu/Dockerfile -t testool-chunk-prove:v0.1 .

.PHONY: clippy doc fmt test test_benches test-all evm_bench state_bench circuit_benches evm_exec_steps_occupancy stats_state_circuit stats_evm_circuit stats_copy_circuit help testool_docker_build_inner_prove testool_docker_build_chunk_prove
33 changes: 33 additions & 0 deletions docker/testool/gpu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM scrolltech/cuda-go-rust-builder:cuda-11.7.1-go-1.19-rust-nightly-2022-12-10 as builder

ARG TESTOOL_FEATURE=inner-prove
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:$LD_LIBRARY_PATH
WORKDIR /src
ADD . /src
RUN mkdir /.cargo && echo 'paths = ["/src/halo2-gpu/halo2_proofs"]' > /.cargo/config
RUN cargo build --features $TESTOOL_FEATURE --release
Run cd ./target/release && find -name libzktrie.so | xargs -I {} cp {} ./
RUN apt update && apt install -y curl
RUN mkdir test_assets
RUN curl -o ./test_assets/layer1.config https://circuit-release.s3.us-west-2.amazonaws.com/release-v0.9.5/layer1.config
RUN curl -o ./test_assets/layer2.config https://circuit-release.s3.us-west-2.amazonaws.com/release-v0.9.5/layer2.config

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

ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:$LD_LIBRARY_PATH
ENV SCROLL_PROVER_ASSETS_DIR /opt/test_assets
ENV SCROLL_PROVER_PARAMS_DIR /opt/test_params
ENV RUST_MIN_STACK 100000000
ENV RUST_BACKTRACE 1
ENV RUST_LOG info
WORKDIR /opt
RUN apt update && apt install -y git
RUN mkdir -p /opt/configs /opt/report /opt/tests
COPY --from=builder /src/target/release/libzktrie.so /usr/local/lib/
COPY --from=builder /src/target/release/testool /bin/
COPY --from=builder /src/test_assets/ /opt/test_assets/
COPY --from=builder /src/testool/tests/ /opt/tests/
COPY --from=builder /src/testool/Config.toml /opt/
COPY --from=builder /src/testool/codehash.txt /opt/
COPY --from=builder /src/testool/test_ids.txt /opt/
COPY --from=builder /src/testool/run_in_docker.sh /opt/run_testool.sh
13 changes: 13 additions & 0 deletions docker/testool/gpu/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
testool:
image: {DOCKER_IMAGE}
runtime: nvidia
container_name: testool-gpu
environment:
- TESTOOL_IDS_LEN=${TESTOOL_IDS_LEN}
volumes:
- {PARAMS_DIR}:/opt/test_params
- {EXPORT_DIR}:/opt/export
- {REPORT_DIR}:/opt/report
command: ./run_testool.sh
27 changes: 27 additions & 0 deletions testool/run_in_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

index=""
if [ -e "export" ]; then
i=$(expr $(cat export | awk -F '=' '{print $2}') + 0)

offset=0
env_offset="TESTOOL_IDS_EXPORT_OFFSET"
if [ -n "${!env_offset}" ]; then
offset=$((env_offset))
fi
echo $offset

index="index-"$((offset + i))
fi
echo $index

start=""
env_start="TEST_IDS_START"
if [ -n "${!env_start}" ]; then
start="start-"$((env_start))
fi
echo $start

mkdir -p /opt/report/$index$start

testool --suite nightly --circuits sc --test-ids test_ids.txt --report > /opt/report/$index$start/run_test_ids.log 2>&1

0 comments on commit 3d1953d

Please sign in to comment.