WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
wrench::S4U_Simulation Class Reference

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 (const std::function< void()> &creation_function)
 Initialize the simulated platform. Must only be called once. 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 physical 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 unsigned long 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_manager_service 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_manager_service 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 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. 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 setHostProperty (std::string hostname, std::string property_name, std::string property_value)
 Set a property associated to a host specified in the platform file. More...
 
static void setPstate (const std::string &hostname, unsigned long 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()

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

◆ getAllHostnames()

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

Get the list of physical 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

◆ getAllLinknames()

std::vector< std::string > wrench::S4U_Simulation::getAllLinknames ( )
static

Get the list of link names.

Returns
a vector of link names

◆ getClock()

double wrench::S4U_Simulation::getClock ( )
static

Get the current simulation date.

Returns
the simulation clock

◆ getCurrentPstate()

unsigned long 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

◆ getDiskCapacity()

double wrench::S4U_Simulation::getDiskCapacity ( std::string  hostname,
std::string  mount_point 
)
static

Gets the capacity of a disk attached to some host for a given mount point.

Parameters
hostnamethe host's name
mount_pointthe mount point (e.g., "/home")
Returns
the capacity of the disk / mount point
Exceptions
std::invalid_argument

◆ getDisks()

std::vector< std::string > wrench::S4U_Simulation::getDisks ( std::string  hostname)
static

Gets set of disks, i.e., mount points, available at a host.

Parameters
hostnamethe host's name
Returns
a vector of mount points
Exceptions
std::invalid_argument

◆ 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::invalid_argument
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_manager_service capacity of a host given a hostname.

Parameters
hostnamethe name of the host
Returns
a memory_manager_service 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.

Parameters
hostnamethe host name
property_namethe property name
Returns
a string relating to the property specified in the platform file

◆ getLinkBandwidth()

double wrench::S4U_Simulation::getLinkBandwidth ( std::string  name)
static

Get a link's bandwidth.

Parameters
namethe link's name
Returns
a bandwidth in Bps

◆ getLinkUsage()

double wrench::S4U_Simulation::getLinkUsage ( std::string  name)
static

Get a link's bandwidth usage.

Parameters
namethe link's name
Returns
a bandwidth usage in Bps

◆ 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::invalid_argument
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::invalid_argument
std::runtime_error

◆ getMemoryCapacity()

double wrench::S4U_Simulation::getMemoryCapacity ( )
static

Get the memory_manager_service capacity of the current host.

Returns
a memory_manager_service 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::invalid_argument
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::invalid_argument
std::runtime_error

◆ getNumCores()

unsigned int wrench::S4U_Simulation::getNumCores ( )
static

Get the number of cores of the current host.

Returns
a number of cores

◆ getRoute()

std::vector< std::string > wrench::S4U_Simulation::getRoute ( std::string &  src_host,
std::string &  dst_host 
)
static

Get the list of link names on the route between two hosts.

Parameters
src_hostsrc hostname
dst_hostdst hostname
Returns
a vector of link names

◆ 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

◆ hostHasMountPoint()

bool wrench::S4U_Simulation::hostHasMountPoint ( std::string  hostname,
std::string  mount_point 
)
static

Determines whether a mount point is defined at a host.

Parameters
hostnamethe host's name
mount_pointthe 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
argcthe C-style argument counts
argvthe C-style argument list

◆ isHostOn()

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

Returns whether a host is on or not.

Parameters
hostnamethe 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()

bool wrench::S4U_Simulation::isLinkOn ( std::string  linkname)
static

Returns whether a link is on or not.

Parameters
linknamethe 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()

bool wrench::S4U_Simulation::linkExists ( std::string  linkname)
static

Determines whether a link exists for a given linkname.

Parameters
linknamethe name of the link
Returns
true or false

◆ readFromDisk()

void wrench::S4U_Simulation::readFromDisk ( double  num_bytes,
std::string  hostname,
std::string  mount_point 
)
static

Simulates a disk read.

Parameters
num_bytesnumber of bytes to read
hostnamename of host to which disk is attached
mount_pointmount point

◆ readFromDiskAndWriteToDiskConcurrently()

void wrench::S4U_Simulation::readFromDiskAndWriteToDiskConcurrently ( double  num_bytes_to_read,
double  num_bytes_to_write,
std::string  hostname,
std::string  read_mount_point,
std::string  write_mount_point 
)
static

Read from a local disk and write to a local disk concurrently.

Parameters
num_bytes_to_readnumber of bytes to read
num_bytes_to_writenumber of bytes to write
hostnamethe host at which the disks are located
read_mount_pointthe mountpoint to read from
write_mount_pointthe mountpoint to write to

◆ runSimulation()

void wrench::S4U_Simulation::runSimulation ( )

Start the simulation.

Exceptions
std::runtime_error

◆ setHostProperty()

void wrench::S4U_Simulation::setHostProperty ( std::string  hostname,
std::string  property_name,
std::string  property_value 
)
static

Set a property associated to a host specified in the platform file.

Parameters
hostnamethe host name
property_namethe property name
property_valuethe property value

◆ setPstate()

void wrench::S4U_Simulation::setPstate ( const std::string &  hostname,
unsigned long  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::invalid_argument
std::runtime_error

◆ setupPlatform() [1/2]

void wrench::S4U_Simulation::setupPlatform ( const std::function< void()> &  creation_function)

Initialize the simulated platform. Must only be called once.

Parameters
creation_functionvoid() function to create the platform
Exceptions
std::invalid_argument

◆ setupPlatform() [2/2]

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

Initialize the simulated platform. Must only be called once.

Parameters
filenamethe path to an XML platform description file
Exceptions
std::invalid_argument

◆ sleep()

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

Simulates a sleep.

Parameters
durationthe number of seconds to sleep

◆ turnOffHost()

void wrench::S4U_Simulation::turnOffHost ( std::string  hostname)
static

Turn off a host.

Parameters
hostnamethe name of the host to turn off
Exceptions
std::invalid_argument

◆ turnOffLink()

void wrench::S4U_Simulation::turnOffLink ( std::string  linkname)
static

Turn off a link.

Parameters
linknamethe name of the link to turn off
Exceptions
std::invalid_argument

◆ turnOnHost()

void wrench::S4U_Simulation::turnOnHost ( std::string  hostname)
static

Turn on a host.

Parameters
hostnamethe name of the host to turn on
Exceptions
std::invalid_argument

◆ turnOnLink()

void wrench::S4U_Simulation::turnOnLink ( std::string  linkname)
static

Turn on a link.

Parameters
linknamethe name of the link to turn on
Exceptions
std::invalid_argument

◆ writeToDisk()

void wrench::S4U_Simulation::writeToDisk ( double  num_bytes,
std::string  hostname,
std::string  mount_point 
)
static

Simulates a disk write.

Parameters
num_bytesnumber of bytes to write
hostnamename of host to which disk is attached
mount_pointmount point

The documentation for this class was generated from the following files: