Struct dslab_compute::multicore::Compute

source ·
pub struct Compute { /* private fields */ }
Expand description

Models computing resource with multiple cores which supports execution of parallel tasks.

In this model, the computation request can specify the minimum and maximum number of used cores, and provide a function which defines the dependence of parallel speedup on the number of used cores. Each core can only be used by one computation. The cores allocation for each computation is computed upon the request arrival and is not changed afterwards. This model also supports the manual allocation and release of cores and memory.

Implementations§

source§

impl Compute

source

pub fn new(speed: f64, cores: u32, memory: u64, ctx: SimulationContext) -> Self

Creates a new computing resource.

source

pub fn id(&self) -> Id

Returns id of corresponding simulation component.

source

pub fn speed(&self) -> f64

Returns the core speed.

source

pub fn cores_total(&self) -> u32

Returns the total number of cores.

source

pub fn cores_available(&self) -> u32

Returns the number of available cores.

source

pub fn memory_total(&self) -> u64

Returns the total amount of memory.

source

pub fn memory_available(&self) -> u64

Returns the amount of available memory.

source

pub fn min_compute_time( &self, flops: f64, min_cores: u32, max_cores: u32, cores_dependency: CoresDependency, ) -> Result<f64, &str>

Returns the minimum compute time for a workload with given flops, cores and cores dependency.

source

pub fn fraction_done(&self, comp_id: EventId) -> Result<f64, &str>

Returns workload fraction done for a given computation.

source

pub fn run( &mut self, flops: f64, memory: u64, min_cores: u32, max_cores: u32, cores_dependency: CoresDependency, requester: Id, ) -> u64

Starts computation with given parameters and returns computation id.

source

pub fn cancel_computation(&mut self, comp_id: u64)

Cancels computation.

source

pub fn preempt_computation(&mut self, comp_id: u64)

Preempts computation which is currently running.

source

pub fn resume_computation(&mut self, comp_id: u64)

Resumes computation which has been preempted.

source

pub fn allocate(&mut self, cores: u32, memory: u64, requester: Id) -> u64

Requests resource allocation with given parameters and returns allocation id.

source

pub fn deallocate(&mut self, cores: u32, memory: u64, requester: Id) -> u64

Requests resource deallocation with given parameters and returns deallocation id.

Trait Implementations§

source§

impl EventHandler for Compute

source§

fn on(&mut self, event: Event)

Processes event. Read more

Auto Trait Implementations§

§

impl Freeze for Compute

§

impl !RefUnwindSafe for Compute

§

impl !Send for Compute

§

impl !Sync for Compute

§

impl Unpin for Compute

§

impl !UnwindSafe for Compute

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V