Function core::arch::nvptx::vprintf[][src]

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

将格式化的输出从内核打印到主机端输出流。

Syscall 参数:

  • status: vprintf 返回的状态值。
  • format: 指向格式说明符输入的指针 (使用通用 printf 格式)。
  • valist: 指向 valist 输入的指针。
#[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)),
);
Run

资料来源: 编程指南PTX Interoperability.