Struct hwlocality::memory::binding::MemoryBindingFlags
source · pub struct MemoryBindingFlags(/* private fields */);
Expand description
Memory binding flags.
These bit flags can be used to refine the binding policy. All flags can
be OR’ed together with the exception of the binding target flags
ASSUME_SINGLE_THREAD
, THREAD
and PROCESS
, of which at most one
must be specified. The most portable option is ASSUME_SINGLE_THREAD
,
when it is applicable.
When using one of the methods that target a process, you must use
exactly one of these flags. The most portable option is
ASSUME_SINGLE_THREAD
, when it is applicable. These
flags must not be used with any other method.
Individual memory binding methods may not support all of these flags. Please check the documentation of the memory binding method that you are calling for more information.
Implementations§
source§impl MemoryBindingFlags
impl MemoryBindingFlags
sourcepub const ASSUME_SINGLE_THREAD: Self = _
pub const ASSUME_SINGLE_THREAD: Self = _
Assume that the target process is single threaded
This lets hwloc pick between thread and process binding for increased portability.
This is mutually exclusive with PROCESS
and THREAD
.
sourcepub const PROCESS: Self = _
pub const PROCESS: Self = _
Apply command to all threads of the specified process
This is mutually exclusive with ASSUME_SINGLE_THREAD
and THREAD
.
sourcepub const THREAD: Self = _
pub const THREAD: Self = _
Apply command to the current thread of the current process
This is mutually exclusive with ASSUME_SINGLE_THREAD
and PROCESS
.
sourcepub const STRICT: Self = _
pub const STRICT: Self = _
Request strict binding from the OS
If this flag is set, a binding method will fail if the binding can not be guaranteed or completely enforced. Otherwise, hwloc will attempt to achieve an approximation of the requested binding (e.g. targeting more or less threads and NUMA nodes).
This flag has slightly different meanings depending on which method it is used with.
sourcepub const MIGRATE: Self = _
pub const MIGRATE: Self = _
Migrate existing allocated memory
If the memory cannot be migrated and the STRICT
flag is set, an
error will be returned.
This flag is only meaningful on operations that bind memory.
Requires MemoryBindingSupport::migrate_flag()
.
sourcepub const NO_CPU_BINDING: Self = _
pub const NO_CPU_BINDING: Self = _
Avoid any effect on CPU binding
On some operating systems, some underlying memory binding methods also bind the application to the corresponding CPU(s). Using this flag will cause hwloc to avoid using OS functions that could potentially affect CPU bindings.
Note, however, that using this flag may reduce hwloc’s overall memory binding support.
source§impl MemoryBindingFlags
impl MemoryBindingFlags
sourcepub const fn bits(&self) -> hwloc_membind_flags_t
pub const fn bits(&self) -> hwloc_membind_flags_t
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
sourcepub const fn from_bits(bits: hwloc_membind_flags_t) -> Option<Self>
pub const fn from_bits(bits: hwloc_membind_flags_t) -> Option<Self>
Convert from a bits value.
This method will return None
if any unknown bits are set.
sourcepub const fn from_bits_truncate(bits: hwloc_membind_flags_t) -> Self
pub const fn from_bits_truncate(bits: hwloc_membind_flags_t) -> Self
Convert from a bits value, unsetting any unknown bits.
sourcepub const fn from_bits_retain(bits: hwloc_membind_flags_t) -> Self
pub const fn from_bits_retain(bits: hwloc_membind_flags_t) -> Self
Convert from a bits value exactly.
sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Get a flags value with the bits of a flag with the given name set.
This method will return None
if name
is empty or doesn’t
correspond to any named flag.
sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
sourcepub fn remove(&mut self, other: Self)
pub fn remove(&mut self, other: Self)
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
remove
won’t truncate other
, but the !
operator will.
sourcepub fn toggle(&mut self, other: Self)
pub fn toggle(&mut self, other: Self)
The bitwise exclusive-or (^
) of the bits in two flags values.
sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Call insert
when value
is true
or remove
when value
is false
.
sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
The bitwise and (&
) of the bits in two flags values.
sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The bitwise or (|
) of the bits in two flags values.
sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
The bitwise exclusive-or (^
) of the bits in two flags values.
sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
The bitwise negation (!
) of the bits in a flags value, truncating the result.
source§impl MemoryBindingFlags
impl MemoryBindingFlags
sourcepub const fn iter(&self) -> Iter<MemoryBindingFlags>
pub const fn iter(&self) -> Iter<MemoryBindingFlags>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
sourcepub const fn iter_names(&self) -> IterNames<MemoryBindingFlags>
pub const fn iter_names(&self) -> IterNames<MemoryBindingFlags>
Yield a set of contained named flags values.
This method is like iter
, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Trait Implementations§
source§impl Arbitrary for MemoryBindingFlags
Available on crate feature proptest
only.
impl Arbitrary for MemoryBindingFlags
proptest
only.§type Parameters = ()
type Parameters = ()
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<Subsequence<MemoryBindingFlags>, fn(_: Vec<MemoryBindingFlags>) -> MemoryBindingFlags>
type Strategy = Map<Subsequence<MemoryBindingFlags>, fn(_: Vec<MemoryBindingFlags>) -> MemoryBindingFlags>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy
source§impl Binary for MemoryBindingFlags
impl Binary for MemoryBindingFlags
source§impl BitAnd for MemoryBindingFlags
impl BitAnd for MemoryBindingFlags
source§impl BitAndAssign for MemoryBindingFlags
impl BitAndAssign for MemoryBindingFlags
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
The bitwise and (&
) of the bits in two flags values.
source§impl BitOr for MemoryBindingFlags
impl BitOr for MemoryBindingFlags
source§fn bitor(self, other: MemoryBindingFlags) -> Self
fn bitor(self, other: MemoryBindingFlags) -> Self
The bitwise or (|
) of the bits in two flags values.
§type Output = MemoryBindingFlags
type Output = MemoryBindingFlags
|
operator.source§impl BitOrAssign for MemoryBindingFlags
impl BitOrAssign for MemoryBindingFlags
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
The bitwise or (|
) of the bits in two flags values.
source§impl BitXor for MemoryBindingFlags
impl BitXor for MemoryBindingFlags
source§impl BitXorAssign for MemoryBindingFlags
impl BitXorAssign for MemoryBindingFlags
source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
The bitwise exclusive-or (^
) of the bits in two flags values.
source§impl Clone for MemoryBindingFlags
impl Clone for MemoryBindingFlags
source§fn clone(&self) -> MemoryBindingFlags
fn clone(&self) -> MemoryBindingFlags
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MemoryBindingFlags
impl Debug for MemoryBindingFlags
source§impl Extend<MemoryBindingFlags> for MemoryBindingFlags
impl Extend<MemoryBindingFlags> for MemoryBindingFlags
source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
The bitwise or (|
) of the bits in each flags value.
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 Flags for MemoryBindingFlags
impl Flags for MemoryBindingFlags
source§const FLAGS: &'static [Flag<MemoryBindingFlags>] = _
const FLAGS: &'static [Flag<MemoryBindingFlags>] = _
source§fn bits(&self) -> hwloc_membind_flags_t
fn bits(&self) -> hwloc_membind_flags_t
source§fn from_bits_retain(bits: hwloc_membind_flags_t) -> MemoryBindingFlags
fn from_bits_retain(bits: hwloc_membind_flags_t) -> MemoryBindingFlags
source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|
) of the bits in two flags values.source§fn remove(&mut self, other: Self)where
Self: Sized,
fn remove(&mut self, other: Self)where
Self: Sized,
&!
). Read moresource§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^
) of the bits in two flags values.source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&
) of the bits in two flags values.source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
&!
). Read moresource§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^
) of the bits in two flags values.source§fn complement(self) -> Self
fn complement(self) -> Self
!
) of the bits in a flags value, truncating the result.source§impl<OwnedSet: OwnedSpecializedBitmap> From<MemoryBindingFlags> for MemoryBindingError<OwnedSet>
impl<OwnedSet: OwnedSpecializedBitmap> From<MemoryBindingFlags> for MemoryBindingError<OwnedSet>
source§fn from(value: MemoryBindingFlags) -> Self
fn from(value: MemoryBindingFlags) -> Self
source§impl FromIterator<MemoryBindingFlags> for MemoryBindingFlags
impl FromIterator<MemoryBindingFlags> for MemoryBindingFlags
source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
The bitwise or (|
) of the bits in each flags value.
source§impl Hash for MemoryBindingFlags
impl Hash for MemoryBindingFlags
source§impl IntoIterator for MemoryBindingFlags
impl IntoIterator for MemoryBindingFlags
source§impl LowerHex for MemoryBindingFlags
impl LowerHex for MemoryBindingFlags
source§impl Not for MemoryBindingFlags
impl Not for MemoryBindingFlags
source§impl Octal for MemoryBindingFlags
impl Octal for MemoryBindingFlags
source§impl PartialEq for MemoryBindingFlags
impl PartialEq for MemoryBindingFlags
source§fn eq(&self, other: &MemoryBindingFlags) -> bool
fn eq(&self, other: &MemoryBindingFlags) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PublicFlags for MemoryBindingFlags
impl PublicFlags for MemoryBindingFlags
source§impl Sub for MemoryBindingFlags
impl Sub for MemoryBindingFlags
source§fn sub(self, other: Self) -> Self
fn sub(self, other: Self) -> Self
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
§type Output = MemoryBindingFlags
type Output = MemoryBindingFlags
-
operator.source§impl SubAssign for MemoryBindingFlags
impl SubAssign for MemoryBindingFlags
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.