11 #ifndef WRENCH_S4U_SIMULATION_H
12 #define WRENCH_S4U_SIMULATION_H
15 #include <simgrid/s4u.hpp>
16 #include <simgrid/kernel/routing/ClusterZone.hpp>
32 static constexpr
double DEFAULT_RAM = (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0);
37 void setupPlatform(
const std::function<
void()>& creation_function);
43 static std::vector<std::string>
getRoute(std::string &src_host, std::string &dst_host);
47 static bool isHostOn(std::string hostname);
50 static bool isLinkOn(std::string linkname);
57 static void sleep(
double);
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);
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);
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);
79 static void setPstate(
const std::string &hostname,
unsigned long pstate);
98 simgrid::s4u::Engine *engine;
99 bool initialized =
false;
100 bool platform_setup =
false;
109 #endif //WRENCH_S4U_SIMULATION_H
static double getLinkBandwidth(std::string name)
Get a link's bandwidth.
Definition: S4U_Simulation.cpp:182
static double getDiskCapacity(std::string hostname, std::string mount_point)
Gets the capacity of a disk attached to some host for a given mount point.
Definition: S4U_Simulation.cpp:928
static void readFromDiskAndWriteToDiskConcurrently(double num_bytes_to_read, double num_bytes_to_write, std::string hostname, std::string read_mount_point, std::string write_mount_point)
Read from a local disk and write to a local disk concurrently.
Definition: S4U_Simulation.cpp:451
static std::vector< std::string > getAllLinknames()
Get the list of link names.
Definition: S4U_Simulation.cpp:166
static void setHostProperty(std::string hostname, std::string property_name, std::string property_value)
Set a property associated to a host specified in the platform file.
Definition: S4U_Simulation.cpp:617
static void turnOffHost(std::string hostname)
Turn off a host.
Definition: S4U_Simulation.cpp:315
void initialize(int *argc, char **argv)
Initialize the Simgrid simulation.
Definition: S4U_Simulation.cpp:35
static bool linkExists(std::string linkname)
Determines whether a link exists for a given linkname.
Definition: S4U_Simulation.cpp:248
static double getHostFlopRate(std::string hostname)
Get the flop rate of a host.
Definition: S4U_Simulation.cpp:284
static std::map< std::string, std::vector< std::string > > getAllHostnamesByCluster()
Get the by-cluster structure of the platform.
Definition: S4U_Simulation.cpp:214
static std::vector< std::string > getRoute(std::string &src_host, std::string &dst_host)
Get the list of link names on the route between two hosts.
Definition: S4U_Simulation.cpp:898
static int getNumberofPstates(const std::string &hostname)
Get the total number of power states of a host.
Definition: S4U_Simulation.cpp:707
static double getFlopRate()
Get the flop rate of the current host.
Definition: S4U_Simulation.cpp:391
static void turnOffLink(std::string linkname)
Turn off a link.
Definition: S4U_Simulation.cpp:361
static std::vector< int > getListOfPstates(const std::string &hostname)
Get the list of power states available for a host.
Definition: S4U_Simulation.cpp:796
static double getEnergyConsumedByHost(const std::string &hostname)
Get the energy consumed by the host up to now.
Definition: S4U_Simulation.cpp:632
static double getMemoryCapacity()
Get the memory_manager_service capacity of the current host.
Definition: S4U_Simulation.cpp:553
static unsigned long getCurrentPstate(const std::string &hostname)
Get the current power state of a host.
Definition: S4U_Simulation.cpp:728
static unsigned int getNumCores()
Get the number of cores of the current host.
Definition: S4U_Simulation.cpp:272
void setupPlatform(std::string &)
Initialize the simulated platform. Must only be called once.
Definition: S4U_Simulation.cpp:102
Definition: Action.cpp:28
static void compute(double)
Simulates a computation on host on which the calling actor is running.
Definition: S4U_Simulation.cpp:408
static void computeZeroFlop()
Compute zero flop, which take zero time but will block if the host's pstate has a zero flop/sec speed...
Definition: S4U_Simulation.cpp:823
static bool hostHasMountPoint(std::string hostname, std::string mount_point)
Determines whether a mount point is defined at a host.
Definition: S4U_Simulation.cpp:866
void shutdown()
Shutdown the simulation.
Definition: S4U_Simulation.cpp:76
bool isPlatformSetup()
Returns true if S4U_Simulation::setupPlatform() has been called successfully previously.
Definition: S4U_Simulation.cpp:56
static void turnOnLink(std::string linkname)
Turn on a link.
Definition: S4U_Simulation.cpp:376
bool isInitialized()
Returns true if S4U_Simulation::initialize() has been called successfully previously.
Definition: S4U_Simulation.cpp:48
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:750
static std::string getHostName()
Get the hostname on which the calling actor is running.
Definition: S4U_Simulation.cpp:138
static unsigned int getHostNumCores(std::string hostname)
Get the number of cores of a host.
Definition: S4U_Simulation.cpp:260
static std::vector< std::string > getDisks(std::string hostname)
Gets set of disks, i.e., mount points, available at a host.
Definition: S4U_Simulation.cpp:837
static void yield()
Simulates a yield.
Definition: S4U_Simulation.cpp:532
static void writeToDisk(double num_bytes, std::string hostname, std::string mount_point)
Simulates a disk write.
Definition: S4U_Simulation.cpp:419
static void sleep(double)
Simulates a sleep.
Definition: S4U_Simulation.cpp:525
static std::vector< std::string > getAllHostnames()
Get the list of physical hostnames.
Definition: S4U_Simulation.cpp:148
static void readFromDisk(double num_bytes, std::string hostname, std::string mount_point)
Simulates a disk read.
Definition: S4U_Simulation.cpp:495
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:600
static void turnOnHost(std::string hostname)
Turn on a host.
Definition: S4U_Simulation.cpp:330
static bool isLinkOn(std::string linkname)
Returns whether a link is on or not.
Definition: S4U_Simulation.cpp:346
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:772
static double getLinkUsage(std::string name)
Get a link's bandwidth usage.
Definition: S4U_Simulation.cpp:198
void checkLinkBandwidths()
Method to check that all link bandwidths are >0.
Definition: S4U_Simulation.cpp:85
static double getClock()
Get the current simulation date.
Definition: S4U_Simulation.cpp:400
static bool isHostOn(std::string hostname)
Returns whether a host is on or not.
Definition: S4U_Simulation.cpp:300
Wrappers around S4U's basic simulation methods.
Definition: S4U_Simulation.h:28
void runSimulation()
Start the simulation.
Definition: S4U_Simulation.cpp:65
static constexpr double DEFAULT_RAM
The ram capacity of a physical host whenever not specified in the platform description file.
Definition: S4U_Simulation.h:32
static double getHostMemoryCapacity(std::string hostname)
Get the memory_manager_service capacity of a host given a hostname.
Definition: S4U_Simulation.cpp:541
static void setPstate(const std::string &hostname, unsigned long pstate)
Set the power state of the host.
Definition: S4U_Simulation.cpp:680
static bool hostExists(std::string hostname)
Determines whether a host exists for a given hostname.
Definition: S4U_Simulation.cpp:239