Skip to content

Commit ef239ee

Browse files
committed
adapt the benchmark script for sp1
1 parent 0d6f081 commit ef239ee

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

benchmark-sp1-cuda.sh

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,44 @@ echo "╚═══════════════════════
1111
echo
1212

1313
# Check if CUDA is available
14-
if command -v nvidia-smi &> /dev/null; then
15-
echo "✅ NVIDIA GPU detected:"
16-
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
17-
echo
18-
else
19-
echo "⚠️ No NVIDIA GPU detected. Will run on CPU."
20-
echo
14+
if ! command -v nvidia-smi &> /dev/null; then
15+
echo "❌ No NVIDIA GPU detected. This script requires a GPU."
16+
echo " Please run on a GPU-enabled instance."
17+
exit 1
2118
fi
2219

23-
# Set environment variables for optimal SP1 performance
20+
echo "✅ NVIDIA GPU detected:"
21+
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
22+
echo
23+
24+
# Set environment variables for SP1 CUDA proving
25+
export SP1_PROVER=cuda
26+
export CUDA_VISIBLE_DEVICES=0
2427
export RUST_LOG=info
28+
export SP1_CUDA=1
29+
export RUSTFLAGS="-C target-cpu=native -C target-feature=+avx2"
30+
31+
echo "🎯 SP1 CUDA environment configured:"
32+
echo " SP1_PROVER=$SP1_PROVER"
33+
echo " CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"
34+
echo " SP1_CUDA=$SP1_CUDA"
35+
echo
2536

2637
echo "🔨 Building SP1 guest program..."
2738
cd crates/sp1/guest
2839
cargo prove build
2940
cd ../../..
3041

31-
echo "📦 Building SP1 host with CUDA support..."
32-
cargo build --release --features cuda -p sp1-host
42+
echo "📦 Building SP1 host for CUDA..."
43+
cargo build --release -p sp1-host
3344

3445
echo
35-
echo "🚀 Running benchmarks with CUDA acceleration..."
46+
echo "🚀 Running benchmarks..."
3647
echo " Sample size: 10 iterations per benchmark"
3748
echo
3849

3950
# Run the Criterion benchmark
40-
cargo bench --features cuda -p sp1-host
51+
cargo bench -p sp1-host
4152

4253
echo
4354
echo "📊 Benchmark results saved to:"

0 commit comments

Comments
 (0)