rtx-cfd legacy GPU modules: cudarc 0.18 API — unsafe launches, the stream accessor, memcpy_htod argument order; the renamed k-ε constants and ::standard(); get_module clones; CfdConfig test 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 (ubuntu-latest) (push) Failing after 5s
CI / Clippy Check (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 6s
Documentation / Build API Documentation (push) Failing after 17s
CI / Build CPU-Only (Explicit) (push) Failing after 32s
CI / Format Check (push) Failing after 42s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m59s
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 (ubuntu-latest) (push) Failing after 5s
CI / Clippy Check (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 6s
Documentation / Build API Documentation (push) Failing after 17s
CI / Build CPU-Only (Explicit) (push) Failing after 32s
CI / Format Check (push) Failing after 42s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m59s
This commit is contained in:
@@ -68,7 +68,7 @@ impl KEpsilonGpuModel {
|
||||
|
||||
Ok(Self {
|
||||
kernel_manager,
|
||||
constants: KEpsilonConstants::default(),
|
||||
constants: KEpsilonConstants::standard(),
|
||||
k_epsilon_module: None,
|
||||
gpu_buffers: None,
|
||||
})
|
||||
@@ -89,7 +89,7 @@ impl KEpsilonGpuModel {
|
||||
fn load_k_epsilon_kernels(&mut self) -> CfdResult<()> {
|
||||
// In real implementation, would compile or load PTX for k-epsilon kernels
|
||||
// For now, load from kernel manager
|
||||
self.k_epsilon_module = Some(self.kernel_manager.get_module("k_epsilon_kernels")?);
|
||||
self.k_epsilon_module = Some(self.kernel_manager.get_module("k_epsilon_kernels")?.clone());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -140,12 +140,12 @@ impl KEpsilonGpuModel {
|
||||
let epsilon_host = vec![epsilon_init; n];
|
||||
|
||||
self.kernel_manager
|
||||
.stream
|
||||
.memcpy_htod(&mut buffers.k, &k_host)
|
||||
.stream()
|
||||
.memcpy_htod(&k_host, &mut buffers.k)
|
||||
.map_err(|e| CfdError::gpu_error(&format!("Failed to copy k to GPU: {}", e)))?;
|
||||
self.kernel_manager
|
||||
.stream
|
||||
.memcpy_htod(&mut buffers.epsilon, &epsilon_host)
|
||||
.stream()
|
||||
.memcpy_htod(&epsilon_host, &mut buffers.epsilon)
|
||||
.map_err(|e| CfdError::gpu_error(&format!("Failed to copy epsilon to GPU: {}", e)))?;
|
||||
|
||||
self.kernel_manager.synchronize()?;
|
||||
@@ -188,31 +188,33 @@ impl KEpsilonGpuModel {
|
||||
};
|
||||
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(u)
|
||||
.arg(v)
|
||||
.arg(w)
|
||||
.arg(&mut buffers.dudx)
|
||||
.arg(&mut buffers.dudy)
|
||||
.arg(&mut buffers.dudz)
|
||||
.arg(&mut buffers.dvdx)
|
||||
.arg(&mut buffers.dvdy)
|
||||
.arg(&mut buffers.dvdz)
|
||||
.arg(&mut buffers.dwdx)
|
||||
.arg(&mut buffers.dwdy)
|
||||
.arg(&mut buffers.dwdz)
|
||||
.arg(&dx)
|
||||
.arg(&dy)
|
||||
.arg(&dz)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Velocity gradients kernel launch failed: {}", e))
|
||||
})?;
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(u)
|
||||
.arg(v)
|
||||
.arg(w)
|
||||
.arg(&mut buffers.dudx)
|
||||
.arg(&mut buffers.dudy)
|
||||
.arg(&mut buffers.dudz)
|
||||
.arg(&mut buffers.dvdx)
|
||||
.arg(&mut buffers.dvdy)
|
||||
.arg(&mut buffers.dvdz)
|
||||
.arg(&mut buffers.dwdx)
|
||||
.arg(&mut buffers.dwdy)
|
||||
.arg(&mut buffers.dwdz)
|
||||
.arg(&dx)
|
||||
.arg(&dy)
|
||||
.arg(&dz)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Velocity gradients kernel launch failed: {}", e))
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
self.kernel_manager.synchronize()?;
|
||||
@@ -247,20 +249,22 @@ impl KEpsilonGpuModel {
|
||||
};
|
||||
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&buffers.k)
|
||||
.arg(&buffers.epsilon)
|
||||
.arg(&mut buffers.eddy_viscosity)
|
||||
.arg(&self.constants.c_mu)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Eddy viscosity kernel launch failed: {}", e))
|
||||
})?;
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&buffers.k)
|
||||
.arg(&buffers.epsilon)
|
||||
.arg(&mut buffers.eddy_viscosity)
|
||||
.arg(&self.constants.c_mu)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Eddy viscosity kernel launch failed: {}", e))
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
self.kernel_manager.synchronize()?;
|
||||
@@ -293,27 +297,29 @@ impl KEpsilonGpuModel {
|
||||
};
|
||||
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&buffers.eddy_viscosity)
|
||||
.arg(&buffers.dudx)
|
||||
.arg(&buffers.dudy)
|
||||
.arg(&buffers.dudz)
|
||||
.arg(&buffers.dvdx)
|
||||
.arg(&buffers.dvdy)
|
||||
.arg(&buffers.dvdz)
|
||||
.arg(&buffers.dwdx)
|
||||
.arg(&buffers.dwdy)
|
||||
.arg(&buffers.dwdz)
|
||||
.arg(&mut buffers.production)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Production kernel launch failed: {}", e))
|
||||
})?;
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&buffers.eddy_viscosity)
|
||||
.arg(&buffers.dudx)
|
||||
.arg(&buffers.dudy)
|
||||
.arg(&buffers.dudz)
|
||||
.arg(&buffers.dvdx)
|
||||
.arg(&buffers.dvdy)
|
||||
.arg(&buffers.dvdz)
|
||||
.arg(&buffers.dwdx)
|
||||
.arg(&buffers.dwdy)
|
||||
.arg(&buffers.dwdz)
|
||||
.arg(&mut buffers.production)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Production kernel launch failed: {}", e))
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
self.kernel_manager.synchronize()?;
|
||||
@@ -348,22 +354,24 @@ impl KEpsilonGpuModel {
|
||||
};
|
||||
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&buffers.k)
|
||||
.arg(&buffers.epsilon)
|
||||
.arg(&buffers.production)
|
||||
.arg(&mut buffers.source_epsilon)
|
||||
.arg(&self.constants.c_e1)
|
||||
.arg(&self.constants.c_e2)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Epsilon source kernel launch failed: {}", e))
|
||||
})?;
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&buffers.k)
|
||||
.arg(&buffers.epsilon)
|
||||
.arg(&buffers.production)
|
||||
.arg(&mut buffers.source_epsilon)
|
||||
.arg(&self.constants.c1_epsilon)
|
||||
.arg(&self.constants.c2_epsilon)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Epsilon source kernel launch failed: {}", e))
|
||||
})?;
|
||||
}
|
||||
}
|
||||
|
||||
self.kernel_manager.synchronize()?;
|
||||
@@ -400,25 +408,27 @@ impl KEpsilonGpuModel {
|
||||
};
|
||||
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&mut buffers.k)
|
||||
.arg(&mut buffers.epsilon)
|
||||
.arg(&buffers.k_old)
|
||||
.arg(&buffers.epsilon_old)
|
||||
.arg(&buffers.production)
|
||||
.arg(&buffers.source_epsilon)
|
||||
.arg(&buffers.eddy_viscosity)
|
||||
.arg(&dt)
|
||||
.arg(&nu)
|
||||
.arg(&self.constants.sigma_k)
|
||||
.arg(&self.constants.sigma_e)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| CfdError::gpu_error(&format!("Update kernel launch failed: {}", e)))?;
|
||||
unsafe {
|
||||
self.kernel_manager
|
||||
.stream()
|
||||
.launch_builder(&func)
|
||||
.arg(&mut buffers.k)
|
||||
.arg(&mut buffers.epsilon)
|
||||
.arg(&buffers.k_old)
|
||||
.arg(&buffers.epsilon_old)
|
||||
.arg(&buffers.production)
|
||||
.arg(&buffers.source_epsilon)
|
||||
.arg(&buffers.eddy_viscosity)
|
||||
.arg(&dt)
|
||||
.arg(&nu)
|
||||
.arg(&self.constants.sigma_k)
|
||||
.arg(&self.constants.sigma_epsilon)
|
||||
.arg(&(buffers.nx as i32))
|
||||
.arg(&(buffers.ny as i32))
|
||||
.arg(&(buffers.nz as i32))
|
||||
.launch(config)
|
||||
.map_err(|e| CfdError::gpu_error(&format!("Update kernel launch failed: {}", e)))?;
|
||||
}
|
||||
}
|
||||
|
||||
self.kernel_manager.synchronize()?;
|
||||
@@ -436,7 +446,7 @@ impl KEpsilonGpuModel {
|
||||
let mut eddy_viscosity_host = vec![0.0f32; n];
|
||||
|
||||
self.kernel_manager
|
||||
.stream
|
||||
.stream()
|
||||
.memcpy_dtoh(&mut eddy_viscosity_host, &buffers.eddy_viscosity)
|
||||
.map_err(|e| {
|
||||
CfdError::gpu_error(&format!("Failed to copy eddy viscosity from GPU: {}", e))
|
||||
|
||||
Reference in New Issue
Block a user