Repository navigation
Add OpenCL + CUDA GPU wind-tunnel solvers - #2
Merged
Merged
Conversation
…ples GPU acceleration for the 3D wind tunnel via bespoke device-kernel solvers (the forEachIndex seam is CPU-only and cannot dispatch a host lambda to a device). - WindTunnelOpenCL: porous convex-blend collide + stream_bc kernels, populations resident on the device (ping-pong), fp64 host read-back. Validated on Apple M2 Max vs the fp64 CPU WindTunnel3D oracle (Linf/Uin ~ 1e-5, deterministic, no-slip preserved); ~1.35 GLUPS. cmake/CyberfluidsOpenCL.cmake + test. - WindTunnelCuda: line-for-line CUDA mirror of the validated OpenCL kernels; compiled and validated on an NVIDIA machine (-DCYBERFLUIDS_CUDA=ON). Test skips cleanly without a device. - Docs/spec: correct docs/backends.md and the hardware-backends spec — the forEachIndex seam is CPU-only; GPU acceleration is bespoke device-kernel solvers validated against the CPU oracle. - Swift WindTunnel wrapper (parity with the Python class) + README Python/Swift wind-tunnel-from-STL examples. Default build (all GPU flags OFF) is unaffected. Full suite 37/37 with OpenCL on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Real GPU acceleration for the 3D wind tunnel, plus the Swift binding and README examples.
Key finding this addresses: the
forEachIndex(n, f)backend seam takes a host lambda andcannot dispatch to a GPU (the
gpu_stubs.hppstructs just ran it serially on the CPU). GPUacceleration is therefore implemented as bespoke device-kernel solvers, validated against
the fp64 CPU
WindTunnel3Doracle.What's included
WindTunnelOpenCL):collide+stream_bcdevice kernels,populations resident on the GPU (ping-pong buffers), fp64 host read-back. Validated on an
Apple M2 Max:
Linf/Uin ≈ 1e-5vs the CPU oracle, deterministic, no-slip preserved;~1.35 GLUPS (≈290× the serial macOS CPU path — the honest metric is the GPU throughput).
WindTunnelCuda): line-for-line translation of the OpenCL kernels; authoredhere, compiled + validated on an NVIDIA machine (
-DCYBERFLUIDS_CUDA=ON).forEachIndexis CPU-only; GPU = device-kernel solvers.WindTunnelwrapper (parity with Python) + README Python/Swift STL examples.Validation
-DCYBERFLUIDS_OPENCL=ON(incl.opencl_wind_tunnel).ctest -R cuda_wind_tunnelon an NVIDIA box (skips cleanly without a device).Notes
add-gpu-wind-tunnelOpenSpec change is still active (adversarial review + CUDA-machinevalidation pending); it will be archived in a follow-up.