pub struct ContextFlags { /* private fields */ }
Expand description
Bit flags for initializing the CUDA context.
If you’re not sure which flags to use, MAP_HOST | SCHED_AUTO
is a good default.
Implementations§
Source§impl ContextFlags
impl ContextFlags
Sourcepub const SCHED_SPIN: ContextFlags
pub const SCHED_SPIN: ContextFlags
Instructs CUDA to actively spin when waiting for results from the GPU. This can decrease latency when waiting for the GPU, but may lower the performance of other CPU threads if they are performing work in parallel with the CUDA thread.
Sourcepub const SCHED_YIELD: ContextFlags
pub const SCHED_YIELD: ContextFlags
Instructs CUDA to yield its thread when waiting for results from the GPU. This can increase latency when waiting for the GPU, but can increase the performance of CPU threads performing work in parallel with the GPU.
Sourcepub const SCHED_BLOCKING_SYNC: ContextFlags
pub const SCHED_BLOCKING_SYNC: ContextFlags
Instructs CUDA to block the CPU thread on a synchronization primitive when waiting for the GPU to finish work.
Sourcepub const SCHED_AUTO: ContextFlags
pub const SCHED_AUTO: ContextFlags
Instructs CUDA to automatically choose whether to yield to other OS threads while waiting for the GPU, or to spin the OS thread. This is the default.
Sourcepub const MAP_HOST: ContextFlags
pub const MAP_HOST: ContextFlags
Instructs CUDA to support mapped pinned allocations. This flag must be set in order to use page-locked memory (see LockedBuffer).
Sourcepub const LMEM_RESIZE_TO_MAX: ContextFlags
pub const LMEM_RESIZE_TO_MAX: ContextFlags
Instruct CUDA not to reduce local memory after resizing local memory for a kernel. This can prevent thrashing by local memory allocations when launching many kernels with high local memory usage at the cost of potentially increased memory usage.
Sourcepub const fn empty() -> ContextFlags
pub const fn empty() -> ContextFlags
Returns an empty set of flags
Sourcepub const fn all() -> ContextFlags
pub const fn all() -> ContextFlags
Returns the set containing all flags.
Sourcepub fn from_bits(bits: u32) -> Option<ContextFlags>
pub fn from_bits(bits: u32) -> Option<ContextFlags>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Sourcepub const fn from_bits_truncate(bits: u32) -> ContextFlags
pub const fn from_bits_truncate(bits: u32) -> ContextFlags
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> ContextFlags
pub const unsafe fn from_bits_unchecked(bits: u32) -> ContextFlags
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Sourcepub const fn intersects(&self, other: ContextFlags) -> bool
pub const fn intersects(&self, other: ContextFlags) -> bool
Returns true
if there are flags common to both self
and other
.
Sourcepub const fn contains(&self, other: ContextFlags) -> bool
pub const fn contains(&self, other: ContextFlags) -> bool
Returns true
all of the flags in other
are contained within self
.
Sourcepub fn insert(&mut self, other: ContextFlags)
pub fn insert(&mut self, other: ContextFlags)
Inserts the specified flags in-place.
Sourcepub fn remove(&mut self, other: ContextFlags)
pub fn remove(&mut self, other: ContextFlags)
Removes the specified flags in-place.
Sourcepub fn toggle(&mut self, other: ContextFlags)
pub fn toggle(&mut self, other: ContextFlags)
Toggles the specified flags in-place.
Sourcepub fn set(&mut self, other: ContextFlags, value: bool)
pub fn set(&mut self, other: ContextFlags, value: bool)
Inserts or removes the specified flags depending on the passed value.
Trait Implementations§
Source§impl Binary for ContextFlags
impl Binary for ContextFlags
Source§impl BitAnd for ContextFlags
impl BitAnd for ContextFlags
Source§fn bitand(self, other: ContextFlags) -> ContextFlags
fn bitand(self, other: ContextFlags) -> ContextFlags
Returns the intersection between the two sets of flags.
Source§type Output = ContextFlags
type Output = ContextFlags
&
operator.Source§impl BitAndAssign for ContextFlags
impl BitAndAssign for ContextFlags
Source§fn bitand_assign(&mut self, other: ContextFlags)
fn bitand_assign(&mut self, other: ContextFlags)
Disables all flags disabled in the set.
Source§impl BitOr for ContextFlags
impl BitOr for ContextFlags
Source§fn bitor(self, other: ContextFlags) -> ContextFlags
fn bitor(self, other: ContextFlags) -> ContextFlags
Returns the union of the two sets of flags.
Source§type Output = ContextFlags
type Output = ContextFlags
|
operator.Source§impl BitOrAssign for ContextFlags
impl BitOrAssign for ContextFlags
Source§fn bitor_assign(&mut self, other: ContextFlags)
fn bitor_assign(&mut self, other: ContextFlags)
Adds the set of flags.
Source§impl BitXor for ContextFlags
impl BitXor for ContextFlags
Source§fn bitxor(self, other: ContextFlags) -> ContextFlags
fn bitxor(self, other: ContextFlags) -> ContextFlags
Returns the left flags, but with all the right flags toggled.
Source§type Output = ContextFlags
type Output = ContextFlags
^
operator.Source§impl BitXorAssign for ContextFlags
impl BitXorAssign for ContextFlags
Source§fn bitxor_assign(&mut self, other: ContextFlags)
fn bitxor_assign(&mut self, other: ContextFlags)
Toggles the set of flags.
Source§impl Clone for ContextFlags
impl Clone for ContextFlags
Source§fn clone(&self) -> ContextFlags
fn clone(&self) -> ContextFlags
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ContextFlags
impl Debug for ContextFlags
Source§impl Extend<ContextFlags> for ContextFlags
impl Extend<ContextFlags> for ContextFlags
Source§fn extend<T: IntoIterator<Item = ContextFlags>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = ContextFlags>>(&mut self, iterator: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl FromIterator<ContextFlags> for ContextFlags
impl FromIterator<ContextFlags> for ContextFlags
Source§fn from_iter<T: IntoIterator<Item = ContextFlags>>(iterator: T) -> ContextFlags
fn from_iter<T: IntoIterator<Item = ContextFlags>>(iterator: T) -> ContextFlags
Source§impl Hash for ContextFlags
impl Hash for ContextFlags
Source§impl LowerHex for ContextFlags
impl LowerHex for ContextFlags
Source§impl Not for ContextFlags
impl Not for ContextFlags
Source§fn not(self) -> ContextFlags
fn not(self) -> ContextFlags
Returns the complement of this set of flags.
Source§type Output = ContextFlags
type Output = ContextFlags
!
operator.Source§impl Octal for ContextFlags
impl Octal for ContextFlags
Source§impl Ord for ContextFlags
impl Ord for ContextFlags
Source§fn cmp(&self, other: &ContextFlags) -> Ordering
fn cmp(&self, other: &ContextFlags) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ContextFlags
impl PartialEq for ContextFlags
Source§impl PartialOrd for ContextFlags
impl PartialOrd for ContextFlags
Source§impl Sub for ContextFlags
impl Sub for ContextFlags
Source§fn sub(self, other: ContextFlags) -> ContextFlags
fn sub(self, other: ContextFlags) -> ContextFlags
Returns the set difference of the two sets of flags.
Source§type Output = ContextFlags
type Output = ContextFlags
-
operator.Source§impl SubAssign for ContextFlags
impl SubAssign for ContextFlags
Source§fn sub_assign(&mut self, other: ContextFlags)
fn sub_assign(&mut self, other: ContextFlags)
Disables all flags enabled in the set.