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

Method dump_debug_dotfile

crates/cust/src/graph.rs:335–370  ·  view source on GitHub ↗
(&mut self, path: P)

Source from the content-addressed store, hash-verified

333 /// This dotfile can be turned into an image with graphviz.
334 #[cfg(any(windows, unix))]
335 pub fn dump_debug_dotfile<P: AsRef<Path>>(&mut self, path: P) -> CudaResult<()> {
336 // not currently present in cuda-driver-sys for some reason
337 extern "C" {
338 fn cuGraphDebugDotPrint(
339 hGraph: cuda::CUgraph,
340 path: *const c_char,
341 flags: c_uint,
342 ) -> cuda::CUresult;
343 }
344
345 let path = path.as_ref();
346 let mut buf = Vec::new();
347 #[cfg(unix)]
348 {
349 use std::os::unix::ffi::OsStrExt;
350 buf.extend(path.as_os_str().as_bytes());
351 buf.push(0);
352 }
353
354 #[cfg(windows)]
355 {
356 use std::os::windows::ffi::OsStrExt;
357 buf.extend(
358 path.as_os_str()
359 .encode_wide()
360 .chain(Some(0))
361 .map(|b| {
362 let b = b.to_ne_bytes();
363 b.get(0).copied().into_iter().chain(b.get(1).copied())
364 })
365 .flatten(),
366 );
367 }
368
369 unsafe { cuGraphDebugDotPrint(self.raw, "./out.dot\0".as_ptr().cast(), 1 << 0).to_result() }
370 }
371
372 /// Adds a kernel invocation node to this graph, [`KernelInvocation`] can be created using
373 /// [`kernel_invocation`] which uses the same syntax as [`launch`](crate::launch). This will

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
as_ptrMethod · 0.80
as_refMethod · 0.45
pushMethod · 0.45
getMethod · 0.45
to_resultMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected