1"use strict";(self.webpackChunksuccinct_docs=self.webpackChunksuccinct_docs||[]).push([[6710],{28453:(e,n,r)=>{r.d(n,{R:()=>t,x:()=>c});var i=r(96540);const a={},o=i.createContext(a);function t(e){const n=i.useContext(o);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:t(e.components),i.createElement(o.Provider,{value:n},e.children)}},77576:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>s,contentTitle:()=>c,default:()=>h,frontMatter:()=>t,metadata:()=>i,toc:()=>l});const i=JSON.parse('{"id":"sp1/generating-proofs/hardware-acceleration","title":"Hardware Acceleration","description":"SP1 supports hardware acceleration through CUDA on Nvidia GPUs and AVX256/AVX512 on Intel x86 CPUs.","source":"@site/docs/sp1/generating-proofs/hardware-acceleration.md","sourceDirName":"sp1/generating-proofs","slug":"/sp1/generating-proofs/hardware-acceleration","permalink":"/docs/sp1/generating-proofs/hardware-acceleration","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{},"sidebar":"sp1Sidebar","previous":{"title":"Proof Types","permalink":"/docs/sp1/generating-proofs/proof-types"},"next":{"title":"Advanced","permalink":"/docs/sp1/generating-proofs/advanced"}}');var a=r(74848),o=r(28453);const t={},c="Hardware Acceleration",s={},l=[{value:"GPU Acceleration",id:"gpu-acceleration",level:2},{value:"Software Requirements",id:"software-requirements",level:3},{value:"Hardware Requirements",id:"hardware-requirements",level:3},{value:"Usage",id:"usage",level:3},{value:"Recommended Workflow",id:"recommended-workflow",level:3},{value:"CPU Acceleration",id:"cpu-acceleration",level:2},{value:"Checking for AVX Support",id:"checking-for-avx-support",level:3},{value:"Enabling AVX256 Acceleration",id:"enabling-avx256-acceleration",level:3},{value:"Enabling AVX512 Acceleration",id:"enabling-avx512-acceleration",level:3}];function d(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.header,{children:(0,a.jsx)(n.h1,{id:"hardware-acceleration",children:"Hardware Acceleration"})}),"\n",(0,a.jsxs)(n.p,{children:["SP1 supports hardware acceleration through ",(0,a.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/CUDA",children:"CUDA"})," on Nvidia GPUs and ",(0,a.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Advanced_Vector_Extensions",children:"AVX256/AVX512"})," on Intel x86 CPUs."]}),"\n",(0,a.jsx)(n.h2,{id:"gpu-acceleration",children:"GPU Acceleration"}),"\n",(0,a.jsxs)(n.p,{children:["SP1 supports GPU acceleration with ",(0,a.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/CUDA",children:"CUDA"}),", which can provide dramatically better latency and cost performance compared to using the CPU prover, even with AVX acceleration."]}),"\n",(0,a.jsx)(n.h3,{id:"software-requirements",children:"Software Requirements"}),"\n",(0,a.jsx)(n.p,{children:"Please make sure you have the following before using the CUDA prover:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsx)(n.li,{children:"Linux x86_64"}),"\n",(0,a.jsxs)(n.li,{children:["The ",(0,a.jsx)(n.a,{href:"https://developer.nvidia.com/cuda-downloads",children:"CUDA 12 runtime"})," and a compatible NVIDIA driver"]}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["The CUDA prover runs as a native ",(0,a.jsx)(n.code,{children:"sp1-gpu-server"})," binary that the SDK downloads and manages automatically. Docker and the NVIDIA Container Toolkit are no longer required."]}),"\n",(0,a.jsx)(n.h3,{id:"hardware-requirements",children:"Hardware Requirements"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"CPU"}),": We recommend having at least 4 CPU cores with 16GB of RAM available to fully utilize the GPU."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"GPU"}),": 24GB or more VRAM."]}),"\n"]}),"\n",(0,a.jsx)(n.admonition,{type:"warning",children:(0,a.jsxs)(n.p,{children:["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 ",(0,a.jsx)(n.a,{href:"https://developer.nvidia.com/cuda-gpus",children:"on this table in the NVIDIA documentation"}),"."]})}),"\n",(0,a.jsx)(n.h3,{id:"usage",children:"Usage"}),"\n",(0,a.jsx)(n.p,{children:"To use the CUDA prover, you have two options:"}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["Use ",(0,a.jsx)(n.code,{children:"ProverClient::from_env"})," to build the client and set the ",(0,a.jsx)(n.code,{children:"SP1_PROVER"})," environment variable to ",(0,a.jsx)(n.code,{children:"cuda"}),"."]}),"\n",(0,a.jsxs)(n.li,{children:["Use ",(0,a.jsx)(n.code,{children:"ProverClient::builder().cuda().build()"})," to build the client."]}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["Then, use your standard methods on the ",(0,a.jsx)(n.code,{children:"ProverClient"})," to generate proofs."]}),"\n",(0,a.jsx)(n.h3,{id:"recommended-workflow",children:"Recommended Workflow"}),"\n",(0,a.jsxs)(n.p,{children:["By default, the CUDA prover uses the ",(0,a.jsx)(n.code,{children:"0th"})," GPU. To target a different device, pass the device id to the builder: ",(0,a.jsx)(n.code,{children:"ProverClient::builder().cuda().with_device_id(1).build()"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["In general, the best practice is to keep an instance of a ",(0,a.jsx)(n.code,{children:"ProverClient"})," in an ",(0,a.jsx)(n.code,{children:"Arc"})," as they have initialization overhead."]}),"\n",(0,a.jsx)(n.h2,{id:"cpu-acceleration",children:"CPU Acceleration"}),"\n",(0,a.jsxs)(n.p,{children:["SP1 can achieve significant CPU performance improvements through ",(0,a.jsx)(n.a,{href:"https://en.wikipedia.org/wiki/Advanced_Vector_Extensions",children:"AVX vector instruction extensions"}),".\nSupport for both AVX256 and AVX512 acceleration on Intel x86 CPUs is provided via ",(0,a.jsx)(n.a,{href:"https://github.com/Plonky3/Plonky3",children:"Plonky3"}),".\nFor optimal performance, we recommend using AVX512 acceleration when your hardware supports it."]}),"\n",(0,a.jsx)(n.h3,{id:"checking-for-avx-support",children:"Checking for AVX Support"}),"\n",(0,a.jsx)(n.p,{children:"To verify if your CPU supports AVX, run:"}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.code,{children:"grep avx /proc/cpuinfo"})}),"\n",(0,a.jsxs)(n.p,{children:["Look for the flags ",(0,a.jsx)(n.code,{children:"avx2"})," and ",(0,a.jsx)(n.code,{children:"avx512"})," in the output."]}),"\n",(0,a.jsx)(n.h3,{id:"enabling-avx256-acceleration",children:"Enabling AVX256 Acceleration"}),"\n",(0,a.jsxs)(n.p,{children:["To enable AVX256 acceleration, set the ",(0,a.jsx)(n.code,{children:"RUSTFLAGS"})," environment variable:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:'RUSTFLAGS="-C target-cpu=native" cargo run --release\n'})}),"\n",(0,a.jsx)(n.h3,{id:"enabling-avx512-acceleration",children:"Enabling AVX512 Acceleration"}),"\n",(0,a.jsx)(n.p,{children:"For even better performance with AVX512, use:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:'RUSTFLAGS="-C target-cpu=native -C target-feature=+avx512f" cargo run --release\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Note that the ",(0,a.jsx)(n.code,{children:"+avx512f"})," flag is required to enable AVX512 acceleration."]})]})}function h(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(d,{...e})}):d(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.