vt::vrt::collection::balance::PerCollection struct

Selects an underlying model to call corresponding to the collection containing the queried object.

Base classes

class ComposedModel
Utility class to support implementation of composable load modeling components.

Public types

using CollectionID = VirtualProxyType

Constructors, destructors, conversion operators

PerCollection(std::shared_ptr<LoadModel> base) explicit

Public functions

void addModel(CollectionID proxy, std::shared_ptr<LoadModel> model)
Add a model for objects in a specific collection.
void setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load, std::unordered_map<PhaseType, CommMapType> const* proc_comm, std::unordered_map<PhaseType, DataMapType> const* user_data) override
Initialize the model instance with pointers to the measured load data.
void updateLoads(PhaseType last_completed_phase) override
Signals that load data for a new phase is available.
auto getModeledLoad(ElementIDStruct object, PhaseOffset when) const -> LoadType override
Provide an estimate of the given object's load during a specified interval.
auto hasRawLoad() const -> bool override
Whether or not the model is based on the RawData model.
auto getRawLoad(ElementIDStruct object, PhaseOffset when) const -> LoadType override
auto hasUserData() const -> bool override
Whether or not the model is based on the RawData model.
auto getUserData(ElementIDStruct object, PhaseOffset when) const -> ElmUserDataType override
auto getNumPastPhasesNeeded(unsigned int look_back) const -> unsigned int override
Compute how many phases of past load statistics need to be kept available for the model to use.

Function documentation

vt::vrt::collection::balance::PerCollection::PerCollection(std::shared_ptr<LoadModel> base) explicit

Parameters
base in The underlying default model. Used to give loads for objects in unspecified collections, and for object and subphase enumeration

void vt::vrt::collection::balance::PerCollection::addModel(CollectionID proxy, std::shared_ptr<LoadModel> model)

Add a model for objects in a specific collection.

Parameters
proxy in the virtual proxy of the collection
model in the associated model for the particular collection

void vt::vrt::collection::balance::PerCollection::setLoads(std::unordered_map<PhaseType, LoadMapType> const* proc_load, std::unordered_map<PhaseType, CommMapType> const* proc_comm, std::unordered_map<PhaseType, DataMapType> const* user_data) override

Initialize the model instance with pointers to the measured load data.

This would typically be called by LBManager when the user has passed a new model instance for a collection

void vt::vrt::collection::balance::PerCollection::updateLoads(PhaseType last_completed_phase) override

Signals that load data for a new phase is available.

For models that want to do pre-computation based on measured loads before being asked to provide predictions from them

This would typically be called by LBManager collectively inside an epoch that can be used for global communication in advance of any calls to getModeledLoad()

The setLoads method must have been called before any call to this.

LoadType vt::vrt::collection::balance::PerCollection::getModeledLoad(ElementIDStruct object, PhaseOffset when) const override

Provide an estimate of the given object's load during a specified interval.

Parameters
object in The object whose load is desired
when in The interval in which the estimated load is desired
Returns How much computation time the object is estimated to require

The updateLoads method must have been called before any call to this.

unsigned int vt::vrt::collection::balance::PerCollection::getNumPastPhasesNeeded(unsigned int look_back) const override

Compute how many phases of past load statistics need to be kept available for the model to use.

Parameters
look_back in How many phases into the past the caller intends to query
Returns How many phases of past load statistics will be needed to satisfy the requested history