1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Process-wide default-stream-semantics selector.
//!
//! The CUDA Driver API exposes two ABI-distinct variants of many functions
//! — one for "legacy default stream" semantics, one for "per-thread default
//! stream" — and the symbol you resolve through `cuGetProcAddress` depends
//! on which you ask for. baracuda treats the choice as a one-time process
//! decision: call [`init`] before the first driver call to override the
//! default, otherwise [`get`] returns [`StreamMode::PerThread`].
//!
//! See the NVIDIA programming guide's "Stream Synchronization Behavior"
//! section for the full semantic difference; the short version is that
//! PerThread is what every modern CUDA app wants.
use OnceLock;
pub use StreamMode;
static STREAM_MODE: = new;
/// Install the process-wide stream mode. Returns `Err` containing the mode
/// that was already installed if `init` (or [`get`]) was called earlier.
///
/// The expected call site is early in `main`, before any CUDA activity.
/// The currently-installed stream mode. If [`init`] has not been called, this
/// latches the default ([`StreamMode::PerThread`]) on first call.