Enum hwlocality::topology::editor::GroupChildFilter
source · pub enum GroupChildFilter<NormalFilter = fn(_: &TopologyObject) -> bool, MemoryFilter = fn(_: &TopologyObject) -> bool>{
Normal(NormalFilter),
Memory(MemoryFilter),
Mixed {
strict: bool,
normal: NormalFilter,
memory: MemoryFilter,
},
}
hwloc-2_3_0
only.Expand description
Callbacks that selects the members of a proposed group object
The basic workflow of TopologyEditor::insert_group_object()
is that you
first specify which topology object should be the parent of the newly
created group, and then you specify (using this enum and its inner
callbacks) which of the normal and memory children of this parent object
should become members of the newly created group.
However, as an extra complication, you must live with the fact that hwloc only supports groups whose normal and memory member lists follow the following consistency rules:
- If a memory object is a member of a group, then all normal objects which are attached to this memory object (as evidenced by their PUs being part of that memory object’s cpuset) must also be members of this group.
- Conversely, if all normal objects which are attached to a memory object are members of a group, then this memory object must also be made a member of this group.
Because following these rules by hand is unpleasant, we provide various shortcuts which allow you to only specify a subset of the group’s members, and let the remaining members required to follow the consistency rules be added to the group automatically.
Variants§
Normal(NormalFilter)
Pick the group’s normal children in the parent’s normal children list
Each normal child of the designated parent will be passed to the
provided callback, which will tell if this child should be made a member
of the group (true
) or not (false
), as in Iterator::filter()
.
Memory children will then be automatically added in order to produce a group member set that follows the consistency rules.
Due to a limitation of the Rust compiler, as of Rust 1.75 this type
constructor mistakenly requires you to specify a MemoryFilter
type
parameter. You can work around this by using the Self::normal()
constructor instead.
Memory(MemoryFilter)
Pick the group’s memory children in the parent’s memory children list
Works like Normal
, except the provided filter is used to select memory
children instead of normal children, and it is normal children that get
automatically added to follow the consistency rules.
Due to a limitation of the Rust compiler, as of Rust 1.75 this type
constructor mistakenly requires you to specify a NormalFilter
type
parameter. You can work around this by using the Self::memory()
constructor instead.
Mixed
Pick the group’s normal and memory children
The normal and memory children of the designated parent are
traversed and filtered using the normal
and memory
filters
respectively, as in the Normal
and Memory
cases.
The resulting normal and memory children sets may or may not be
subsequently expanded to follow the consistency rules, depending on the
value of the strict
flag.
Fields
strict: bool
Error out when normal
and memory
don’t pick consistent sets
If this flag isn’t set, then after the normal
and memory
callbacks have picked preliminary normal and memory children lists,
these normal and memory children lists are automatically expanded to
honor the consistency rules. This gives you the smallest valid hwloc
group that contains at least the children you asked for, at the
cost of possibly getting extra children that you did not expect,
which your code must handle gracefully.
If this flag is set, then you are responsible for picking normal and
memory children sets that honor the consistency rules, and
TopologyEditor::insert_group_object()
will fail if you don’t.
This is for situations where getting unexpected extra group members
is unacceptable, and you are ready to go through the burden of
applying the consistency rules yourself in order to avoid this
outcome.
normal: NormalFilter
Filter that selects the future group’s normal children amongst the
parent’s normal children list, as in Normal
memory: MemoryFilter
Filter that selects the future group’s memory children amongst the
parent’s memory children list, as in Memory
Implementations§
source§impl<NormalFilter> GroupChildFilter<NormalFilter, fn(_: &TopologyObject) -> bool>
impl<NormalFilter> GroupChildFilter<NormalFilter, fn(_: &TopologyObject) -> bool>
sourcepub fn normal(filter: NormalFilter) -> Self
pub fn normal(filter: NormalFilter) -> Self
Workaround for lack of default type parameter fallback when using the
Self::Normal
type constructor
source§impl<MemoryFilter> GroupChildFilter<fn(_: &TopologyObject) -> bool, MemoryFilter>
impl<MemoryFilter> GroupChildFilter<fn(_: &TopologyObject) -> bool, MemoryFilter>
sourcepub fn memory(filter: MemoryFilter) -> Self
pub fn memory(filter: MemoryFilter) -> Self
Workaround for lack of default type parameter fallback when using the
Self::Memory
type constructor
Trait Implementations§
source§impl<NormalFilter, MemoryFilter> Clone for GroupChildFilter<NormalFilter, MemoryFilter>where
NormalFilter: FnMut(&TopologyObject) -> bool + Clone,
MemoryFilter: FnMut(&TopologyObject) -> bool + Clone,
impl<NormalFilter, MemoryFilter> Clone for GroupChildFilter<NormalFilter, MemoryFilter>where
NormalFilter: FnMut(&TopologyObject) -> bool + Clone,
MemoryFilter: FnMut(&TopologyObject) -> bool + Clone,
source§fn clone(&self) -> GroupChildFilter<NormalFilter, MemoryFilter>
fn clone(&self) -> GroupChildFilter<NormalFilter, MemoryFilter>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more