S4U_Simulation.h
1 
11 #ifndef WRENCH_S4U_SIMULATION_H
12 #define WRENCH_S4U_SIMULATION_H
13 
14 #include <simgrid/s4u.hpp>
15 #include <simgrid/kernel/routing/ClusterZone.hpp>
16 
17 namespace wrench {
18 
19  /***********************/
21  /***********************/
22 
27 
28  public:
29  void initialize(int *argc, char **argv);
30  void setupPlatform(std::string&);
31  void runSimulation();
32  static double getClock();
33  static std::string getHostName();
34  static bool hostExists(std::string hostname);
35  static unsigned int getHostNumCores(std::string hostname);
36  static double getHostFlopRate(std::string hostname);
37  static double getFlopRate();
38  static double getHostMemoryCapacity(std::string hostname);
39  static double getMemoryCapacity();
40  static void compute(double);
41  static void sleep(double);
42  static void computeZeroFlop();
43  static std::string getHostProperty(std::string hostname, std::string property_name);
44 
45  //start energy related calls
46  static double getEnergyConsumedByHost(const std::string &hostname);
47  static double getTotalEnergyConsumed(const std::vector<std::string> &hostnames);
48  static void setPstate(const std::string &hostname, int pstate);
49  static int getNumberofPstates(const std::string &hostname);
50  static int getCurrentPstate(const std::string &hostname);
51  static double getMinPowerConsumption(const std::string &hostname);
52  static double getMaxPowerConsumption(const std::string &hostname);
53  static std::vector<int> getListOfPstates(const std::string &hostname);
54  //end energy related calls
55 
56  bool isInitialized();
57  bool isPlatformSetup();
58  std::vector<std::string> getAllHostnames();
59  static std::map<std::string, std::vector<std::string>> getAllHostnamesByCluster();
60  void shutdown();
61 
62 
63  private:
64  static double getHostMemoryCapacity(simgrid::s4u::Host *host);
65  simgrid::s4u::Engine *engine;
66  bool initialized = false;
67  bool platform_setup = false;
68  };
69 
70  /***********************/
72  /***********************/
73 };
74 
75 #endif //WRENCH_S4U_SIMULATION_H
static std::string getHostProperty(std::string hostname, std::string property_name)
Get the property associated to the host specified in the platform file.
Definition: S4U_Simulation.cpp:287
std::vector< std::string > getAllHostnames()
Get the list of hostnames.
Definition: S4U_Simulation.cpp:108
Wrappers around S4U&#39;s basic simulation methods.
Definition: S4U_Simulation.h:26
static void computeZeroFlop()
Compute zero flop, which take zero time but will block if the host&#39;s pstate has a zero flop/sec speed...
Definition: S4U_Simulation.cpp:446
void shutdown()
Shutdown the simulation.
Definition: S4U_Simulation.cpp:73
bool isInitialized()
Returns true if S4U_Simulation::initialize() has been called successfully previously.
Definition: S4U_Simulation.cpp:45
static std::string getHostName()
Get the hostname on which the calling actor is running.
Definition: S4U_Simulation.cpp:99
static double getClock()
Get the current simulation date.
Definition: S4U_Simulation.cpp:205
static bool hostExists(std::string hostname)
Determines whether a host exists for a given hostname.
Definition: S4U_Simulation.cpp:147
bool isPlatformSetup()
Returns true if S4U_Simulation::setupPlatform() has been called successfully previously.
Definition: S4U_Simulation.cpp:53
static double getHostMemoryCapacity(std::string hostname)
Get the memory capacity of a host given a hostname.
Definition: S4U_Simulation.cpp:244
void initialize(int *argc, char **argv)
Initialize the Simgrid simulation.
Definition: S4U_Simulation.cpp:35
static double getMaxPowerConsumption(const std::string &hostname)
Get the maximum power consumption (i.e., 100% load) for a host at its current pstate.
Definition: S4U_Simulation.cpp:407
static std::vector< int > getListOfPstates(const std::string &hostname)
Get the list of power states available for a host.
Definition: S4U_Simulation.cpp:425
void runSimulation()
Start the simulation.
Definition: S4U_Simulation.cpp:62
static double getHostFlopRate(std::string hostname)
Get the flop rate of a host.
Definition: S4U_Simulation.cpp:177
static void setPstate(const std::string &hostname, int pstate)
Set the power state of the host.
Definition: S4U_Simulation.cpp:338
static int getNumberofPstates(const std::string &hostname)
Get the total number of power states of a host.
Definition: S4U_Simulation.cpp:355
static double getFlopRate()
Get the flop rate of the current host.
Definition: S4U_Simulation.cpp:194
static void compute(double)
Simulates a computation on host on which the calling actor is running.
Definition: S4U_Simulation.cpp:215
static double getTotalEnergyConsumed(const std::vector< std::string > &hostnames)
Get the total energy consumed by a set of hosts.
Definition: S4U_Simulation.cpp:317
static double getMemoryCapacity()
Get the memory capacity of the current host.
Definition: S4U_Simulation.cpp:252
void setupPlatform(std::string &)
Initialize the simulated platform. Must only be called once. Due to the current SimGrid implementatio...
Definition: S4U_Simulation.cpp:87
static int getCurrentPstate(const std::string &hostname)
Get the current power state of a host.
Definition: S4U_Simulation.cpp:372
static std::map< std::string, std::vector< std::string > > getAllHostnamesByCluster()
Get the by-cluster structure of the platform.
Definition: S4U_Simulation.cpp:122
static double getMinPowerConsumption(const std::string &hostname)
Get the minimum power consumption (i.e., idling) for a host at its current pstate.
Definition: S4U_Simulation.cpp:389
static unsigned int getHostNumCores(std::string hostname)
Get the number of cores of a host.
Definition: S4U_Simulation.cpp:159
static void sleep(double)
Simulates a sleep.
Definition: S4U_Simulation.cpp:230
static double getEnergyConsumedByHost(const std::string &hostname)
Get the energy consumed by the host up to now.
Definition: S4U_Simulation.cpp:298
Definition: TerminalOutput.cpp:15