
Short and honest: there isn’t a one‑click, end‑to‑end GPU OpenFOAM yet. You can still get real wins by moving the linear solver onto the GPU with mature libraries. This page shows you what’s stable, what’s experimental, and how to try it on GPU computing services without sinking time.
Works today (production‑ish)
Active/experimental
Reality check
fvSolution to PETSc and choose a GPU‑capable preconditioner.Sketch
# inside the running container
nvidia-smi
# Build PETSc (double precision, release, CUDA as example)
./configure \
--with-cuda=1 --with-cudac=nvcc \
--with-precision=double --with-debugging=0 \
--download-hypre
make all
# Build the OpenFOAM external-solver (petsc4Foam)
# (follow your OpenFOAM distribution’s module build steps)
system/fvSolution** (pattern)**
solvers
{
p
{
// Keep your tolerances
tolerance 1e-7;
relTol 0.01;
// Load PETSc external solver
externalSolverLibs ("libpetscFoam.so");
externalSolver PETSc;
// PETSc options (example — tune for your case)
// e.g., CG + AMG preconditioner with GPU backend
// petscOptions "-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg";
}
}
Exact names/paths differ by OpenFOAM distro and module version. Keep the idea: load the external solver library, select PETSc, and pass PETSc options that use your GPU backend.
fvSolution** (pattern)**
solvers
{
p
{
tolerance 1e-7;
relTol 0.01;
externalSolverLibs ("libamgx4Foam.so");
externalSolver AmgX;
amgxConfig "system/amgx.json";
}
}
system/amgx.json** (minimal idea)**
{
"config_version": 2,
"determinism_flag": 1,
"solver": {
"preconditioner": { "algorithm": "AMG", "max_iters": 2 },
"solver": "PCG", "max_iters": 100, "convergence": "RELATIVE_RESIDUAL", "tolerance": 1e-7
}
}
Start conservative; then tune (cycles, smoother, coarsening) on a small mesh.
Good candidates
Poor candidates
case: solver, mesh (cells), physics, time step/iterations
backend: PETSc|AmgX|Ginkgo + options
metrics: wall time, solver time %, iterations/step, residual history, peak VRAM
hardware: GPU model/VRAM, driver, CUDA; CPU model/threads
Cost per converged case
cost_per_case = price_per_hour × wall_hours
Log the exact PETSc/AmgX options and the library versions in your Methods.
GPU idle / no speedup
Linear solve isn’t dominant, or the preconditioner is a poor fit. Profile where time goes and tune the backend.
OOM (VRAM)
Reduce mesh or switch to a larger‑VRAM profile. Check workspace settings in your backend.
“Unknown external solver / missing library”
Library not found. Confirm externalSolverLibs path and that the module was built for your OpenFOAM version.
Unstable/slow convergence
Try different AMG parameters or switch KSP/PC types. Validate vs a CPU baseline.
hardware:
gpu: "<model> (<VRAM> GB)"
driver: "<NVIDIA/AMD/Intel driver>"
cuda_hip_sycl: "<version>"
software:
openfoam: "<distro + version>"
backend: "PETSc|AmgX|Ginkgo (<version>)"
case:
mesh_cells: <...>
solver: "<simpleFoam | pisoFoam | ...>"
run:
fvSolution:
externalSolverLibs: ["libpetscFoam.so"]
externalSolver: "PETSc"
options: "-ksp_type cg -pc_type hypre -pc_hypre_type boomeramg"
outputs:
wall_hours: "<hh:mm>"
solver_share: "<% time in linear solve>"
iters_per_step: "<…>"
notes: "matrix format, precision, any deviations"
Scientific modeling on cloud GPUs — what works, what doesn’t
Start a GPU instance with a CUDA-ready template (e.g., Ubuntu 24.04 LTS / CUDA 12.6) or your own GROMACS image. Enjoy flexible per-second billing with custom templates and the ability to start, stop, and resume your sessions at any time. Unsure about FP64 requirements? Contact support to help you select the ideal hardware profile for your computational needs.