Skip to main content

LaunchGeometry

Struct LaunchGeometry 

Source
pub struct LaunchGeometry { /* private fields */ }
Expand description

Grid, block and dynamic shared-memory dimensions, independent of launch attributes.

Implementations§

Source§

impl LaunchGeometry

Source

pub fn create( grid_dim: Dim3, block_dim: Dim3, shared_memory_bytes: usize, ) -> Result<Self>

Creates nonzero grid and block dimensions with a representable shared-memory byte count.

Device and kernel limits are checked during preparation or by CUDA during submission.

§Errors

Returns an error for zero dimensions or a shared-memory byte count exceeding u32::MAX.

Source

pub const fn grid_dim(&self) -> Dim3

Returns the number of blocks along each grid axis.

Source

pub const fn block_dim(&self) -> Dim3

Returns the number of threads along each block axis.

Source

pub const fn shared_memory_bytes(&self) -> usize

Returns the dynamic shared-memory bytes per block.

Source

pub fn with_shared_memory_bytes( self, shared_memory_bytes: usize, ) -> Result<Self>

Replaces the dynamic shared-memory byte count.

§Errors

Returns an error if the byte count exceeds u32::MAX.

Source

pub fn try_for_1d_grid(element_count: usize, block_size: usize) -> Result<Self>

Creates a one-dimensional launch covering element_count elements with block_size threads per block.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_1d_grid(element_count: usize, block_size: usize) -> Self

Creates a one-dimensional launch covering element_count elements with block_size threads per block.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_1d_grid.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_1d_grid to handle these errors.

Source

pub fn try_for_num_elems( element_count: usize, block_size: usize, ) -> Result<Self>

Creates a one-dimensional launch covering element_count elements with block_size threads per block. Equivalent to Self::try_for_1d_grid.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_num_elems(element_count: usize, block_size: usize) -> Self

Creates a one-dimensional launch covering element_count elements with block_size threads per block. Equivalent to Self::try_for_1d_grid.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_num_elems.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_num_elems to handle these errors.

Source

pub fn try_for_2d_grid( width: usize, height: usize, block_width: usize, block_height: usize, ) -> Result<Self>

Creates a two-dimensional launch covering width by height elements with the supplied block width and height.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_2d_grid( width: usize, height: usize, block_width: usize, block_height: usize, ) -> Self

Creates a two-dimensional launch covering width by height elements with the supplied block width and height.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_2d_grid.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_2d_grid to handle these errors.

Source

pub fn try_for_3d_grid( width: usize, height: usize, depth: usize, block_width: usize, block_height: usize, block_depth: usize, ) -> Result<Self>

Creates a three-dimensional launch covering width by height by depth elements with the supplied block dimensions.

Each grid axis rounds up to a whole block. Dynamic shared memory starts at zero. Device and kernel limits are checked during preparation or submission.

§Errors

Returns Error::NotPositive if an element extent or block dimension is zero, or Error::OutOfRange if a computed grid dimension or supplied block dimension exceeds u32::MAX.

Source

pub fn for_3d_grid( width: usize, height: usize, depth: usize, block_width: usize, block_height: usize, block_depth: usize, ) -> Self

Creates a three-dimensional launch covering width by height by depth elements with the supplied block dimensions.

Uses the same rounding, shared-memory defaults, and validation as Self::try_for_3d_grid.

§Panics

Panics if an element extent or block dimension is zero, or if a computed grid dimension or supplied block dimension exceeds u32::MAX. Use Self::try_for_3d_grid to handle these errors.

Trait Implementations§

Source§

impl Clone for LaunchGeometry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LaunchGeometry

Source§

impl Debug for LaunchGeometry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for LaunchGeometry

Source§

impl From<LaunchGeometry> for LaunchConfig

Source§

fn from(geometry: LaunchGeometry) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for LaunchGeometry

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LaunchGeometry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.