1 /* Copyright (c) 2014-2020. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef SURF_NETWORK_IB_HPP_
8 #define SURF_NETWORK_IB_HPP_
10 #include "src/surf/network_smpi.hpp"
20 class XBT_PRIVATE IBNode;
22 struct XBT_PRIVATE ActiveComm {
23 IBNode* destination = nullptr;
24 NetworkAction* action = nullptr;
25 double init_rate = -1;
31 // store related links, to ease computation of the penalties
32 std::vector<ActiveComm*> ActiveCommsUp;
33 // store the number of comms received from each node
34 std::map<IBNode*, int> ActiveCommsDown;
35 // number of comms the node is receiving
36 int nbActiveCommsDown = 0;
37 explicit IBNode(int id) : id(id){};
38 virtual ~IBNode() = default;
41 class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
45 void updateIBfactors_rec(IBNode* root, std::vector<bool>& updatedlist) const;
46 void computeIBfactors(IBNode* root) const;
50 explicit NetworkIBModel(const char* name);
51 NetworkIBModel(const NetworkIBModel&) = delete;
52 NetworkIBModel& operator=(const NetworkIBModel&) = delete;
53 void updateIBfactors(NetworkAction* action, IBNode* from, IBNode* to, int remove) const;
55 std::unordered_map<std::string, IBNode> active_nodes;
56 std::unordered_map<NetworkAction*, std::pair<IBNode*, IBNode*>> active_comms;
58 } // namespace resource
60 } // namespace simgrid