/** @brief Get the start time of the current action */
double getStartTime() const { return start_; }
/** @brief Get the finish time of the current action */
- double getFinishTime() const { return finishTime_; }
+ double getFinishTime() const { return finish_time_; }
/** @brief Get the user data associated to the current action */
void* getData() const { return data_; }
double getRemainsNoUpdate() const { return remains_; }
/** @brief Set the finish time of the current action */
- void setFinishTime(double value) { finishTime_ = value; }
+ void setFinishTime(double value) { finish_time_ = value; }
/**@brief Add a reference to the current action (refcounting) */
void ref();
virtual bool isSuspended();
/** @brief Get the maximum duration of the current action */
- double getMaxDuration() const { return maxDuration_; }
+ double getMaxDuration() const { return max_duration_; }
/** @brief Set the maximum duration of the current Action */
virtual void setMaxDuration(double duration);
void setCategory(const char* category);
/** @brief Get the priority of the current Action */
- double getPriority() const { return sharingWeight_; };
+ double getPriority() const { return sharing_weight_; };
/** @brief Set the priority of the current Action */
virtual void setSharingWeight(double priority);
- void setSharingWeightNoUpdate(double weight) { sharingWeight_ = weight; }
+ void setSharingWeightNoUpdate(double weight) { sharing_weight_ = weight; }
/** @brief Get the state set in which the action is */
- ActionList* getStateSet() const { return stateSet_; };
+ ActionList* getStateSet() const { return state_set_; };
simgrid::kernel::resource::Model* getModel() const { return model_; }
protected:
- ActionList* stateSet_;
+ ActionList* state_set_;
int refcount_ = 1;
private:
- double sharingWeight_ = 1.0; /**< priority (1.0 by default) */
- double maxDuration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
+ double sharing_weight_ = 1.0; /**< priority (1.0 by default) */
+ double max_duration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
double remains_; /**< How much of that cost remains to be done in the currently running task */
double start_; /**< start time */
char* category_ = nullptr; /**< tracing category for categorized resource utilization monitoring */
- double finishTime_ =
+ double finish_time_ =
-1; /**< finish time : this is modified during the run and fluctuates until the task is completed */
double cost_;
void* data_ = nullptr; /**< for your convenience */
/* LMM */
- double lastUpdate_ = 0;
- double lastValue_ = 0;
+ double last_update_ = 0;
+ double last_value_ = 0;
kernel::lmm::Variable* variable_ = nullptr;
Action::Type type_ = Action::Type::NOTSET;
- boost::optional<heap_type::handle_type> heapHandle_ = boost::none;
+ boost::optional<heap_type::handle_type> heap_handle_ = boost::none;
public:
virtual void updateRemainingLazy(double now) = 0;
void heapInsert(heap_type& heap, double key, Action::Type hat);
void heapRemove(heap_type& heap);
void heapUpdate(heap_type& heap, double key, Action::Type hat);
- void clearHeapHandle() { heapHandle_ = boost::none; }
+ void clearHeapHandle() { heap_handle_ = boost::none; }
kernel::lmm::Variable* getVariable() const { return variable_; }
void setVariable(kernel::lmm::Variable* var) { variable_ = var; }
- double getLastUpdate() const { return lastUpdate_; }
+ double getLastUpdate() const { return last_update_; }
void refreshLastUpdate();
- double getLastValue() const { return lastValue_; }
- void setLastValue(double val) { lastValue_ = val; }
+ double getLastValue() const { return last_value_; }
+ void setLastValue(double val) { last_value_ = val; }
Action::Type getType() const { return type_; }
protected:
virtual ~Model();
/** @brief Get the set of [actions](@ref Action) in *ready* state */
- ActionList* getReadyActionSet() const { return readyActionSet_; }
+ ActionList* getReadyActionSet() const { return ready_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *running* state */
- ActionList* getRunningActionSet() const { return runningActionSet_; }
+ ActionList* getRunningActionSet() const { return running_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *failed* state */
- ActionList* getFailedActionSet() const { return failedActionSet_; }
+ ActionList* getFailedActionSet() const { return failed_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *done* state */
- ActionList* getDoneActionSet() const { return doneActionSet_; }
+ ActionList* getDoneActionSet() const { return done_action_set_; }
/** @brief Get the set of modified [actions](@ref Action) */
ActionLmmListPtr getModifiedSet() const;
/** @brief Get the maxmin system of the current Model */
- lmm_system_t getMaxminSystem() const { return maxminSystem_; }
+ lmm_system_t getMaxminSystem() const { return maxmin_system_; }
/**
* @brief Get the update mechanism of the current Model
* @see e_UM_t
*/
- e_UM_t getUpdateMechanism() const { return updateMechanism_; }
- void setUpdateMechanism(e_UM_t mechanism) { updateMechanism_ = mechanism; }
+ e_UM_t getUpdateMechanism() const { return update_mechanism_; }
+ void setUpdateMechanism(e_UM_t mechanism) { update_mechanism_ = mechanism; }
/** @brief Get Action heap */
- heap_type& getActionHeap() { return actionHeap_; }
+ heap_type& getActionHeap() { return action_heap_; }
- double actionHeapTopDate() const { return actionHeap_.top().first; }
+ double actionHeapTopDate() const { return action_heap_.top().first; }
Action* actionHeapPop();
- bool actionHeapIsEmpty() const { return actionHeap_.empty(); }
+ bool actionHeapIsEmpty() const { return action_heap_.empty(); }
/**
* @brief Share the resources between the actions
virtual bool nextOccuringEventIsIdempotent() { return true; }
protected:
- lmm_system_t maxminSystem_ = nullptr;
+ lmm_system_t maxmin_system_ = nullptr;
private:
- e_UM_t updateMechanism_ = UM_UNDEFINED;
- ActionList* readyActionSet_ = new ActionList(); /**< Actions in state SURF_ACTION_READY */
- ActionList* runningActionSet_ = new ActionList(); /**< Actions in state SURF_ACTION_RUNNING */
- ActionList* failedActionSet_ = new ActionList(); /**< Actions in state SURF_ACTION_FAILED */
- ActionList* doneActionSet_ = new ActionList(); /**< Actions in state SURF_ACTION_DONE */
- heap_type actionHeap_;
+ e_UM_t update_mechanism_ = UM_UNDEFINED;
+ ActionList* ready_action_set_ = new ActionList(); /**< Actions in state SURF_ACTION_READY */
+ ActionList* running_action_set_ = new ActionList(); /**< Actions in state SURF_ACTION_RUNNING */
+ ActionList* failed_action_set_ = new ActionList(); /**< Actions in state SURF_ACTION_FAILED */
+ ActionList* done_action_set_ = new ActionList(); /**< Actions in state SURF_ACTION_DONE */
+ heap_type action_heap_;
};
} // namespace resource
private:
std::string name_;
Model* model_;
- bool isOn_ = true;
+ bool is_on_ = true;
public: /* LMM */
/** @brief Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) */
/* We use a map instead of a std::vector here because that's a sparse vector. Some values may not exist */
/* The pair is {linkUp, linkDown} */
- std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> privateLinks_;
+ std::unordered_map<unsigned int, std::pair<surf::LinkImpl*, surf::LinkImpl*>> private_links_;
- unsigned int nodePosition(int id) { return id * linkCountPerNode_; }
- unsigned int nodePositionWithLoopback(int id) { return nodePosition(id) + (hasLoopback_ ? 1 : 0); }
- unsigned int nodePositionWithLimiter(int id) { return nodePositionWithLoopback(id) + (hasLimiter_ ? 1 : 0); }
+ unsigned int nodePosition(int id) { return id * num_links_per_node_; }
+ unsigned int nodePositionWithLoopback(int id) { return nodePosition(id) + (has_loopback_ ? 1 : 0); }
+ unsigned int nodePositionWithLimiter(int id) { return nodePositionWithLoopback(id) + (has_limiter_ ? 1 : 0); }
surf::LinkImpl* backbone_ = nullptr;
void* loopback_ = nullptr;
NetPoint* router_ = nullptr;
- bool hasLimiter_ = false;
- bool hasLoopback_ = false;
- unsigned int linkCountPerNode_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */
+ bool has_limiter_ = false;
+ bool has_loopback_ = false;
+ unsigned int num_links_per_node_ = 1; /* may be 1 (if only a private link), 2 or 3 (if limiter and loopback) */
};
} // namespace routing
} // namespace kernel
void addRoute(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoint* gw_dst,
std::vector<simgrid::surf::LinkImpl*>& link_list, bool symmetrical) override;
- xbt_graph_t routeGraph_ = nullptr; /* xbt_graph */
- std::map<int, xbt_node_t> graphNodeMap_; /* map */
+ xbt_graph_t route_graph_ = nullptr; /* xbt_graph */
+ std::map<int, xbt_node_t> graph_node_map_; /* map */
bool cached_; /* cache mode */
- std::map<int, std::vector<int>> routeCache_; /* use in cache mode */
+ std::map<int, std::vector<int>> route_cache_; /* use in cache mode */
};
} // namespace routing
} // namespace kernel
unsigned int group_;
unsigned int chassis_;
unsigned int blade_;
- surf::LinkImpl** blueLinks_ = nullptr;
- surf::LinkImpl** blackLinks_ = nullptr;
- surf::LinkImpl** greenLinks_ = nullptr;
- surf::LinkImpl** myNodes_ = nullptr;
+ surf::LinkImpl** blue_links_ = nullptr;
+ surf::LinkImpl** black_links_ = nullptr;
+ surf::LinkImpl** green_links_ = nullptr;
+ surf::LinkImpl** my_nodes_ = nullptr;
DragonflyRouter(int i, int j, int k);
~DragonflyRouter();
};
private:
ClusterCreationArgs* cluster_ = nullptr;
- unsigned int numNodesPerBlade_ = 0;
- unsigned int numBladesPerChassis_ = 0;
- unsigned int numChassisPerGroup_ = 0;
- unsigned int numGroups_ = 0;
- unsigned int numLinksGreen_ = 0;
- unsigned int numLinksBlack_ = 0;
- unsigned int numLinksBlue_ = 0;
- unsigned int numLinksperLink_ = 1; // splitduplex -> 2, only for local link
+ unsigned int num_nodes_per_blade_ = 0;
+ unsigned int num_blades_per_chassis_ = 0;
+ unsigned int num_chassis_per_group_ = 0;
+ unsigned int num_groups_ = 0;
+ unsigned int num_links_green_ = 0;
+ unsigned int num_links_black_ = 0;
+ unsigned int num_links_blue_ = 0;
+ unsigned int num_links_per_link_ = 1; // splitduplex -> 2, only for local link
DragonflyRouter** routers_ = nullptr;
};
} // namespace routing
/** Virtual link standing for the node global capacity.
*/
- surf::LinkImpl* limiterLink;
+ surf::LinkImpl* limiter_link_;
/** If present, communications from this node to this node will pass through it
* instead of passing by an upper level switch.
*/
public:
FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* source, FatTreeNode* destination);
/** Link going up in the tree */
- surf::LinkImpl* upLink;
+ surf::LinkImpl* up_link_;
/** Link going down in the tree */
- surf::LinkImpl* downLink;
+ surf::LinkImpl* down_link_;
/** Upper end of the link */
- FatTreeNode* upNode;
+ FatTreeNode* up_node_;
/** Lower end of the link */
- FatTreeNode* downNode;
+ FatTreeNode* down_node_;
};
/** @ingroup ROUTING_API
std::vector<unsigned int> upperLevelNodesNumber_; // number of parents by node
std::vector<unsigned int> lowerLevelPortsNumber_; // ports between each level l and l-1
- std::map<int, FatTreeNode*> computeNodes_;
+ std::map<int, FatTreeNode*> compute_nodes_;
std::vector<FatTreeNode*> nodes_;
std::vector<FatTreeLink*> links_;
std::vector<unsigned int> nodesByLevel_;
: remains_(cost), start_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
{
if (failed)
- stateSet_ = getModel()->getFailedActionSet();
+ state_set_ = getModel()->getFailedActionSet();
else
- stateSet_ = getModel()->getRunningActionSet();
+ state_set_ = getModel()->getRunningActionSet();
- stateSet_->push_back(*this);
+ state_set_->push_back(*this);
}
Action::~Action()
void Action::finish(Action::State state)
{
- finishTime_ = surf_get_clock();
+ finish_time_ = surf_get_clock();
setState(state);
}
Action::State Action::getState() const
{
- if (stateSet_ == model_->getReadyActionSet())
+ if (state_set_ == model_->getReadyActionSet())
return Action::State::ready;
- if (stateSet_ == model_->getRunningActionSet())
+ if (state_set_ == model_->getRunningActionSet())
return Action::State::running;
- if (stateSet_ == model_->getFailedActionSet())
+ if (state_set_ == model_->getFailedActionSet())
return Action::State::failed;
- if (stateSet_ == model_->getDoneActionSet())
+ if (state_set_ == model_->getDoneActionSet())
return Action::State::done;
return Action::State::not_in_the_system;
}
void Action::setState(Action::State state)
{
- simgrid::xbt::intrusive_erase(*stateSet_, *this);
+ simgrid::xbt::intrusive_erase(*state_set_, *this);
switch (state) {
case Action::State::ready:
- stateSet_ = model_->getReadyActionSet();
+ state_set_ = model_->getReadyActionSet();
break;
case Action::State::running:
- stateSet_ = model_->getRunningActionSet();
+ state_set_ = model_->getRunningActionSet();
break;
case Action::State::failed:
- stateSet_ = model_->getFailedActionSet();
+ state_set_ = model_->getFailedActionSet();
break;
case Action::State::done:
- stateSet_ = model_->getDoneActionSet();
+ state_set_ = model_->getDoneActionSet();
break;
default:
- stateSet_ = nullptr;
+ state_set_ = nullptr;
break;
}
- if (stateSet_)
- stateSet_->push_back(*this);
+ if (state_set_)
+ state_set_->push_back(*this);
}
double Action::getBound() const
void Action::setMaxDuration(double duration)
{
- maxDuration_ = duration;
+ max_duration_ = duration;
if (getModel()->getUpdateMechanism() == UM_LAZY) // remove action from the heap
heapRemove(getModel()->getActionHeap());
}
void Action::setSharingWeight(double weight)
{
XBT_IN("(%p,%g)", this, weight);
- sharingWeight_ = weight;
+ sharing_weight_ = weight;
getModel()->getMaxminSystem()->update_variable_weight(getVariable(), weight);
if (getModel()->getUpdateMechanism() == UM_LAZY)
refcount_--;
if (not refcount_) {
if (stateSetHook_.is_linked())
- simgrid::xbt::intrusive_erase(*stateSet_, *this);
+ simgrid::xbt::intrusive_erase(*state_set_, *this);
if (getVariable())
getModel()->getMaxminSystem()->variable_free(getVariable());
if (getModel()->getUpdateMechanism() == UM_LAZY) {
getModel()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0);
if (getModel()->getUpdateMechanism() == UM_LAZY) {
heapRemove(getModel()->getActionHeap());
- if (getModel()->getUpdateMechanism() == UM_LAZY && stateSet_ == getModel()->getRunningActionSet() &&
- sharingWeight_ > 0) {
+ if (getModel()->getUpdateMechanism() == UM_LAZY && state_set_ == getModel()->getRunningActionSet() &&
+ sharing_weight_ > 0) {
// If we have a lazy model, we need to update the remaining value accordingly
updateRemainingLazy(surf_get_clock());
}
void Action::heapInsert(heap_type& heap, double key, Action::Type hat)
{
type_ = hat;
- heapHandle_ = heap.emplace(std::make_pair(key, this));
+ heap_handle_ = heap.emplace(std::make_pair(key, this));
}
void Action::heapRemove(heap_type& heap)
{
type_ = Action::Type::NOTSET;
- if (heapHandle_) {
- heap.erase(*heapHandle_);
+ if (heap_handle_) {
+ heap.erase(*heap_handle_);
clearHeapHandle();
}
}
void Action::heapUpdate(heap_type& heap, double key, Action::Type hat)
{
type_ = hat;
- if (heapHandle_) {
- heap.update(*heapHandle_, std::make_pair(key, this));
+ if (heap_handle_) {
+ heap.update(*heap_handle_, std::make_pair(key, this));
} else {
- heapHandle_ = heap.emplace(std::make_pair(key, this));
+ heap_handle_ = heap.emplace(std::make_pair(key, this));
}
}
void Action::updateMaxDuration(double delta)
{
- double_update(&maxDuration_, delta, sg_surf_precision);
+ double_update(&max_duration_, delta, sg_surf_precision);
}
void Action::updateRemains(double delta)
{
void Action::refreshLastUpdate()
{
- lastUpdate_ = surf_get_clock();
+ last_update_ = surf_get_clock();
}
} // namespace surf
Model::~Model()
{
- delete readyActionSet_;
- delete runningActionSet_;
- delete failedActionSet_;
- delete doneActionSet_;
- delete maxminSystem_;
+ delete ready_action_set_;
+ delete running_action_set_;
+ delete failed_action_set_;
+ delete done_action_set_;
+ delete maxmin_system_;
}
Action* Model::actionHeapPop()
{
- Action* action = actionHeap_.top().second;
- actionHeap_.pop();
+ Action* action = action_heap_.top().second;
+ action_heap_.pop();
action->clearHeapHandle();
return action;
}
ActionLmmListPtr Model::getModifiedSet() const
{
- return maxminSystem_->modified_set_;
+ return maxmin_system_->modified_set_;
}
double Model::nextOccuringEvent(double now)
{
// FIXME: set the good function once and for all
- if (updateMechanism_ == UM_LAZY)
+ if (update_mechanism_ == UM_LAZY)
return nextOccuringEventLazy(now);
- else if (updateMechanism_ == UM_FULL)
+ else if (update_mechanism_ == UM_FULL)
return nextOccuringEventFull(now);
else
xbt_die("Invalid cpu update mechanism!");
double Model::nextOccuringEventLazy(double now)
{
- XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxminSystem_->modified_set_->size());
- lmm_solve(maxminSystem_);
- XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxminSystem_->modified_set_->size());
+ XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxmin_system_->modified_set_->size());
+ lmm_solve(maxmin_system_);
+ XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxmin_system_->modified_set_->size());
- while (not maxminSystem_->modified_set_->empty()) {
- Action* action = &(maxminSystem_->modified_set_->front());
- maxminSystem_->modified_set_->pop_front();
+ while (not maxmin_system_->modified_set_->empty()) {
+ Action* action = &(maxmin_system_->modified_set_->front());
+ maxmin_system_->modified_set_->pop_front();
bool max_dur_flag = false;
- if (action->getStateSet() != runningActionSet_)
+ if (action->getStateSet() != running_action_set_)
continue;
/* bogus priority, skip it */
action->getStartTime(), min, share, action->getMaxDuration());
if (min > -1) {
- action->heapUpdate(actionHeap_, min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
+ action->heapUpdate(action_heap_, min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min, now);
} else
DIE_IMPOSSIBLE;
double Model::nextOccuringEventFull(double /*now*/)
{
- maxminSystem_->solve_fun(maxminSystem_);
+ maxmin_system_->solve_fun(maxmin_system_);
double min = -1;
void Model::updateActionsState(double now, double delta)
{
- if (updateMechanism_ == UM_FULL)
+ if (update_mechanism_ == UM_FULL)
updateActionsStateFull(now, delta);
- else if (updateMechanism_ == UM_LAZY)
+ else if (update_mechanism_ == UM_LAZY)
updateActionsStateLazy(now, delta);
else
xbt_die("Invalid cpu update mechanism!");
bool Resource::isOn() const
{
- return isOn_;
+ return is_on_;
}
bool Resource::isOff() const
{
- return not isOn_;
+ return not is_on_;
}
void Resource::turnOn()
{
- isOn_ = true;
+ is_on_ = true;
}
void Resource::turnOff()
{
- isOn_ = false;
+ is_on_ = false;
}
double Resource::getLoad()
void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
{
XBT_VERB("cluster getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
- xbt_assert(not privateLinks_.empty(),
+ xbt_assert(not private_links_.empty(),
"Cluster routing: no links attached to the source node - did you use host_link tag?");
- if ((src->id() == dst->id()) && hasLoopback_) {
+ if ((src->id() == dst->id()) && has_loopback_) {
xbt_assert(not src->isRouter(), "Routing from a cluster private router to itself is meaningless");
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePosition(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
route->link_list.push_back(info.first);
if (lat)
*lat += info.first->latency();
}
if (not src->isRouter()) { // No private link for the private router
- if (hasLimiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLoopback(src->id()));
+ if (has_limiter_) { // limiter for sender
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
route->link_list.push_back(info.first);
}
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLimiter(src->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(src->id()));
if (info.first) { // link up
route->link_list.push_back(info.first);
if (lat)
if (not dst->isRouter()) { // No specific link for router
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLimiter(dst->id()));
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLimiter(dst->id()));
if (info.second) { // link down
route->link_list.push_back(info.second);
if (lat)
*lat += info.second->latency();
}
- if (hasLimiter_) { // limiter for receiver
- info = privateLinks_.at(nodePositionWithLoopback(dst->id()));
+ if (has_limiter_) { // limiter for receiver
+ info = private_links_.at(nodePositionWithLoopback(dst->id()));
route->link_list.push_back(info.first);
}
}
if (not src->isRouter()) {
xbt_node_t previous = new_xbt_graph_node(graph, src->getCname(), nodes);
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id());
if (info.first) { // link up
xbt_node_t current = new_xbt_graph_node(graph, info.first->getCname(), nodes);
linkUp = surf::LinkImpl::byName(link_id);
linkDown = linkUp;
}
- privateLinks_.insert({position, {linkUp, linkDown}});
+ private_links_.insert({position, {linkUp, linkDown}});
}
}
}
xbt_node_t node = nullptr;
/* Create the topology graph */
- if (not routeGraph_)
- routeGraph_ = xbt_graph_new_graph(1, nullptr);
+ if (not route_graph_)
+ route_graph_ = xbt_graph_new_graph(1, nullptr);
/* Add the loopback if needed */
if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
- xbt_dynar_foreach (xbt_graph_get_nodes(routeGraph_), cursor, node) {
+ xbt_dynar_foreach (xbt_graph_get_nodes(route_graph_), cursor, node) {
bool found = false;
xbt_edge_t edge = nullptr;
if (not found) {
RouteCreationArgs* e_route = new simgrid::kernel::routing::RouteCreationArgs();
e_route->link_list.push_back(surf_network_model->loopback_);
- xbt_graph_new_edge(routeGraph_, node, node, e_route);
+ xbt_graph_new_edge(route_graph_, node, node, e_route);
}
}
}
/* initialize graph indexes in nodes after graph has been built */
- xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
+ xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
xbt_dynar_foreach (nodes, cursor, node) {
graph_node_data_t data = static_cast<graph_node_data_t>(xbt_graph_node_get_data(node));
data->id = id;
data->graph_id = graph_id;
- xbt_node_t node = xbt_graph_new_node(routeGraph_, data);
- graphNodeMap_.emplace(id, node);
+ xbt_node_t node = xbt_graph_new_node(route_graph_, data);
+ graph_node_map_.emplace(id, node);
return node;
}
xbt_node_t DijkstraZone::nodeMapSearch(int id)
{
- auto ret = graphNodeMap_.find(id);
- return ret == graphNodeMap_.end() ? nullptr : ret->second;
+ auto ret = graph_node_map_.find(id);
+ return ret == graph_node_map_.end() ? nullptr : ret->second;
}
/* Parsing */
}
/* add link as edge to graph */
- xbt_graph_new_edge(routeGraph_, src, dst, e_route);
+ xbt_graph_new_edge(route_graph_, src, dst, e_route);
}
void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
int src_id = src->id();
int dst_id = dst->id();
- xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
+ xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
/* Use the graph_node id mapping set to quickly find the nodes */
xbt_node_t src_elm = nodeMapSearch(src_id);
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_node_id, xbt_node_t);
- xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_s_v, node_e_v);
+ xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_s_v, node_e_v);
if (edge == nullptr)
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
}
}
- auto elm = routeCache_.emplace(src_id, std::vector<int>());
+ auto elm = route_cache_.emplace(src_id, std::vector<int>());
std::vector<int>& pred_arr = elm.first->second;
if (elm.second) { /* new element was inserted (not cached mode, or cache miss) */
for (int v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
xbt_node_t node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
xbt_node_t node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
- xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_pred_v, node_v);
+ xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_pred_v, node_v);
if (edge == nullptr)
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->getCname(), dst->getCname());
}
if (not cached_)
- routeCache_.clear();
+ route_cache_.clear();
}
DijkstraZone::~DijkstraZone()
{
- xbt_graph_free_graph(routeGraph_, &graph_node_data_free, &graph_edge_data_free, nullptr);
+ xbt_graph_free_graph(route_graph_, &graph_node_data_free, &graph_edge_data_free, nullptr);
}
/* Creation routing model functions */
addRouteCheckParams(src, dst, gw_src, gw_dst, link_list, symmetrical);
/* Create the topology graph */
- if (not routeGraph_)
- routeGraph_ = xbt_graph_new_graph(1, nullptr);
+ if (not route_graph_)
+ route_graph_ = xbt_graph_new_graph(1, nullptr);
/* we don't check whether the route already exist, because the algorithm may find another path through some other
* nodes */
// Symmetrical YES
if (symmetrical == true) {
- xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
+ xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src->id(), xbt_node_t);
xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst->id(), xbt_node_t);
- xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_e_v, node_s_v);
+ xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_e_v, node_s_v);
if (not gw_dst || not gw_src) {
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
DragonflyZone::~DragonflyZone()
{
if (this->routers_ != nullptr) {
- for (unsigned int i = 0; i < this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_; i++)
+ for (unsigned int i = 0; i < this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_; i++)
delete routers_[i];
delete[] routers_;
}
void DragonflyZone::rankId_to_coords(int rankId, unsigned int (*coords)[4])
{
// coords : group, chassis, blade, node
- (*coords)[0] = rankId / (numChassisPerGroup_ * numBladesPerChassis_ * numNodesPerBlade_);
- rankId = rankId % (numChassisPerGroup_ * numBladesPerChassis_ * numNodesPerBlade_);
- (*coords)[1] = rankId / (numBladesPerChassis_ * numNodesPerBlade_);
- rankId = rankId % (numBladesPerChassis_ * numNodesPerBlade_);
- (*coords)[2] = rankId / numNodesPerBlade_;
- (*coords)[3] = rankId % numNodesPerBlade_;
+ (*coords)[0] = rankId / (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
+ rankId = rankId % (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
+ (*coords)[1] = rankId / (num_blades_per_chassis_ * num_nodes_per_blade_);
+ rankId = rankId % (num_blades_per_chassis_ * num_nodes_per_blade_);
+ (*coords)[2] = rankId / num_nodes_per_blade_;
+ (*coords)[3] = rankId % num_nodes_per_blade_;
}
void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
}
try {
- this->numGroups_ = std::stoi(tmp[0]);
+ this->num_groups_ = std::stoi(tmp[0]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
}
try {
- this->numLinksBlue_ = std::stoi(tmp[1]);
+ this->num_links_blue_ = std::stoi(tmp[1]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid number of links for the blue level:") + tmp[1]);
}
}
try {
- this->numChassisPerGroup_ = std::stoi(tmp[0]);
+ this->num_chassis_per_group_ = std::stoi(tmp[0]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
}
try {
- this->numLinksBlack_ = std::stoi(tmp[1]);
+ this->num_links_black_ = std::stoi(tmp[1]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid number of links for the black level:") + tmp[1]);
}
}
try {
- this->numBladesPerChassis_ = std::stoi(tmp[0]);
+ this->num_blades_per_chassis_ = std::stoi(tmp[0]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid number of groups:") + tmp[0]);
}
try {
- this->numLinksGreen_ = std::stoi(tmp[1]);
+ this->num_links_green_ = std::stoi(tmp[1]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Invalid number of links for the green level:") + tmp[1]);
}
// The last part of topo_parameters should be the number of nodes per blade
try {
- this->numNodesPerBlade_ = std::stoi(parameters[3]);
+ this->num_nodes_per_blade_ = std::stoi(parameters[3]);
} catch (std::invalid_argument& ia) {
throw std::invalid_argument(std::string("Last parameter is not the amount of nodes per blade:") + parameters[3]);
}
if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX)
- this->numLinksperLink_ = 2;
+ this->num_links_per_link_ = 2;
this->cluster_ = cluster;
}
/* Generate the cluster once every node is created */
void DragonflyZone::seal()
{
- if (this->numNodesPerBlade_ == 0) {
+ if (this->num_nodes_per_blade_ == 0) {
return;
}
DragonflyRouter::~DragonflyRouter()
{
- delete[] myNodes_;
- delete[] greenLinks_;
- delete[] blackLinks_;
- delete blueLinks_;
+ delete[] my_nodes_;
+ delete[] green_links_;
+ delete[] black_links_;
+ delete blue_links_;
}
void DragonflyZone::generateRouters()
{
- this->routers_ = new DragonflyRouter*[this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_];
+ this->routers_ =
+ new DragonflyRouter*[this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_];
- for (unsigned int i = 0; i < this->numGroups_; i++) {
- for (unsigned int j = 0; j < this->numChassisPerGroup_; j++) {
- for (unsigned int k = 0; k < this->numBladesPerChassis_; k++) {
+ for (unsigned int i = 0; i < this->num_groups_; i++) {
+ for (unsigned int j = 0; j < this->num_chassis_per_group_; j++) {
+ for (unsigned int k = 0; k < this->num_blades_per_chassis_; k++) {
DragonflyRouter* router = new DragonflyRouter(i, j, k);
- this->routers_[i * this->numChassisPerGroup_ * this->numBladesPerChassis_ + j * this->numBladesPerChassis_ +
- k] = router;
+ this->routers_[i * this->num_chassis_per_group_ * this->num_blades_per_chassis_ +
+ j * this->num_blades_per_chassis_ + k] = router;
}
}
}
surf::LinkImpl* linkup;
surf::LinkImpl* linkdown;
- unsigned int numRouters = this->numGroups_ * this->numChassisPerGroup_ * this->numBladesPerChassis_;
+ unsigned int numRouters = this->num_groups_ * this->num_chassis_per_group_ * this->num_blades_per_chassis_;
// Links from routers to their local nodes.
for (unsigned int i = 0; i < numRouters; i++) {
// allocate structures
- this->routers_[i]->myNodes_ = new surf::LinkImpl*[numLinksperLink_ * this->numNodesPerBlade_];
- this->routers_[i]->greenLinks_ = new surf::LinkImpl*[this->numBladesPerChassis_];
- this->routers_[i]->blackLinks_ = new surf::LinkImpl*[this->numChassisPerGroup_];
+ this->routers_[i]->my_nodes_ = new surf::LinkImpl*[num_links_per_link_ * this->num_nodes_per_blade_];
+ this->routers_[i]->green_links_ = new surf::LinkImpl*[this->num_blades_per_chassis_];
+ this->routers_[i]->black_links_ = new surf::LinkImpl*[this->num_chassis_per_group_];
- for (unsigned int j = 0; j < numLinksperLink_ * this->numNodesPerBlade_; j += numLinksperLink_) {
- std::string id = "local_link_from_router_"+ std::to_string(i) + "_to_node_" +
- std::to_string(j / numLinksperLink_) + "_" + std::to_string(uniqueId);
+ for (unsigned int j = 0; j < num_links_per_link_ * this->num_nodes_per_blade_; j += num_links_per_link_) {
+ std::string id = "local_link_from_router_" + std::to_string(i) + "_to_node_" +
+ std::to_string(j / num_links_per_link_) + "_" + std::to_string(uniqueId);
this->createLink(id, 1, &linkup, &linkdown);
- this->routers_[i]->myNodes_[j] = linkup;
+ this->routers_[i]->my_nodes_[j] = linkup;
if (this->cluster_->sharing_policy == SURF_LINK_SPLITDUPLEX)
- this->routers_[i]->myNodes_[j + 1] = linkdown;
+ this->routers_[i]->my_nodes_[j + 1] = linkdown;
uniqueId++;
}
}
// Green links from routers to same chassis routers - alltoall
- for (unsigned int i = 0; i < this->numGroups_ * this->numChassisPerGroup_; i++) {
- for (unsigned int j = 0; j < this->numBladesPerChassis_; j++) {
- for (unsigned int k = j + 1; k < this->numBladesPerChassis_; k++) {
- std::string id = "green_link_in_chassis_" + std::to_string(i % numChassisPerGroup_) +"_between_routers_" +
- std::to_string(j) + "_and_" + std::to_string(k) + "_" + std::to_string(uniqueId);
- this->createLink(id, this->numLinksGreen_, &linkup, &linkdown);
-
- this->routers_[i * numBladesPerChassis_ + j]->greenLinks_[k] = linkup;
- this->routers_[i * numBladesPerChassis_ + k]->greenLinks_[j] = linkdown;
+ for (unsigned int i = 0; i < this->num_groups_ * this->num_chassis_per_group_; i++) {
+ for (unsigned int j = 0; j < this->num_blades_per_chassis_; j++) {
+ for (unsigned int k = j + 1; k < this->num_blades_per_chassis_; k++) {
+ std::string id = "green_link_in_chassis_" + std::to_string(i % num_chassis_per_group_) + "_between_routers_" +
+ std::to_string(j) + "_and_" + std::to_string(k) + "_" + std::to_string(uniqueId);
+ this->createLink(id, this->num_links_green_, &linkup, &linkdown);
+
+ this->routers_[i * num_blades_per_chassis_ + j]->green_links_[k] = linkup;
+ this->routers_[i * num_blades_per_chassis_ + k]->green_links_[j] = linkdown;
uniqueId++;
}
}
}
// Black links from routers to same group routers - alltoall
- for (unsigned int i = 0; i < this->numGroups_; i++) {
- for (unsigned int j = 0; j < this->numChassisPerGroup_; j++) {
- for (unsigned int k = j + 1; k < this->numChassisPerGroup_; k++) {
- for (unsigned int l = 0; l < this->numBladesPerChassis_; l++) {
+ for (unsigned int i = 0; i < this->num_groups_; i++) {
+ for (unsigned int j = 0; j < this->num_chassis_per_group_; j++) {
+ for (unsigned int k = j + 1; k < this->num_chassis_per_group_; k++) {
+ for (unsigned int l = 0; l < this->num_blades_per_chassis_; l++) {
std::string id = "black_link_in_group_" + std::to_string(i) + "_between_chassis_" + std::to_string(j) +
"_and_" + std::to_string(k) +"_blade_" + std::to_string(l) + "_" + std::to_string(uniqueId);
- this->createLink(id, this->numLinksBlack_, &linkup, &linkdown);
+ this->createLink(id, this->num_links_black_, &linkup, &linkdown);
- this->routers_[i * numBladesPerChassis_ * numChassisPerGroup_ + j * numBladesPerChassis_ + l]
- ->blackLinks_[k] = linkup;
- this->routers_[i * numBladesPerChassis_ * numChassisPerGroup_ + k * numBladesPerChassis_ + l]
- ->blackLinks_[j] = linkdown;
+ this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + j * num_blades_per_chassis_ + l]
+ ->black_links_[k] = linkup;
+ this->routers_[i * num_blades_per_chassis_ * num_chassis_per_group_ + k * num_blades_per_chassis_ + l]
+ ->black_links_[j] = linkdown;
uniqueId++;
}
}
// Blue links between groups - Not all routers involved, only one per group is linked to others. Let's say router n of
// each group is linked to group n.
// FIXME: in reality blue links may be attached to several different routers
- for (unsigned int i = 0; i < this->numGroups_; i++) {
- for (unsigned int j = i + 1; j < this->numGroups_; j++) {
- unsigned int routernumi = i * numBladesPerChassis_ * numChassisPerGroup_ + j;
- unsigned int routernumj = j * numBladesPerChassis_ * numChassisPerGroup_ + i;
- this->routers_[routernumi]->blueLinks_ = new surf::LinkImpl*;
- this->routers_[routernumj]->blueLinks_ = new surf::LinkImpl*;
+ for (unsigned int i = 0; i < this->num_groups_; i++) {
+ for (unsigned int j = i + 1; j < this->num_groups_; j++) {
+ unsigned int routernumi = i * num_blades_per_chassis_ * num_chassis_per_group_ + j;
+ unsigned int routernumj = j * num_blades_per_chassis_ * num_chassis_per_group_ + i;
+ this->routers_[routernumi]->blue_links_ = new surf::LinkImpl*;
+ this->routers_[routernumj]->blue_links_ = new surf::LinkImpl*;
std::string id = "blue_link_between_group_"+ std::to_string(i) +"_and_" + std::to_string(j) +"_routers_" +
std::to_string(routernumi) + "_and_" + std::to_string(routernumj) + "_" + std::to_string(uniqueId);
- this->createLink(id, this->numLinksBlue_, &linkup, &linkdown);
+ this->createLink(id, this->num_links_blue_, &linkup, &linkdown);
- this->routers_[routernumi]->blueLinks_[0] = linkup;
- this->routers_[routernumj]->blueLinks_[0] = linkdown;
+ this->routers_[routernumi]->blue_links_[0] = linkup;
+ this->routers_[routernumj]->blue_links_[0] = linkdown;
uniqueId++;
}
}
XBT_VERB("dragonfly getLocalRoute from '%s'[%u] to '%s'[%u]", src->getCname(), src->id(), dst->getCname(), dst->id());
- if ((src->id() == dst->id()) && hasLoopback_) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePosition(src->id()));
+ if ((src->id() == dst->id()) && has_loopback_) {
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePosition(src->id()));
route->link_list.push_back(info.first);
if (latency)
XBT_DEBUG("dst : %u group, %u chassis, %u blade, %u node", targetCoords[0], targetCoords[1], targetCoords[2],
targetCoords[3]);
- DragonflyRouter* myRouter = routers_[myCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
- myCoords[1] * numBladesPerChassis_ + myCoords[2]];
- DragonflyRouter* targetRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
- targetCoords[1] * numBladesPerChassis_ + targetCoords[2]];
+ DragonflyRouter* myRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+ myCoords[1] * num_blades_per_chassis_ + myCoords[2]];
+ DragonflyRouter* targetRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+ targetCoords[1] * num_blades_per_chassis_ + targetCoords[2]];
DragonflyRouter* currentRouter = myRouter;
// node->router local link
- route->link_list.push_back(myRouter->myNodes_[myCoords[3] * numLinksperLink_]);
+ route->link_list.push_back(myRouter->my_nodes_[myCoords[3] * num_links_per_link_]);
if (latency)
- *latency += myRouter->myNodes_[myCoords[3] * numLinksperLink_]->latency();
+ *latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->latency();
- if (hasLimiter_) { // limiter for sender
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLoopback(src->id()));
+ if (has_limiter_) { // limiter for sender
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(src->id()));
route->link_list.push_back(info.first);
}
// go to the router of our group connected to this one.
if (currentRouter->blade_ != targetCoords[0]) {
// go to the nth router in our chassis
- route->link_list.push_back(currentRouter->greenLinks_[targetCoords[0]]);
+ route->link_list.push_back(currentRouter->green_links_[targetCoords[0]]);
if (latency)
- *latency += currentRouter->greenLinks_[targetCoords[0]]->latency();
- currentRouter = routers_[myCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
- myCoords[1] * numBladesPerChassis_ + targetCoords[0]];
+ *latency += currentRouter->green_links_[targetCoords[0]]->latency();
+ currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) +
+ myCoords[1] * num_blades_per_chassis_ + targetCoords[0]];
}
if (currentRouter->chassis_ != 0) {
// go to the first chassis of our group
- route->link_list.push_back(currentRouter->blackLinks_[0]);
+ route->link_list.push_back(currentRouter->black_links_[0]);
if (latency)
- *latency += currentRouter->blackLinks_[0]->latency();
- currentRouter = routers_[myCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) + targetCoords[0]];
+ *latency += currentRouter->black_links_[0]->latency();
+ currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[0]];
}
// go to destination group - the only optical hop
- route->link_list.push_back(currentRouter->blueLinks_[0]);
+ route->link_list.push_back(currentRouter->blue_links_[0]);
if (latency)
- *latency += currentRouter->blueLinks_[0]->latency();
- currentRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) + myCoords[0]];
+ *latency += currentRouter->blue_links_[0]->latency();
+ currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + myCoords[0]];
}
// same group, but same blade ?
if (targetRouter->blade_ != currentRouter->blade_) {
- route->link_list.push_back(currentRouter->greenLinks_[targetCoords[2]]);
+ route->link_list.push_back(currentRouter->green_links_[targetCoords[2]]);
if (latency)
- *latency += currentRouter->greenLinks_[targetCoords[2]]->latency();
- currentRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) + targetCoords[2]];
+ *latency += currentRouter->green_links_[targetCoords[2]]->latency();
+ currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[2]];
}
// same blade, but same chassis ?
if (targetRouter->chassis_ != currentRouter->chassis_) {
- route->link_list.push_back(currentRouter->blackLinks_[targetCoords[1]]);
+ route->link_list.push_back(currentRouter->black_links_[targetCoords[1]]);
if (latency)
- *latency += currentRouter->blackLinks_[targetCoords[1]]->latency();
+ *latency += currentRouter->black_links_[targetCoords[1]]->latency();
}
}
- if (hasLimiter_) { // limiter for receiver
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(nodePositionWithLoopback(dst->id()));
+ if (has_limiter_) { // limiter for receiver
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(nodePositionWithLoopback(dst->id()));
route->link_list.push_back(info.first);
}
// router->node local link
- route->link_list.push_back(targetRouter->myNodes_[targetCoords[3] * numLinksperLink_ + numLinksperLink_ - 1]);
+ route->link_list.push_back(targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]);
if (latency)
- *latency += targetRouter->myNodes_[targetCoords[3] * numLinksperLink_ + numLinksperLink_ - 1]->latency();
+ *latency += targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]->latency();
}
}
}
return;
/* Let's find the source and the destination in our internal structure */
- auto searchedNode = this->computeNodes_.find(src->id());
- xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the source %s [%u] in the fat tree",
+ auto searchedNode = this->compute_nodes_.find(src->id());
+ xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the source %s [%u] in the fat tree",
src->getCname(), src->id());
FatTreeNode* source = searchedNode->second;
- searchedNode = this->computeNodes_.find(dst->id());
- xbt_assert(searchedNode != this->computeNodes_.end(), "Could not find the destination %s [%u] in the fat tree",
+ searchedNode = this->compute_nodes_.find(dst->id());
+ xbt_assert(searchedNode != this->compute_nodes_.end(), "Could not find the destination %s [%u] in the fat tree",
dst->getCname(), dst->id());
FatTreeNode* destination = searchedNode->second;
dst->getCname(), dst->id());
/* In case destination is the source, and there is a loopback, let's use it instead of going up to a switch */
- if (source->id == destination->id && this->hasLoopback_) {
+ if (source->id == destination->id && this->has_loopback_) {
into->link_list.push_back(source->loopback);
if (latency)
*latency += source->loopback->latency();
int k = this->upperLevelNodesNumber_[currentNode->level];
d = d % k;
- into->link_list.push_back(currentNode->parents[d]->upLink);
+ into->link_list.push_back(currentNode->parents[d]->up_link_);
if (latency)
- *latency += currentNode->parents[d]->upLink->latency();
+ *latency += currentNode->parents[d]->up_link_->latency();
- if (this->hasLimiter_)
- into->link_list.push_back(currentNode->limiterLink);
- currentNode = currentNode->parents[d]->upNode;
+ if (this->has_limiter_)
+ into->link_list.push_back(currentNode->limiter_link_);
+ currentNode = currentNode->parents[d]->up_node_;
}
XBT_DEBUG("%d(%u,%u) is in the sub tree of %d(%u,%u).", destination->id, destination->level, destination->position,
while (currentNode != destination) {
for (unsigned int i = 0; i < currentNode->children.size(); i++) {
if (i % this->lowerLevelNodesNumber_[currentNode->level - 1] == destination->label[currentNode->level - 1]) {
- into->link_list.push_back(currentNode->children[i]->downLink);
+ into->link_list.push_back(currentNode->children[i]->down_link_);
if (latency)
- *latency += currentNode->children[i]->downLink->latency();
- currentNode = currentNode->children[i]->downNode;
- if (this->hasLimiter_)
- into->link_list.push_back(currentNode->limiterLink);
+ *latency += currentNode->children[i]->down_link_->latency();
+ currentNode = currentNode->children[i]->down_node_;
+ if (this->has_limiter_)
+ into->link_list.push_back(currentNode->limiter_link_);
XBT_DEBUG("%d(%u,%u) is accessible through %d(%u,%u)", destination->id, destination->level,
destination->position, currentNode->id, currentNode->level, currentNode->position);
}
std::stringstream msgBuffer;
msgBuffer << "Links are : ";
for (unsigned int i = 0; i < this->links_.size(); i++) {
- msgBuffer << "(" << this->links_[i]->upNode->id << "," << this->links_[i]->downNode->id << ") ";
+ msgBuffer << "(" << this->links_[i]->up_node_->id << "," << this->links_[i]->down_node_->id << ") ";
}
XBT_DEBUG("%s", msgBuffer.str().c_str());
}
newNode = new FatTreeNode(this->cluster_, id, 0, position++);
newNode->parents.resize(this->upperLevelNodesNumber_[0] * this->lowerLevelPortsNumber_[0]);
newNode->label.resize(this->levels_);
- this->computeNodes_.insert(make_pair(id, newNode));
+ this->compute_nodes_.insert(make_pair(id, newNode));
this->nodes_.push_back(newNode);
}
}
for (unsigned int i = 0; i < this->links_.size(); i++) {
- file << this->links_[i]->downNode->id << " -- " << this->links_[i]->upNode->id << ";\n";
+ file << this->links_[i]->down_node_->id << " -- " << this->links_[i]->up_node_->id << ";\n";
}
file << "}";
file.close();
linkTemplate.policy = SURF_LINK_SHARED;
linkTemplate.id = "limiter_"+std::to_string(id);
sg_platf_new_link(&linkTemplate);
- this->limiterLink = surf::LinkImpl::byName(linkTemplate.id);
+ this->limiter_link_ = surf::LinkImpl::byName(linkTemplate.id);
}
if (cluster->loopback_bw || cluster->loopback_lat) {
linkTemplate.bandwidth = cluster->loopback_bw;
}
FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, FatTreeNode* upNode)
- : upNode(upNode), downNode(downNode)
+ : up_node_(upNode), down_node_(downNode)
{
static int uniqueId = 0;
LinkCreationArgs linkTemplate;
if (cluster->sharing_policy == SURF_LINK_SPLITDUPLEX) {
std::string tmpID = std::string(linkTemplate.id) + "_UP";
- this->upLink = surf::LinkImpl::byName(tmpID); // check link?
+ this->up_link_ = surf::LinkImpl::byName(tmpID); // check link?
tmpID = std::string(linkTemplate.id) + "_DOWN";
- this->downLink = surf::LinkImpl::byName(tmpID); // check link ?
+ this->down_link_ = surf::LinkImpl::byName(tmpID); // check link ?
} else {
- this->upLink = surf::LinkImpl::byName(linkTemplate.id);
- this->downLink = this->upLink;
+ this->up_link_ = surf::LinkImpl::byName(linkTemplate.id);
+ this->down_link_ = this->up_link_;
}
uniqueId++;
}
* Note that position rankId*(xbt_dynar_length(dimensions)+has_loopback?+has_limiter?)
* holds the link "rankId->rankId"
*/
- privateLinks_.insert({position + j, {linkUp, linkDown}});
+ private_links_.insert({position + j, {linkUp, linkDown}});
dim_product *= current_dimension;
}
rank++;
for (auto const& group : dimensions)
dimensions_.push_back(surf_parse_get_int(group));
- linkCountPerNode_ = dimensions_.size();
+ num_links_per_node_ = dimensions_.size();
}
}
if (dst->isRouter() || src->isRouter())
return;
- if (src->id() == dst->id() && hasLoopback_) {
- std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
+ if (src->id() == dst->id() && has_loopback_) {
+ std::pair<surf::LinkImpl*, surf::LinkImpl*> info = private_links_.at(src->id() * num_links_per_node_);
route->link_list.push_back(info.first);
if (lat)
next_node = (current_node + dim_product);
// HERE: We use *CURRENT* node for calculation (as opposed to next_node)
- nodeOffset = current_node * (linkCountPerNode_);
- linkOffset = nodeOffset + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0) + j;
+ nodeOffset = current_node * (num_links_per_node_);
+ linkOffset = nodeOffset + (has_loopback_ ? 1 : 0) + (has_limiter_ ? 1 : 0) + j;
use_lnk_up = true;
assert(linkOffset >= 0);
} else { // Route to the left
next_node = (current_node - dim_product);
// HERE: We use *next* node for calculation (as opposed to current_node!)
- nodeOffset = next_node * (linkCountPerNode_);
- linkOffset = nodeOffset + j + (hasLoopback_ ? 1 : 0) + (hasLimiter_ ? 1 : 0);
+ nodeOffset = next_node * (num_links_per_node_);
+ linkOffset = nodeOffset + j + (has_loopback_ ? 1 : 0) + (has_limiter_ ? 1 : 0);
use_lnk_up = false;
assert(linkOffset >= 0);
std::pair<surf::LinkImpl*, surf::LinkImpl*> info;
- if (hasLimiter_) { // limiter for sender
- info = privateLinks_.at(nodeOffset + (hasLoopback_ ? 1 : 0));
+ if (has_limiter_) { // limiter for sender
+ info = private_links_.at(nodeOffset + (has_loopback_ ? 1 : 0));
route->link_list.push_back(info.first);
}
- info = privateLinks_.at(linkOffset);
+ info = private_links_.at(linkOffset);
if (use_lnk_up == false) {
route->link_list.push_back(info.second);
std::string link_down = "link_" + netpoint->getName() + "_DOWN";
surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
- privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
+ private_links_.insert({netpoint->id(), {linkUp, linkDown}});
}
void VivaldiZone::getLocalRoute(NetPoint* src, NetPoint* dst, RouteCreationArgs* route, double* lat)
}
/* Retrieve the private links */
- auto src_link = privateLinks_.find(src->id());
- if (src_link != privateLinks_.end()) {
+ auto src_link = private_links_.find(src->id());
+ if (src_link != private_links_.end()) {
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = src_link->second;
if (info.first) {
route->link_list.push_back(info.first);
XBT_DEBUG("Source of private link (%u) doesn't exist", src->id());
}
- auto dst_link = privateLinks_.find(dst->id());
- if (dst_link != privateLinks_.end()) {
+ auto dst_link = private_links_.find(dst->id());
+ if (dst_link != private_links_.end()) {
std::pair<surf::LinkImpl*, surf::LinkImpl*> info = dst_link->second;
if (info.second) {
route->link_list.push_back(info.second);
StorageModel::StorageModel() : Model()
{
- maxminSystem_ = new simgrid::kernel::lmm::System(true /* selective update */);
+ maxmin_system_ = new simgrid::kernel::lmm::System(true /* selective update */);
}
StorageModel::~StorageModel()
xbt_die("Unsupported optimization (%s) for this model", optim.c_str());
}
- maxminSystem_ = new simgrid::kernel::lmm::System(select);
+ maxmin_system_ = new simgrid::kernel::lmm::System(select);
if (getUpdateMechanism() == UM_LAZY)
- maxminSystem_->modified_set_ = new kernel::resource::ActionLmmList();
+ maxmin_system_->modified_set_ = new kernel::resource::ActionLmmList();
}
CpuCas01Model::~CpuCas01Model()
if (duration < 0) { // NO_MAX_DURATION
/* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
- action->stateSet_ = &static_cast<CpuCas01Model*>(model())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+ action->state_set_ = &static_cast<CpuCas01Model*>(model())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
action->getStateSet()->push_back(*action);
}
if (duration == NO_MAX_DURATION) {
/* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
simgrid::xbt::intrusive_erase(*action->getStateSet(), *action);
- action->stateSet_ = &static_cast<CpuTiModel*>(model())->runningActionSetThatDoesNotNeedBeingChecked_;
+ action->state_set_ = &static_cast<CpuTiModel*>(model())->runningActionSetThatDoesNotNeedBeingChecked_;
action->getStateSet()->push_back(*action);
}
xbt_die("Unsupported optimization (%s) for this model. Accepted: Full, Lazy.", optim.c_str());
}
- maxminSystem_ = new simgrid::kernel::lmm::System(select);
+ maxmin_system_ = new simgrid::kernel::lmm::System(select);
loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
if (getUpdateMechanism() == UM_LAZY)
- maxminSystem_->modified_set_ = new kernel::resource::ActionLmmList();
+ maxmin_system_->modified_set_ = new kernel::resource::ActionLmmList();
}
NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self)) : NetworkCm02Model()
{
- maxminSystem_->solve_fun = specificSolveFun;
+ maxmin_system_->solve_fun = specificSolveFun;
}
LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
- return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
+ return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxmin_system_);
}
void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
// if I am wearing a latency hat
if (action->getType() == kernel::resource::Action::Type::LATENCY) {
XBT_DEBUG("Latency paid for action %p. Activating", action);
- maxminSystem_->update_variable_weight(action->getVariable(), action->weight_);
+ maxmin_system_->update_variable_weight(action->getVariable(), action->weight_);
action->heapRemove(getActionHeap());
action->refreshLastUpdate();
action.latency_ = 0.0;
}
if (action.latency_ <= 0.0 && not action.isSuspended())
- maxminSystem_->update_variable_weight(action.getVariable(), action.weight_);
+ maxmin_system_->update_variable_weight(action.getVariable(), action.weight_);
}
if (TRACE_is_enabled()) {
int n = action.getVariable()->get_number_of_constraint();
constraints_per_variable += back_route.size();
if (action->latency_ > 0) {
- action->setVariable(maxminSystem_->variable_new(action, 0.0, -1.0, constraints_per_variable));
+ action->setVariable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable));
if (getUpdateMechanism() == UM_LAZY) {
// add to the heap the event when the latency is payed
XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate());
: kernel::resource::Action::Type::LATENCY);
}
} else
- action->setVariable(maxminSystem_->variable_new(action, 1.0, -1.0, constraints_per_variable));
+ action->setVariable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable));
if (action->rate_ < 0) {
- maxminSystem_->update_variable_bound(action->getVariable(),
- (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
+ maxmin_system_->update_variable_bound(
+ action->getVariable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0);
} else {
- maxminSystem_->update_variable_bound(action->getVariable(),
- (action->latCurrent_ > 0)
- ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
- : action->rate_);
+ maxmin_system_->update_variable_bound(action->getVariable(),
+ (action->latCurrent_ > 0)
+ ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))
+ : action->rate_);
}
for (auto const& link : route)
- maxminSystem_->expand(link->constraint(), action->getVariable(), 1.0);
+ maxmin_system_->expand(link->constraint(), action->getVariable(), 1.0);
if (not back_route.empty()) { // sg_network_crosstraffic was activated
XBT_DEBUG("Crosstraffic active adding backward flow using 5%%");
for (auto const& link : back_route)
- maxminSystem_->expand(link->constraint(), action->getVariable(), .05);
+ maxmin_system_->expand(link->constraint(), action->getVariable(), .05);
// Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
// (You would also have to change simgrid::kernel::lmm::Element::get_concurrency())
{
latency_ = latency;
if (latency_ <= 0.0) {
- stateSet_ = model_->getDoneActionSet();
- stateSet_->push_back(*this);
+ state_set_ = model_->getDoneActionSet();
+ state_set_->push_back(*this);
}
};
if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,
(*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->getBound(), (*it)->init_rate);
- maxminSystem_->update_variable_bound((*it)->action->getVariable(), penalized_bw);
+ maxmin_system_->update_variable_bound((*it)->action->getVariable(), penalized_bw);
} else {
XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, (*it)->destination->id,
(*it)->action, penalized_bw, (*it)->init_rate);
refcount_--;
if (not refcount_) {
if (stateSetHook_.is_linked())
- simgrid::xbt::intrusive_erase(*stateSet_, *this);
+ simgrid::xbt::intrusive_erase(*state_set_, *this);
XBT_DEBUG ("Removing action %p", this);
delete this;
return 1;
namespace surf {
HostL07Model::HostL07Model() : HostModel() {
- maxminSystem_ = new simgrid::kernel::lmm::System(true /* selective update */);
- maxminSystem_->solve_fun = &simgrid::kernel::lmm::bottleneck_solve;
- surf_network_model = new NetworkL07Model(this,maxminSystem_);
- surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
+ maxmin_system_ = new simgrid::kernel::lmm::System(true /* selective update */);
+ maxmin_system_->solve_fun = &simgrid::kernel::lmm::bottleneck_solve;
+ surf_network_model = new NetworkL07Model(this, maxmin_system_);
+ surf_cpu_model_pm = new CpuL07Model(this, maxmin_system_);
}
HostL07Model::~HostL07Model()
CpuL07Model::CpuL07Model(HostL07Model* hmodel, lmm_system_t sys) : CpuModel(), hostModel_(hmodel)
{
- maxminSystem_ = sys;
+ maxmin_system_ = sys;
}
CpuL07Model::~CpuL07Model()
{
- maxminSystem_ = nullptr;
+ maxmin_system_ = nullptr;
}
NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, lmm_system_t sys) : NetworkModel(), hostModel_(hmodel)
{
- maxminSystem_ = sys;
+ maxmin_system_ = sys;
loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE);
}
NetworkL07Model::~NetworkL07Model()
{
- maxminSystem_ = nullptr;
+ maxmin_system_ = nullptr;
}
double HostL07Model::nextOccuringEvent(double now)
}
if ((action.latency_ <= 0.0) && (action.isSuspended() == 0)) {
action.updateBound();
- maxminSystem_->update_variable_weight(action.getVariable(), 1.0);
+ maxmin_system_->update_variable_weight(action.getVariable(), 1.0);
}
}
XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.getRemains(),
refcount_--;
if (not refcount_) {
if (stateSetHook_.is_linked())
- simgrid::xbt::intrusive_erase(*stateSet_, *this);
+ simgrid::xbt::intrusive_erase(*state_set_, *this);
if (getVariable())
getModel()->getMaxminSystem()->variable_free(getVariable());
delete this;
current_as->parse_specific_arguments(cluster);
if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){
- current_as->linkCountPerNode_++;
- current_as->hasLoopback_ = true;
+ current_as->num_links_per_node_++;
+ current_as->has_loopback_ = true;
}
if(cluster->limiter_link > 0){
- current_as->linkCountPerNode_++;
- current_as->hasLimiter_ = true;
+ current_as->num_links_per_node_++;
+ current_as->has_limiter_ = true;
}
for (int const& i : *cluster->radicals) {
linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
auto* as_cluster = static_cast<ClusterZone*>(current_as);
- as_cluster->privateLinks_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
+ as_cluster->private_links_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
}
//add a limiter link (shared link to account for maximal bandwidth of the node)
sg_platf_new_link(&link);
linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
linkUp = linkDown;
- current_as->privateLinks_.insert({current_as->nodePositionWithLoopback(rankId), {linkUp, linkDown}});
+ current_as->private_links_.insert({current_as->nodePositionWithLoopback(rankId), {linkUp, linkDown}});
}
//call the cluster function that adds the others links
auto* as_cluster = static_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
- if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end())
+ if (as_cluster->private_links_.find(netpoint->id()) != as_cluster->private_links_.end())
surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!");
XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->getCname(), netpoint->id());
- as_cluster->privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
+ as_cluster->private_links_.insert({netpoint->id(), {linkUp, linkDown}});
}
void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace)
"property Bwrite, storage", type_id.c_str());
StorageImpl* storage =
- new StorageN11(this, id, maxminSystem_, Bread, Bwrite, type_id, content_name, storage_type->size, attach);
+ new StorageN11(this, id, maxmin_system_, Bread, Bwrite, type_id, content_name, storage_type->size, attach);
storageCreatedCallbacks(storage);
XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tBread '%f'\n", id.c_str(), type_id.c_str(),
refcount_--;
if (not refcount_) {
if (stateSetHook_.is_linked())
- simgrid::xbt::intrusive_erase(*stateSet_, *this);
+ simgrid::xbt::intrusive_erase(*state_set_, *this);
if (getVariable())
getModel()->getMaxminSystem()->variable_free(getVariable());
xbt_free(getCategory());