Skip to main content

launch_named

Macro launch_named 

Source
macro_rules! launch_named {
    ($kernel:expr, grid($g:expr), block($b:expr), shared($s:expr), $stream:expr, {
        $($name:ident : $val:expr),+ $(,)?
    }) => { ... };
    ($kernel:expr, grid($g:expr), block($b:expr), $stream:expr, {
        $($name:ident : $val:expr),+ $(,)?
    }) => { ... };
}
Expand description

Launch a GPU kernel with named argument syntax.

This macro strips the argument names at compile time and delegates to launch!, so there is zero runtime overhead versus the positional form.

§Syntax

launch_named!(kernel, grid(G), block(B), shared(S), stream, {
    name1: value1,
    name2: value2,
})?;

// Without explicit shared memory (defaults to 0):
launch_named!(kernel, grid(G), block(B), stream, {
    name1: value1,
    name2: value2,
})?;

§Examples

let n: u32 = 1024;
let a_ptr: u64 = 0;
let b_ptr: u64 = 0;
let c_ptr: u64 = 0;

launch_named!(kernel, grid(4u32), block(256u32), &stream, {
    n: n,
    a: a_ptr,
    b: b_ptr,
    c: c_ptr,
})?;