Skip to main content

baracuda_runtime/
lib.rs

1//! Safe Rust wrappers for the CUDA Runtime API.
2//!
3//! The Runtime API is "higher level" than the Driver API: contexts are
4//! implicit (each device has a primary context the runtime uses
5//! automatically), kernels are typically linked at build time by `nvcc`,
6//! and most operations dispatch to the current thread's current device.
7//! baracuda-runtime mirrors the Driver-side types where it makes sense
8//! ([`Device`], [`Stream`], [`Event`], [`DeviceBuffer`]) and uses the
9//! CUDA 12.0+ library API ([`Library`], [`Kernel`]) for loading PTX at
10//! runtime — the Driver-API equivalent of `Module::load_ptx` +
11//! `Module::get_function`.
12//!
13//! # Driver ↔ Runtime interop
14//!
15//! `CUstream` and `cudaStream_t` are the same C type. With the
16//! `driver-interop` feature, `Stream::as_raw_driver()` and
17//! `Event::as_raw_driver()` return views usable by `baracuda-driver`
18//! APIs. See [`interop`].
19
20#![warn(missing_debug_implementations)]
21
22pub mod array;
23pub mod device;
24pub mod driver_entry;
25pub mod error;
26pub mod event;
27pub mod external;
28pub mod graph;
29pub mod graphics;
30pub mod green;
31pub mod init;
32pub mod ipc;
33pub mod launch;
34pub mod launch_attr;
35pub mod memcpy2d;
36pub mod memcpy3d;
37pub mod memory;
38pub mod mempool;
39pub mod module;
40pub mod multicast;
41pub mod profiler;
42pub mod query;
43pub mod stream;
44pub mod user_object;
45pub mod vmm;
46
47#[cfg(feature = "driver-interop")]
48pub mod interop;
49
50pub use device::Device;
51pub use error::{Error, Result};
52pub use event::Event;
53pub use graph::{CaptureMode, Graph, GraphExec, GraphNode, UpdateResult};
54pub use init::{
55    device_synchronize, driver_version, get_device_flags, last_error, peek_last_error,
56    runtime_version, set_device_flags,
57};
58pub use launch::{Dim3, LaunchBuilder};
59pub use memory::DeviceBuffer;
60pub use module::{Kernel, Library};
61pub use stream::Stream;