Hardware Acceleration
SP1 supports hardware acceleration through CUDA on Nvidia GPUs and AVX256/AVX512 on Intel x86 CPUs.
GPU Acceleration
SP1 supports GPU acceleration with CUDA, which can provide dramatically better latency and cost performance compared to using the CPU prover, even with AVX acceleration.
Software Requirements
Please make sure you have the following before using the CUDA prover:
- Linux x86_64
- The CUDA 12 runtime and a compatible NVIDIA driver
The CUDA prover runs as a native sp1-gpu-server binary that the SDK downloads and manages automatically. Docker and the NVIDIA Container Toolkit are no longer required.
Hardware Requirements
- CPU: We recommend having at least 4 CPU cores with 16GB of RAM available to fully utilize the GPU.
- GPU: 24GB or more VRAM.
SP1 supports GPUs with Compute Capability 8.0 or higher (e.g., A100, RTX 30/40 series, H100). You can find the compute capability for your GPU on this table in the NVIDIA documentation.
Usage
To use the CUDA prover, you have two options:
- Use
ProverClient::from_envto build the client and set theSP1_PROVERenvironment variable tocuda. - Use
ProverClient::builder().cuda().build()to build the client.
Then, use your standard methods on the ProverClient to generate proofs.
Recommended Workflow
By default, the CUDA prover uses the 0th GPU. To target a different device, pass the device id to the builder: ProverClient::builder().cuda().with_device_id(1).build().
In general, the best practice is to keep an instance of a ProverClient in an Arc as they have initialization overhead.
CPU Acceleration
SP1 can achieve significant CPU performance improvements through AVX vector instruction extensions. Support for both AVX256 and AVX512 acceleration on Intel x86 CPUs is provided via Plonky3. For optimal performance, we recommend using AVX512 acceleration when your hardware supports it.
Checking for AVX Support
To verify if your CPU supports AVX, run:
grep avx /proc/cpuinfo
Look for the flags avx2 and avx512 in the output.
Enabling AVX256 Acceleration
To enable AVX256 acceleration, set the RUSTFLAGS environment variable:
RUSTFLAGS="-C target-cpu=native" cargo run --release
Enabling AVX512 Acceleration
For even better performance with AVX512, use:
RUSTFLAGS="-C target-cpu=native -C target-feature=+avx512f" cargo run --release
Note that the +avx512f flag is required to enable AVX512 acceleration.