diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..186441faaf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +docker/ +target/ diff --git a/Makefile b/Makefile index 22ae46e0c7..74fe722647 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/docker/testool/gpu/Dockerfile b/docker/testool/gpu/Dockerfile new file mode 100644 index 0000000000..d0ba081119 --- /dev/null +++ b/docker/testool/gpu/Dockerfile @@ -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 diff --git a/docker/testool/gpu/docker-compose.yml b/docker/testool/gpu/docker-compose.yml new file mode 100644 index 0000000000..048c3b55f9 --- /dev/null +++ b/docker/testool/gpu/docker-compose.yml @@ -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 diff --git a/testool/run_in_docker.sh b/testool/run_in_docker.sh new file mode 100755 index 0000000000..9730453bfa --- /dev/null +++ b/testool/run_in_docker.sh @@ -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