core::arch::nvptx

Function vprintf

Source
pub unsafe extern "C" fn vprintf(
    format: *const u8,
    valist: *const c_void,
) -> i32
🔬This is a nightly-only experimental API. (stdarch_nvptx #111199)
Available on target_arch="nvptx64" only.
Expand description

Print formatted output from a kernel to a host-side output stream.

Syscall arguments:

  • status: The status value that is returned by vprintf.
  • format: A pointer to the format specifier input (uses common printf format).
  • valist: A pointer to the valist input.
#[repr(C)]
struct PrintArgs(f32, f32, f32, i32);

vprintf(
    "int(%f + %f) = int(%f) = %d\n".as_ptr(),
    transmute(&PrintArgs(a, b, a + b, (a + b) as i32)),
);

Sources: Programming Guide, PTX Interoperability.