-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_benchmark.sh
More file actions
executable file
·132 lines (114 loc) · 4.21 KB
/
run_benchmark.sh
File metadata and controls
executable file
·132 lines (114 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
set -e
# colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # no color
echo -e "${BLUE}clvm-zk backend benchmark runner${NC}"
echo "====================================="
echo
TESTED_BACKENDS=()
FAILED_BACKENDS=()
RISC0_AVAILABLE=false
if [ -f "./install-deps.sh" ]; then
if command -v cargo-risczero &> /dev/null || rustup target list --installed | grep -q riscv32im-unknown-none-elf; then
echo -e "${GREEN}✓${NC} risc0 dependencies available"
RISC0_AVAILABLE=true
else
echo -e "${YELLOW}⚠${NC} risc0 target not installed - run ./install-deps.sh"
fi
else
echo -e "${YELLOW}⚠${NC} install-deps.sh not found"
fi
SP1_AVAILABLE=false
if command -v cargo-prove &> /dev/null; then
echo -e "${GREEN}✓${NC} sp1 toolchain available"
SP1_AVAILABLE=true
else
echo -e "${YELLOW}⚠${NC} sp1 toolchain not available - run 'curl -L https://sp1.succinct.xyz | bash && sp1up'"
fi
# check if docker is available for plonk/groth16 modes
DOCKER_AVAILABLE=false
if command -v docker &> /dev/null; then
if docker info &> /dev/null 2>&1; then
echo -e "${GREEN}✓${NC} docker available (plonk/groth16 modes supported)"
DOCKER_AVAILABLE=true
else
echo -e "${YELLOW}⚠${NC} docker installed but not running - plonk/groth16 modes will be skipped"
echo " start docker: 'open -a Docker' (macOS) or 'sudo systemctl start docker' (linux)"
fi
else
echo -e "${YELLOW}⚠${NC} docker not installed - plonk/groth16 modes will be skipped"
echo " install docker: './install-deps.sh -d'"
fi
echo
# test risc0 backend
if [ "$RISC0_AVAILABLE" = true ]; then
echo -e "${BLUE}━━━ testing risc0 backend ━━━${NC}"
if cargo run --example backend_benchmark --features risc0 --no-default-features --release 2>&1; then
TESTED_BACKENDS+=("risc0")
echo -e "${GREEN}✓ risc0 test passed${NC}"
else
FAILED_BACKENDS+=("risc0")
echo -e "${RED}✗ risc0 test failed${NC}"
fi
echo
else
echo -e "${YELLOW}skipping risc0 (not available)${NC}"
echo
fi
# test sp1 backend in all modes
if [ "$SP1_AVAILABLE" = true ]; then
for MODE in core compressed; do
echo -e "${BLUE}━━━ testing sp1 backend ($MODE mode) ━━━${NC}"
if SP1_PROOF_MODE=$MODE cargo run --example backend_benchmark --features sp1 --no-default-features --release 2>&1; then
TESTED_BACKENDS+=("sp1-$MODE")
echo -e "${GREEN}✓ sp1 $MODE test passed${NC}"
else
FAILED_BACKENDS+=("sp1-$MODE")
echo -e "${RED}✗ sp1 $MODE test failed${NC}"
fi
echo
done
# test docker-based modes
if [ "$DOCKER_AVAILABLE" = true ]; then
for MODE in plonk groth16; do
echo -e "${BLUE}━━━ testing sp1 backend ($MODE mode) ━━━${NC}"
if SP1_PROOF_MODE=$MODE cargo run --example backend_benchmark --features sp1 --no-default-features --release 2>&1; then
TESTED_BACKENDS+=("sp1-$MODE")
echo -e "${GREEN}✓ sp1 $MODE test passed${NC}"
else
FAILED_BACKENDS+=("sp1-$MODE")
echo -e "${RED}✗ sp1 $MODE test failed${NC}"
fi
echo
done
else
echo -e "${YELLOW}skipping sp1 plonk/groth16 modes (docker required)${NC}"
echo
fi
else
echo -e "${YELLOW}skipping sp1 (not available)${NC}"
echo
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "${BLUE}benchmark summary${NC}"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "tested backends: ${#TESTED_BACKENDS[@]}"
echo -e "failed backends: ${#FAILED_BACKENDS[@]}"
if [ ${#TESTED_BACKENDS[@]} -gt 0 ]; then
echo -e "\n${GREEN}passed:${NC}"
for backend in "${TESTED_BACKENDS[@]}"; do
echo " ✓ $backend"
done
fi
if [ ${#FAILED_BACKENDS[@]} -gt 0 ]; then
echo -e "\n${RED}failed:${NC}"
for backend in "${FAILED_BACKENDS[@]}"; do
echo " ✗ $backend"
done
exit 1
fi
echo -e "\n${GREEN}all benchmarks passed!${NC}"