Wrappers around S4U's basic simulation methods. More...
#include <S4U_Simulation.h>
Public Member Functions | |
void | checkLinkBandwidths () |
Method to check that all link bandwidths are >0. | |
void | initialize (int *argc, char **argv) |
Initialize the Simgrid simulation. More... | |
bool | isInitialized () |
Returns true if S4U_Simulation::initialize() has been called successfully previously. More... | |
bool | isPlatformSetup () |
Returns true if S4U_Simulation::setupPlatform() has been called successfully previously. More... | |
void | runSimulation () |
Start the simulation. More... | |
void | setupPlatform (std::string &) |
Initialize the simulated platform. Must only be called once. More... | |
void | shutdown () |
Shutdown the simulation. | |
Static Public Member Functions | |
static void | compute (double) |
Simulates a computation on host on which the calling actor is running. More... | |
static void | computeZeroFlop () |
Compute zero flop, which take zero time but will block if the host's pstate has a zero flop/sec speed, until the host's pstate is changed to a pstate with non-zero flop/sec speed. | |
static std::vector< std::string > | getAllHostnames () |
Get the list of hostnames. More... | |
static std::map< std::string, std::vector< std::string > > | getAllHostnamesByCluster () |
Get the by-cluster structure of the platform. More... | |
static std::vector< std::string > | getAllLinknames () |
Get the list of link names. More... | |
static double | getClock () |
Get the current simulation date. More... | |
static int | getCurrentPstate (const std::string &hostname) |
Get the current power state of a host. More... | |
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. More... | |
static std::vector< std::string > | getDisks (std::string hostname) |
Gets set of disks, i.e., mount points, available at a host. More... | |
static double | getEnergyConsumedByHost (const std::string &hostname) |
Get the energy consumed by the host up to now. More... | |
static double | getFlopRate () |
Get the flop rate of the current host. More... | |
static double | getHostFlopRate (std::string hostname) |
Get the flop rate of a host. More... | |
static double | getHostMemoryCapacity (std::string hostname) |
Get the memory capacity of a host given a hostname. More... | |
static std::string | getHostName () |
Get the hostname on which the calling actor is running. More... | |
static unsigned int | getHostNumCores (std::string hostname) |
Get the number of cores of a host. More... | |
static std::string | getHostProperty (std::string hostname, std::string property_name) |
Get the property associated to the host specified in the platform file. More... | |
static double | getLinkBandwidth (std::string name) |
Get a link's bandwidth. More... | |
static double | getLinkUsage (std::string name) |
Get a link's bandwidth usage. More... | |
static std::vector< int > | getListOfPstates (const std::string &hostname) |
Get the list of power states available for a host. More... | |
static double | getMaxPowerConsumption (const std::string &hostname) |
Get the maximum power consumption (i.e., 100% load) for a host at its current pstate. More... | |
static double | getMemoryCapacity () |
Get the memory capacity of the current host. More... | |
static double | getMinPowerConsumption (const std::string &hostname) |
Get the minimum power consumption (i.e., idling) for a host at its current pstate. More... | |
static int | getNumberofPstates (const std::string &hostname) |
Get the total number of power states of a host. More... | |
static unsigned int | getNumCores () |
Get the number of cores of the current host. More... | |
static bool | hostExists (std::string hostname) |
Determines whether a host exists for a given hostname. More... | |
static bool | hostHasMountPoint (std::string hostname, std::string mount_point) |
Determines whether a mount point is defined at a host. More... | |
static bool | isHostOn (std::string hostname) |
Returns whether a host is on or not. More... | |
static bool | isLinkOn (std::string linkname) |
Returns whether a link is on or not. More... | |
static bool | linkExists (std::string linkname) |
Determines whether a link exists for a given linkname. More... | |
static void | readFromDisk (double num_bytes, std::string hostname, std::string mount_point) |
Simulates a disk read. More... | |
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. More... | |
static void | setPstate (const std::string &hostname, int pstate) |
Set the power state of the host. More... | |
static void | sleep (double) |
Simulates a sleep. More... | |
static void | turnOffHost (std::string hostname) |
Turn off a host. More... | |
static void | turnOffLink (std::string linkname) |
Turn off a link. More... | |
static void | turnOnHost (std::string hostname) |
Turn on a host. More... | |
static void | turnOnLink (std::string linkname) |
Turn on a link. More... | |
static void | writeToDisk (double num_bytes, std::string hostname, std::string mount_point) |
Simulates a disk write. More... | |
static void | yield () |
Simulates a yield. | |
Static Public Attributes | |
static constexpr double | DEFAULT_RAM = (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0) |
The ram capacity of a physical host whenever not specified in the platform description file. | |
Detailed Description
Wrappers around S4U's basic simulation methods.
Member Function Documentation
◆ compute()
|
static |
Simulates a computation on host on which the calling actor is running.
- Parameters
-
flops the number of flops
◆ getAllHostnames()
|
static |
Get the list of hostnames.
- Returns
- a vector of hostnames
◆ getAllHostnamesByCluster()
|
static |
Get the by-cluster structure of the platform.
- Returns
- a map of all cluster names and their associated hostname list
◆ getAllLinknames()
|
static |
Get the list of link names.
- Returns
- a vector of link names
◆ getClock()
|
static |
Get the current simulation date.
- Returns
- the simulation clock
◆ getCurrentPstate()
|
static |
Get the current power state of a host.
- Parameters
-
hostname the host name
- Returns
- The index of the current pstate of the host (as specified in the platform xml description file)
- Exceptions
-
std::runtime_error
◆ getDiskCapacity()
|
static |
Gets the capacity of a disk attached to some host for a given mount point.
- Parameters
-
hostname the host's name mount_point the mount point (e.g., "/home")
- Returns
- the capacity of the disk / mount point
- Exceptions
-
std::invalid_argument
◆ getDisks()
|
static |
Gets set of disks, i.e., mount points, available at a host.
- Parameters
-
hostname the host's name
- Returns
- a vector of mount points
- Exceptions
-
std::invalid_argument
◆ getEnergyConsumedByHost()
|
static |
Get the energy consumed by the host up to now.
- Parameters
-
hostname the host name
- Returns
- the energy consumed by the host in Joules
- Exceptions
-
std::invalid_argument std::runtime_error
◆ getFlopRate()
|
static |
Get the flop rate of the current host.
- Returns
- the flop rate in floating point operations per second
- Exceptions
-
std::invalid_argument
◆ getHostFlopRate()
|
static |
Get the flop rate of a host.
- Parameters
-
hostname the name of the host
- Returns
- the flop rate in floating point operations per second
- Exceptions
-
std::invalid_argument
◆ getHostMemoryCapacity()
|
static |
Get the memory capacity of a host given a hostname.
- Parameters
-
hostname the name of the host
- Returns
- a memory capacity in bytes
◆ getHostName()
|
static |
Get the hostname on which the calling actor is running.
- Returns
- the hostname as a string
◆ getHostNumCores()
|
static |
Get the number of cores of a host.
- Parameters
-
hostname the name of the host
- Returns
- the number of cores of the host
- Exceptions
-
std::invalid_argument
◆ getHostProperty()
|
static |
Get the property associated to the host specified in the platform file.
- Parameters
-
hostname the host name property_name the property name
- Returns
- a string relating to the property specified in the platform file
◆ getLinkBandwidth()
|
static |
Get a link's bandwidth.
- Parameters
-
name the link's name
- Returns
- a bandwidth in Bps
◆ getLinkUsage()
|
static |
Get a link's bandwidth usage.
- Parameters
-
name the link's name
- Returns
- a bandwidth usage in Bps
◆ getListOfPstates()
|
static |
Get the list of power states available for a host.
- Parameters
-
hostname the host name
- Returns
- a list of power states available for the host (as specified in the platform xml description file)
- Exceptions
-
std::invalid_argument std::runtime_error
◆ getMaxPowerConsumption()
|
static |
Get the maximum power consumption (i.e., 100% load) for a host at its current pstate.
- Parameters
-
hostname the host name
- Returns
- The power consumption for this host if 100% used (as specified in the platform xml description file)
- Exceptions
-
std::invalid_argument std::runtime_error
◆ getMemoryCapacity()
|
static |
Get the memory capacity of the current host.
- Returns
- a memory capacity in bytes
◆ getMinPowerConsumption()
|
static |
Get the minimum power consumption (i.e., idling) for a host at its current pstate.
- Parameters
-
hostname the host name
- Returns
- The power consumption for this host if idle (as specified in the platform xml description file)
- Exceptions
-
std::invalid_argument std::runtime_error
◆ getNumberofPstates()
|
static |
Get the total number of power states of a host.
- Parameters
-
hostname the host name
- Returns
- The number of power states available for the host (as specified in the platform xml description file)
- Exceptions
-
std::invalid_argument std::runtime_error
◆ getNumCores()
|
static |
Get the number of cores of the current host.
- Returns
- a number of cores
◆ hostExists()
|
static |
Determines whether a host exists for a given hostname.
- Parameters
-
hostname the name of the host
- Returns
- true or false
◆ hostHasMountPoint()
|
static |
Determines whether a mount point is defined at a host.
- Parameters
-
hostname the host's name mount_point the mount point
- Returns
- true if the host has a disk attached to the specified mount point, false otherwise
◆ initialize()
void wrench::S4U_Simulation::initialize | ( | int * | argc, |
char ** | argv | ||
) |
Initialize the Simgrid simulation.
- Parameters
-
argc the C-style argument counts argv the C-style argument list
◆ isHostOn()
|
static |
Returns whether a host is on or not.
- Parameters
-
hostname the name of the host
- Returns
- true or false
- Exceptions
-
std::invalid_argument
◆ isInitialized()
bool wrench::S4U_Simulation::isInitialized | ( | ) |
Returns true if S4U_Simulation::initialize() has been called successfully previously.
- Returns
- true or false
◆ isLinkOn()
|
static |
Returns whether a link is on or not.
- Parameters
-
linkname the name of the link
- Returns
- true or false
- Exceptions
-
std::invalid_argument
◆ isPlatformSetup()
bool wrench::S4U_Simulation::isPlatformSetup | ( | ) |
Returns true if S4U_Simulation::setupPlatform() has been called successfully previously.
- Returns
- true or false
◆ linkExists()
|
static |
Determines whether a link exists for a given linkname.
- Parameters
-
linkname the name of the link
- Returns
- true or false
◆ readFromDisk()
|
static |
Simulates a disk read.
- Parameters
-
num_bytes number of bytes to read hostname name of host to which disk is attached mount_point mount point
◆ readFromDiskAndWriteToDiskConcurrently()
|
static |
Read from a local disk and write to a local disk concurrently.
- Parameters
-
num_bytes_to_read number of bytes to read num_bytes_to_write number of bytes to write hostname the host at which the disks are located read_mount_point the mountpoint to read from write_mount_point the mountpoint to write to
◆ runSimulation()
void wrench::S4U_Simulation::runSimulation | ( | ) |
Start the simulation.
- Exceptions
-
std::runtime_error
◆ setPstate()
|
static |
Set the power state of the host.
- Parameters
-
hostname the host name pstate the power state index (the power state index is specified in the platform xml description file)
- Exceptions
-
std::invalid_argument std::runtime_error
◆ setupPlatform()
void wrench::S4U_Simulation::setupPlatform | ( | std::string & | filename | ) |
Initialize the simulated platform. Must only be called once.
- Parameters
-
filename the path to an XML platform description file
- Exceptions
-
std::invalid_argument
◆ sleep()
|
static |
Simulates a sleep.
- Parameters
-
duration the number of seconds to sleep
◆ turnOffHost()
|
static |
Turn off a host.
- Parameters
-
hostname the name of the host to turn off
- Exceptions
-
std::invalid_argument
◆ turnOffLink()
|
static |
Turn off a link.
- Parameters
-
linkname the name of the link to turn off
- Exceptions
-
std::invalid_argument
◆ turnOnHost()
|
static |
Turn on a host.
- Parameters
-
hostname the name of the host to turn on
- Exceptions
-
std::invalid_argument
◆ turnOnLink()
|
static |
Turn on a link.
- Parameters
-
linkname the name of the link to turn on
- Exceptions
-
std::invalid_argument
◆ writeToDisk()
|
static |
Simulates a disk write.
- Parameters
-
num_bytes number of bytes to write hostname name of host to which disk is attached mount_point mount point
The documentation for this class was generated from the following files:
- S4U_Simulation.h
- S4U_Simulation.cpp