GPU vs CPU: choose a path¶
Use this page to decide whether you need a GPU build and how to run one successful GPU-capable binary without mixing toolchains.
Decision tree¶
flowchart TD
A[Start] --> B{Do you need CUDA or ROCm FFT / device-resident solves at scale?}
B -->|No| C[CPU tree: simpler, fewer moving parts]
B -->|Yes| D{Can you build HeFFTe with CUDA or HIP matching your toolkit?}
D -->|No| E[Fix HeFFTe + toolkit first — see INSTALL]
D -->|Yes| F[Separate GPU build directory + matching OpenPFC flags]
C --> G[mpirun CPU tungsten / examples]
F --> H[JSON backend + tungsten_cuda or tungsten_hip]
Stick to CPU if you are learning the framework, debugging physics, or your cluster does not expose GPUs consistently. The same spectral APIs exist; only the FFT backend and runtime differ.
Move to GPU when you have a HeFFTe build with CUDA or ROCm enabled that matches your
nvcc/ ROCm stack, and you use shipped GPU binaries (tungsten_cuda,tungsten_hip) or your own code paths that pull in device FFT.
Preconditions (all must align)¶
Piece |
Rule |
|---|---|
MPI |
Same implementation for OpenPFC, HeFFTe, and |
HeFFTe |
GPU-enabled build (e.g. |
OpenPFC |
|
Golden path (after CPU works)¶
Keep your working CPU tree (
build-cpu).Create
build-gpu(orbuild-hip) and configure with GPU flags + correctCMAKE_PREFIX_PATHto the GPU HeFFTe prefix (build_cpu_gpu.md).Run the GPU quickstart:
tutorials/gpu_app_quickstart.md(backendin JSON,tungsten_cuda/tungsten_hip).Compare log shapes to CPU:
example_run_output.md.
See also¶
build_options.md— CMake referenceINSTALL.LUMI.md— ROCm / LUMI-G examplespectral_stack.md— where FFT sits in the stack