11 #ifndef WRENCH_S4U_SIMULATION_H
12 #define WRENCH_S4U_SIMULATION_H
15 #include <simgrid/s4u.hpp>
16 #include <simgrid/kernel/routing/ClusterZone.hpp>
28 class S4U_Simulation {
32 static constexpr
double DEFAULT_RAM = (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0);
35 void initialize(
int *argc,
char **argv);
36 void setupPlatform(std::string&);
37 void setupPlatform(
const std::function<
void()>& creation_function);
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,
63 std::string read_mount_point,
64 std::string write_mount_point);
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);
70 void checkLinkBandwidths();
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);
77 static double getEnergyConsumedByHost(
const std::string &hostname);
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);
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();
97 static double getHostMemoryCapacity(simgrid::s4u::Host *host);
98 simgrid::s4u::Engine *engine;
99 bool initialized =
false;
100 bool platform_setup =
false;
109 #endif //WRENCH_S4U_SIMULATION_H