Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a deque instead of an intrusive hook for all VMs
[simgrid.git] / src / surf / network_ib.hpp
1 /* Copyright (c) 2014-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #ifndef SURF_NETWORK_IB_HPP_
8 #define SURF_NETWORK_IB_HPP_
9
10 #include <xbt/base.h>
11
12 #include "network_smpi.hpp"
13
14 namespace simgrid {
15   namespace surf {
16
17     class XBT_PRIVATE IBNode;
18
19     class XBT_PRIVATE ActiveComm{
20     public :
21       //IBNode* origin;
22       IBNode* destination;
23       NetworkAction *action;
24       double init_rate;
25       ActiveComm() : destination(nullptr),action(nullptr),init_rate(-1){};
26       ~ActiveComm(){};
27     };
28
29     class IBNode{
30     public :
31       int id;
32       //store related links, to ease computation of the penalties
33       std::vector<ActiveComm*> ActiveCommsUp;
34       //store the number of comms received from each node
35       std::map<IBNode*, int> ActiveCommsDown;
36       //number of comms the node is receiving
37       int nbActiveCommsDown;
38       explicit IBNode(int id) : id(id),nbActiveCommsDown(0){};
39       ~IBNode(){};
40     };
41
42     class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
43     private:
44       void updateIBfactors_rec(IBNode *root, bool* updatedlist);
45       void computeIBfactors(IBNode *root);
46     public:
47       NetworkIBModel();
48       explicit NetworkIBModel(const char *name);
49       ~NetworkIBModel() override;
50       void updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove);
51
52       xbt_dict_t active_nodes;
53       std::map<NetworkAction *, std::pair<IBNode*,IBNode*> > active_comms;
54
55       double Bs;
56       double Be;
57       double ys;
58
59     };
60
61   }
62 }
63
64 #endif