pub enum Granularity {
Nodes(usize),
Arcs(u64),
}Expand description
Granularity of parallel tasks, specified transparently by nodes or arcs.
This enum provides a way to specify the granularity of parallel tasks on
graphs. It is used by
par_apply and
par_node_apply.
Some parallel implementations (e.g.,
par_node_apply)
express naturally the granularity of their tasks via a number of nodes,
whereas others (e.g.,
par_apply) via a
number of arcs. This enum allows to specify the granularity of parallel
tasks in a transparent way, by nodes or arcs. Conversion between the two
specifications is done by the methods
arc_granularity and
node_granularity.
Variants§
Nodes(usize)
Node granularity.
For node-based parallelism, each task will be formed by the specified number of nodes. For arc-based parallelism, each task will be formed by a number of nodes that has, tentatively, sum of outdegrees equal to the average outdegree multiplied by the specified number of nodes.
Arcs(u64)
Arc granularity.
For arc-based parallelism, each task will be formed by a number of nodes that has, tentatively, sum of outdegrees equal to the specified number of arcs. For node-based parallelism, each task will be formed by a number of nodes equal to the specified number of args divided by the average outdegree.
Implementations§
Source§impl Granularity
impl Granularity
Sourcepub fn node_granularity(&self, num_nodes: usize, num_arcs: Option<u64>) -> usize
pub fn node_granularity(&self, num_nodes: usize, num_arcs: Option<u64>) -> usize
Returns a node granularity for a given number of elements and threads.
For the variant Nodes, the specified number of nodes is
returned. For the variant Arcs, the number of nodes is
computed as the specified number of arcs divided by the average
outdegree.
§Panics
This method will panic if it needs to make a conversion from arc granularity to node granularity and the number of arcs is not provided.
Sourcepub fn arc_granularity(&self, num_nodes: usize, num_arcs: Option<u64>) -> usize
pub fn arc_granularity(&self, num_nodes: usize, num_arcs: Option<u64>) -> usize
Returns an arc granularity for a given number of nodes and arcs.
For the Arcs variant, the specified number of arcs is
returned. For the Nodes variant, the number of nodes is
computed as the specified number of arcs divided by the average degree.
§Panics
This method will panic if it needs to make a conversion from node granularity to arc granularity and the number of arcs is not provided.
Trait Implementations§
Source§impl Clone for Granularity
impl Clone for Granularity
Source§fn clone(&self) -> Granularity
fn clone(&self) -> Granularity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Granularity
impl Debug for Granularity
Source§impl Default for Granularity
impl Default for Granularity
impl Copy for Granularity
Auto Trait Implementations§
impl Freeze for Granularity
impl RefUnwindSafe for Granularity
impl Send for Granularity
impl Sync for Granularity
impl Unpin for Granularity
impl UnwindSafe for Granularity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more