pub struct LaunchParamsBuilder { /* private fields */ }Expand description
Builder for LaunchParams.
Provides a fluent interface for constructing launch parameters.
If grid or block dimensions are not set, they default to Dim3::x(1).
§Examples
use oxicuda_launch::{LaunchParams, Dim3};
let params = LaunchParams::builder()
.grid((4u32, 4u32))
.block(256u32)
.shared_mem(1024)
.build();
assert_eq!(params.grid, Dim3::xy(4, 4));
assert_eq!(params.block, Dim3::x(256));
assert_eq!(params.shared_mem_bytes, 1024);Implementations§
Source§impl LaunchParamsBuilder
impl LaunchParamsBuilder
Sourcepub fn grid(self, dim: impl Into<Dim3>) -> Self
pub fn grid(self, dim: impl Into<Dim3>) -> Self
Sets the grid dimensions (number of thread blocks).
Accepts anything that converts to Dim3.
Sourcepub fn block(self, dim: impl Into<Dim3>) -> Self
pub fn block(self, dim: impl Into<Dim3>) -> Self
Sets the block dimensions (threads per block).
Accepts anything that converts to Dim3.
Sets the dynamic shared memory allocation in bytes.
Sourcepub fn build(self) -> LaunchParams
pub fn build(self) -> LaunchParams
Builds the LaunchParams.
If grid or block dimensions were not set, they default to
Dim3::x(1) (a single block or a single thread).
Trait Implementations§
Source§impl Debug for LaunchParamsBuilder
impl Debug for LaunchParamsBuilder
Source§impl Default for LaunchParamsBuilder
impl Default for LaunchParamsBuilder
Source§fn default() -> LaunchParamsBuilder
fn default() -> LaunchParamsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LaunchParamsBuilder
impl RefUnwindSafe for LaunchParamsBuilder
impl Send for LaunchParamsBuilder
impl Sync for LaunchParamsBuilder
impl Unpin for LaunchParamsBuilder
impl UnsafeUnpin for LaunchParamsBuilder
impl UnwindSafe for LaunchParamsBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more