MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / available_dynamic_shared_memory_per_block

Method available_dynamic_shared_memory_per_block

crates/cust/src/function.rs:322–341  ·  view source on GitHub ↗

The amount of dynamic shared memory available per block when launching `blocks` on a streaming multiprocessor.

(
        &self,
        blocks: GridSize,
        block_size: BlockSize,
    )

Source from the content-addressed store, hash-verified

320 /// The amount of dynamic shared memory available per block when launching `blocks` on
321 /// a streaming multiprocessor.
322 pub fn available_dynamic_shared_memory_per_block(
323 &self,
324 blocks: GridSize,
325 block_size: BlockSize,
326 ) -> CudaResult<usize> {
327 let num_blocks = blocks.x * blocks.y * blocks.z;
328 let total_block_size = block_size.x * block_size.y * block_size.z;
329
330 let mut result = MaybeUninit::uninit();
331 unsafe {
332 cuda::cuOccupancyAvailableDynamicSMemPerBlock(
333 result.as_mut_ptr(),
334 self.to_raw(),
335 num_blocks as i32,
336 total_block_size as i32,
337 )
338 .to_result()?;
339 Ok(result.assume_init())
340 }
341 }
342
343 /// The maximum number of active blocks per streaming multiprocessor when this function
344 /// is launched with a specific `block_size` with some amount of dynamic shared memory.

Callers

nothing calls this directly

Calls 3

to_resultMethod · 0.45
as_mut_ptrMethod · 0.45
to_rawMethod · 0.45

Tested by

no test coverage detected