Skip to content

Commit 1e1459e

Browse files
committed
Fix grep pipefail in
bench_vs/run.sh by switching to sed
1 parent e9e9fbd commit 1e1459e

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

bench_vs/run.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,22 @@ with open(path, "wb") as fh:
257257
PY
258258
}
259259

260+
extract_proving_time() {
261+
sed -nE '/Proving time: [0-9.]+s/ {
262+
s/.*Proving time: ([0-9.]+)s.*/\1/
263+
p
264+
q
265+
}'
266+
}
267+
268+
extract_cycles() {
269+
sed -nE '/Cycles: [0-9]+/ {
270+
s/.*Cycles: ([0-9]+).*/\1/
271+
p
272+
q
273+
}'
274+
}
275+
260276
echo -e "${BOLD}=== Fibonacci Benchmark: Lambda VM vs SP1 v6 ===${NC}"
261277
echo -e "Series mode: ${YELLOW}${SERIES_MODE}${NC}"
262278
echo -e "Requested series: ${YELLOW}${SERIES[*]}${NC}"
@@ -379,8 +395,8 @@ run_one() {
379395
fi
380396
rm -f "$proof_file"
381397

382-
lambda_time=$(echo "$lambda_output" | grep -o 'Proving time: [0-9.]*s' | grep -o '[0-9.]*')
383-
lambda_cycles=$(echo "$lambda_output" | grep -o 'Cycles: [0-9]*' | grep -o '[0-9]*')
398+
lambda_time=$(printf "%s\n" "$lambda_output" | extract_proving_time)
399+
lambda_cycles=$(printf "%s\n" "$lambda_output" | extract_cycles)
384400
if [ -z "$lambda_time" ]; then
385401
echo -e " ${RED}[Lambda VM] FAILED: could not parse proving time${NC}"
386402
printf "%s\n" "$lambda_output"
@@ -411,8 +427,8 @@ run_one() {
411427
exit 1
412428
fi
413429

414-
sp1_time=$(grep -o 'Proving time: [0-9.]*s' "$sp1_output_file" | grep -o '[0-9.]*')
415-
sp1_cycles=$(grep -o 'Cycles: [0-9]*' "$sp1_output_file" | grep -o '[0-9]*')
430+
sp1_time=$(extract_proving_time < "$sp1_output_file")
431+
sp1_cycles=$(extract_cycles < "$sp1_output_file")
416432
if [ -z "$sp1_time" ] || [ -z "$sp1_cycles" ]; then
417433
echo -e " ${RED}[SP1 v6] FAILED: could not parse output${NC}"
418434
cat "$sp1_output_file"

0 commit comments

Comments
 (0)