Wrappers around S4U's basic simulation methods. More...

#include <S4U_Simulation.h>

Public Member Functions

std::vector< std::string > getAllHostnames ()
 Get the list of hostnames. More...
 
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. Due to the current SimGrid implementation, if the file is not readable or not correctly formatted, this method will call exit() instead of throwing an exception. 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::map< std::string, std::vector< std::string > > getAllHostnamesByCluster ()
 Get the by-cluster structure of the platform. 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 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 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 double getTotalEnergyConsumed (const std::vector< std::string > &hostnames)
 Get the total energy consumed by a set of hosts. More...
 
static bool hostExists (std::string hostname)
 Determines whether a host exists for a given hostname. 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...
 

Detailed Description

Wrappers around S4U's basic simulation methods.

Member Function Documentation

◆ compute()

void wrench::S4U_Simulation::compute ( double  flops)
static

Simulates a computation on host on which the calling actor is running.

Parameters
flopsthe number of flops
Exceptions
std::shared_ptr<HostError>

◆ getAllHostnames()

std::vector< std::string > wrench::S4U_Simulation::getAllHostnames ( )

Get the list of hostnames.

Returns
a vector of hostnames

◆ getAllHostnamesByCluster()

std::map< std::string, std::vector< std::string > > wrench::S4U_Simulation::getAllHostnamesByCluster ( )
static

Get the by-cluster structure of the platform.

Returns
a map of all cluster names and their associated hostname list

◆ getClock()

double wrench::S4U_Simulation::getClock ( )
static

Get the current simulation date.

Returns
the simulation clock

◆ getCurrentPstate()

int wrench::S4U_Simulation::getCurrentPstate ( const std::string &  hostname)
static

Get the current power state of a host.

Parameters
hostnamethe host name
Returns
The index of the current pstate of the host (as specified in the platform xml description file)
Exceptions
std::runtime_error

◆ getEnergyConsumedByHost()

double wrench::S4U_Simulation::getEnergyConsumedByHost ( const std::string &  hostname)
static

Get the energy consumed by the host up to now.

Parameters
hostnamethe host name
Returns
the energy consumed by the host in Joules
Exceptions
std::runtime_error

◆ getFlopRate()

double wrench::S4U_Simulation::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()

double wrench::S4U_Simulation::getHostFlopRate ( std::string  hostname)
static

Get the flop rate of a host.

Parameters
hostnamethe name of the host
Returns
the flop rate in floating point operations per second
Exceptions
std::invalid_argument

◆ getHostMemoryCapacity()

double wrench::S4U_Simulation::getHostMemoryCapacity ( std::string  hostname)
static

Get the memory capacity of a host given a hostname.

Parameters
hostnamethe name of the host
Returns
a memory capacity in bytes

◆ getHostName()

std::string wrench::S4U_Simulation::getHostName ( )
static

Get the hostname on which the calling actor is running.

Returns
the hostname as a string

◆ getHostNumCores()

unsigned int wrench::S4U_Simulation::getHostNumCores ( std::string  hostname)
static

Get the number of cores of a host.

Parameters
hostnamethe name of the host
Returns
the number of cores of the host
Exceptions
std::invalid_argument

◆ getHostProperty()

std::string wrench::S4U_Simulation::getHostProperty ( std::string  hostname,
std::string  property_name 
)
static

Get the property associated to the host specified in the platform file.

Returns
a string relating to the property specified in the platform file

◆ getListOfPstates()

std::vector< int > wrench::S4U_Simulation::getListOfPstates ( const std::string &  hostname)
static

Get the list of power states available for a host.

Parameters
hostnamethe host name
Returns
a list of power states available for the host (as specified in the platform xml description file)
Exceptions
std::runtime_error

◆ getMaxPowerConsumption()

double wrench::S4U_Simulation::getMaxPowerConsumption ( const std::string &  hostname)
static

Get the maximum power consumption (i.e., 100% load) for a host at its current pstate.

Parameters
hostnamethe host name
Returns
The power consumption for this host if 100% used (as specified in the platform xml description file)
Exceptions
std::runtime_error

◆ getMemoryCapacity()

double wrench::S4U_Simulation::getMemoryCapacity ( )
static

Get the memory capacity of the current host.

Returns
a memory capacity in bytes

◆ getMinPowerConsumption()

double wrench::S4U_Simulation::getMinPowerConsumption ( const std::string &  hostname)
static

Get the minimum power consumption (i.e., idling) for a host at its current pstate.

Parameters
hostnamethe host name
Returns
The power consumption for this host if idle (as specified in the platform xml description file)
Exceptions
std::runtime_error

◆ getNumberofPstates()

int wrench::S4U_Simulation::getNumberofPstates ( const std::string &  hostname)
static

Get the total number of power states of a host.

Parameters
hostnamethe host name
Returns
The number of power states available for the host (as specified in the platform xml description file)
Exceptions
std::runtime_error

◆ getTotalEnergyConsumed()

double wrench::S4U_Simulation::getTotalEnergyConsumed ( const std::vector< std::string > &  hostnames)
static

Get the total energy consumed by a set of hosts.

Parameters
thelist of hostnames
Returns
The total energy consumed by all the hosts in Joules
Exceptions
std::runtime_error

◆ hostExists()

bool wrench::S4U_Simulation::hostExists ( std::string  hostname)
static

Determines whether a host exists for a given hostname.

Parameters
hostnamethe name of the host
Returns
true or false

◆ initialize()

void wrench::S4U_Simulation::initialize ( int *  argc,
char **  argv 
)

Initialize the Simgrid simulation.

Parameters
argcthe C-style argument counts
argvthe C-style argument list

◆ isInitialized()

bool wrench::S4U_Simulation::isInitialized ( )

Returns true if S4U_Simulation::initialize() has been called successfully previously.

Returns
true or false

◆ isPlatformSetup()

bool wrench::S4U_Simulation::isPlatformSetup ( )

Returns true if S4U_Simulation::setupPlatform() has been called successfully previously.

Returns
true or false

◆ runSimulation()

void wrench::S4U_Simulation::runSimulation ( )

Start the simulation.

Exceptions
std::runtime_error

◆ setPstate()

void wrench::S4U_Simulation::setPstate ( const std::string &  hostname,
int  pstate 
)
static

Set the power state of the host.

Parameters
hostnamethe host name
pstatethe power state index (the power state index is specified in the platform xml description file)
Exceptions
std::runtime_error

◆ setupPlatform()

void wrench::S4U_Simulation::setupPlatform ( std::string &  filename)

Initialize the simulated platform. Must only be called once. Due to the current SimGrid implementation, if the file is not readable or not correctly formatted, this method will call exit() instead of throwing an exception.

Parameters
filenamethe path to an XML platform description file

◆ sleep()

void wrench::S4U_Simulation::sleep ( double  duration)
static

Simulates a sleep.

Parameters
durationthe number of seconds to sleep
Exceptions
std::shared_ptr<HostError>

The documentation for this class was generated from the following files:
  • /Users/rafsilva/Documents/isi/workspace/wrench/wrench/include/wrench/simgrid_S4U_util/S4U_Simulation.h
  • /Users/rafsilva/Documents/isi/workspace/wrench/wrench/src/wrench/simgrid_S4U_util/S4U_Simulation.cpp