rtx-cfd legacy GPU tests: the current CudaKernelManager API (Arc-held manager, allocate-on-copy, copy_from_device returning the host vector), MatrixOpsKernel::tridiagonal_matvec added over the existing kernel, PoissonKernel::solve_jacobi_2d kept as the older name; CfdConfig literals take ..Default
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
CI / Build CPU-Only (Explicit) (push) Failing after 6s
CI / Build (ubuntu-latest) (push) Failing after 6s
Documentation / Build API Documentation (push) Failing after 6s
Documentation / Build User Guide (push) Successful in 7s
CI / Format Check (push) Failing after 13s
CI / Clippy Check (push) Failing after 37s
Performance Benchmarks / Run Benchmarks (push) Successful in 3m23s

This commit is contained in:
Omar Sobh
2026-09-16 07:18:34 -05:00
parent af19860c04
commit 1381b5b633
6 changed files with 109 additions and 48 deletions
@@ -601,6 +601,23 @@ impl PoissonKernel {
})
}
/// [`Self::solve_2d`] under its older name.
#[allow(clippy::too_many_arguments)]
pub fn solve_jacobi_2d(
&self,
phi: &mut CudaSlice<f32>,
source: &CudaSlice<f32>,
nx: usize,
ny: usize,
dx: f32,
dy: f32,
max_iterations: usize,
tolerance: f32,
) -> CfdResult<usize> {
self.solve_2d(phi, source, nx, ny, dx, dy, max_iterations, tolerance)
}
#[allow(clippy::too_many_arguments)]
pub fn solve_2d(
&self,
phi: &mut CudaSlice<f32>,
@@ -757,6 +774,39 @@ impl MatrixOpsKernel {
Ok(result)
}
/// `y = T x` for the tridiagonal matrix with `diagonal` (n) and
/// `off_diagonal` (n 1) — the `tridiagonal_matvec` kernel.
pub fn tridiagonal_matvec(
&self,
diagonal: &CudaSlice<f32>,
off_diagonal: &CudaSlice<f32>,
x: &CudaSlice<f32>,
y: &mut CudaSlice<f32>,
) -> CfdResult<()> {
let n = x.len();
let func = self
.module
.load_function("tridiagonal_matvec")
.map_err(|e| CfdError::gpu_error(&format!("Failed to get kernel: {}", e)))?;
let config = LaunchConfig {
grid_dim: ((n as u32 + 255) / 256, 1, 1),
block_dim: (256, 1, 1),
shared_mem_bytes: 0,
};
unsafe {
self.stream
.launch_builder(&func)
.arg(diagonal)
.arg(off_diagonal)
.arg(x)
.arg(y)
.arg(&(n as i32))
.launch(config)
.map_err(|e| CfdError::gpu_error(&format!("Kernel launch failed: {}", e)))?;
}
Ok(())
}
/// Compute L2 norm of vector
pub fn vector_norm(&self, x: &CudaSlice<f32>) -> CfdResult<f32> {
let n = x.len();