rtx-cfd CUDA Poisson kernels: solve ∇²φ = f as documented (the updates subtracted the source with the wrong sign); the Jacobi test's stop is absolute on a source of size 2π²
CI / Build (macos-latest) (push) Waiting to run
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Distributed Training Tests (push) Blocked by required conditions
CI / CI Success (push) Blocked by required conditions
Documentation / Build API Documentation (push) Failing after 5s
CI / Build CPU-Only (Explicit) (push) Failing after 6s
CI / Build (ubuntu-latest) (push) Failing after 7s
Documentation / Build User Guide (push) Successful in 6s
CI / Format Check (push) Failing after 13s
CI / Clippy Check (push) Failing after 36s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m42s

This commit is contained in:
Omar Sobh
2026-09-16 07:34:28 -05:00
parent 52fd40f8f2
commit eba2f61ddf
2 changed files with 5 additions and 5 deletions
@@ -38,7 +38,7 @@ extern "C" __global__ void poisson_jacobi_2d(
// Jacobi iteration: φ^{k+1}_ij = factor * (source_ij + (1/dx²)(φ_{i+1,j} + φ_{i-1,j}) + (1/dy²)(φ_{i,j+1} + φ_{i,j-1}))
phi_new[idx] = factor * (
source[idx] +
-source[idx] +
dx2_inv * (phi[idx_ip1] + phi[idx_im1]) +
dy2_inv * (phi[idx_jp1] + phi[idx_jm1])
);
@@ -76,7 +76,7 @@ extern "C" __global__ void poisson_gauss_seidel_2d(
// Gauss-Seidel update (in-place)
phi[idx] = factor * (
source[idx] +
-source[idx] +
dx2_inv * (phi[idx_ip1] + phi[idx_im1]) +
dy2_inv * (phi[idx_jp1] + phi[idx_jm1])
);
@@ -116,7 +116,7 @@ extern "C" __global__ void poisson_sor_2d(
// Compute Gauss-Seidel update
float phi_gs = factor * (
source[idx] +
-source[idx] +
dx2_inv * (phi[idx_ip1] + phi[idx_im1]) +
dy2_inv * (phi[idx_jp1] + phi[idx_jm1])
);
@@ -195,7 +195,7 @@ extern "C" __global__ void poisson_jacobi_3d(
// 3D Jacobi iteration
phi_new[idx] = factor * (
source[idx] +
-source[idx] +
dx2_inv * (phi[idx_ip1] + phi[idx_im1]) +
dy2_inv * (phi[idx_jp1] + phi[idx_jm1]) +
dz2_inv * (phi[idx_kp1] + phi[idx_km1])
@@ -213,7 +213,7 @@ mod cuda_tests {
// Jacobi needs O(n²) sweeps on this grid and its residual floor in f32 sits
// above 1e-6; the accuracy check below is the pin, the stop is loose.
let max_iterations = 20_000;
let tolerance = 1e-4;
let tolerance = 1e-2; // absolute, on a source of size 2π²
let iterations = poisson_kernel.solve_2d(
&mut d_phi,
&d_source,