WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
S4U_Simulation.h
1 
11 #ifndef WRENCH_S4U_SIMULATION_H
12 #define WRENCH_S4U_SIMULATION_H
13 
14 #include <set>
15 #include <simgrid/s4u.hpp>
16 #include <simgrid/kernel/routing/ClusterZone.hpp>
17 
18 namespace wrench {
19 
20 
21  /***********************/
23  /***********************/
24 
28  class S4U_Simulation {
29 
30  public:
32  static constexpr double DEFAULT_RAM = (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0); // 1 PiB
33 
34  public:
35  void initialize(int *argc, char **argv);
36  void setupPlatform(std::string&);
37  void setupPlatform(const std::function<void()>& creation_function);
38  void runSimulation();
39  static double getClock();
40  static std::string getHostName();
41  static bool hostExists(std::string hostname);
42  static bool linkExists(std::string linkname);
43  static std::vector<std::string> getRoute(std::string &src_host, std::string &dst_host);
44  static unsigned int getHostNumCores(std::string hostname);
45  static unsigned int getNumCores();
46  static double getHostFlopRate(std::string hostname);
47  static bool isHostOn(std::string hostname);
48  static void turnOffHost(std::string hostname);
49  static void turnOnHost(std::string hostname);
50  static bool isLinkOn(std::string linkname);
51  static void turnOffLink(std::string linkname);
52  static void turnOnLink(std::string linkname);
53  static double getFlopRate();
54  static double getHostMemoryCapacity(std::string hostname);
55  static double getMemoryCapacity();
56  static void compute(double);
57  static void sleep(double);
58  static void computeZeroFlop();
59  static void writeToDisk(double num_bytes, std::string hostname, std::string mount_point);
60  static void readFromDisk(double num_bytes, std::string hostname, std::string mount_point);
61  static void readFromDiskAndWriteToDiskConcurrently(double num_bytes_to_read, double num_bytes_to_write,
62  std::string hostname,
63  std::string read_mount_point,
64  std::string write_mount_point);
65 
66  static double getDiskCapacity(std::string hostname, std::string mount_point);
67  static std::vector<std::string> getDisks(std::string hostname);
68  static bool hostHasMountPoint(std::string hostname, std::string mount_point);
69 
70  void checkLinkBandwidths();
71 
72  static void yield();
73  static std::string getHostProperty(std::string hostname, std::string property_name);
74  static void setHostProperty(std::string hostname, std::string property_name, std::string property_value);
75 
76  //start energy related calls
77  static double getEnergyConsumedByHost(const std::string &hostname);
78 // static double getTotalEnergyConsumed(const std::vector<std::string> &hostnames);
79  static void setPstate(const std::string &hostname, unsigned long pstate);
80  static int getNumberofPstates(const std::string &hostname);
81  static unsigned long getCurrentPstate(const std::string &hostname);
82  static double getMinPowerConsumption(const std::string &hostname);
83  static double getMaxPowerConsumption(const std::string &hostname);
84  static std::vector<int> getListOfPstates(const std::string &hostname);
85  //end energy related calls
86 
87  bool isInitialized();
88  bool isPlatformSetup();
89  static std::vector<std::string> getAllHostnames();
90  static std::vector<std::string> getAllLinknames();
91  static double getLinkBandwidth(std::string name);
92  static double getLinkUsage(std::string name);
93  static std::map<std::string, std::vector<std::string>> getAllHostnamesByCluster();
94  void shutdown();
95 
96  private:
97  static double getHostMemoryCapacity(simgrid::s4u::Host *host);
98  simgrid::s4u::Engine *engine;
99  bool initialized = false;
100  bool platform_setup = false;
101 
102  };
103 
104  /***********************/
106  /***********************/
107 };
108 
109 #endif //WRENCH_S4U_SIMULATION_H
wrench
Definition: Action.cpp:28