WRENCH
1.11
Cyberinfrastructure Simulation Workbench
|
Overview | Installation | Getting Started | WRENCH 101 | WRENCH 102 |
A class that provides basic simulation methods. Once the simulation object has been explicitly or implicitly destroyed, then any call to the WRENCH APIs has undefied behavior (due to memory_manager_service being de-allocated). More...
#include <Simulation.h>
Public Member Functions | |
~Simulation () | |
Destructor. | |
template<class T > | |
std::shared_ptr< T > | add (T *t) |
Method to add a service to the simulation. More... | |
double | getEnergyConsumed (const std::string &hostname) |
Obtains the current energy consumption of a host. More... | |
double | getEnergyConsumed (const std::string &hostname, bool record_as_time_stamp) |
Obtains the current energy consumption of a host and will add SimulationTimestampEnergyConsumption to simulation output if can_record is set to true. More... | |
std::map< std::string, double > | getEnergyConsumed (const std::vector< std::string > &hostnames) |
Obtains the current energy consumption of a host. More... | |
std::map< std::string, double > | getEnergyConsumed (const std::vector< std::string > &hostnames, bool record_as_time_stamps) |
Obtains the current energy consumption of a host and will add SimulationTimestampEnergyConsumption to simulation output if can_record is set to true. More... | |
double | getLinkUsage (const std::string &link_name, bool record_as_time_stamp) |
Get the current usage of a particular link. More... | |
SimulationOutput & | getOutput () |
Get the simulation output object. More... | |
void | init (int *, char **) |
Initialize the simulation, which parses out WRENCH-specific and SimGrid-specific command-line arguments, if any. More... | |
void | instantiatePlatform (const std::function< void()> &) |
Instantiate a simulated platform. More... | |
void | instantiatePlatform (std::string) |
Instantiate a simulated platform. More... | |
void | launch () |
Launch the simulation. More... | |
void | setPstate (const std::string &hostname, int pstate) |
Set the power state of the host. More... | |
void | stageFile (std::shared_ptr< DataFile >file, std::shared_ptr< StorageService > ss) |
Stage a copy of a file at a storage service in the root of the (unique) mount point. More... | |
void | stageFile (std::shared_ptr< DataFile >file, std::shared_ptr< StorageService > ss, std::string directory_absolute_path) |
Stage a copy of a file at a storage service in a particular directory. More... | |
std::shared_ptr< ComputeService > | startNewService (ComputeService *service) |
Starts a new compute service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor. More... | |
std::shared_ptr< FileRegistryService > | startNewService (FileRegistryService *service) |
Starts a new file registry service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor. More... | |
std::shared_ptr< MemoryManager > | startNewService (MemoryManager *service) |
Starts a new memory_manager_service manager service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor. More... | |
std::shared_ptr< NetworkProximityService > | startNewService (NetworkProximityService *service) |
Starts a new network proximity service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor. More... | |
std::shared_ptr< StorageService > | startNewService (StorageService *service) |
Starts a new storage service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor. More... | |
Static Public Member Functions | |
static std::shared_ptr< DataFile > | addFile (std::string, double) |
Add a new file to the simulation (use at your own peril if you're using the workflow API - use Workflow::addFile() instead) More... | |
static void | compute (double flops) |
Make the calling process compute. More... | |
static std::shared_ptr< Simulation > | createSimulation () |
Create a simulation. More... | |
static bool | doesHostExist (std::string hostname) |
Wrapper for S4U_Simulation hostExists() More... | |
static bool | doesLinkExist (std::string linkname) |
Wrapper for S4U_Simulation linkExists() More... | |
static int | getCurrentPstate (const std::string &hostname) |
Get the current power state of a host. More... | |
static double | getCurrentSimulatedDate () |
Get the current simulated date. More... | |
static std::shared_ptr< DataFile > | getFileByID (const std::string &id) |
Find a DataFile based on its ID. More... | |
static std::map< std::string, std::shared_ptr< DataFile > > & | getFileMap () |
Get the list of all files in the simulation. More... | |
static double | getHostFlopRate (std::string hostname) |
Get the flop rate of one core of a host given a hostname. More... | |
static double | getHostMemoryCapacity (std::string hostname) |
Get the memory_manager_service capacity of a host given a hostname. More... | |
static std::vector< std::string > | getHostnameList () |
Get the list of names of all the physical hosts in the platform. More... | |
static std::map< std::string, std::vector< std::string > > | getHostnameListByCluster () |
** More... | |
static unsigned long | getHostNumCores (std::string hostname) |
Get the number of cores of a host given a hostname. 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 for the host (i.e., 100% utilization) at its current pstate. More... | |
static double | getMinPowerConsumption (const std::string &hostname) |
Get the minimum power consumption for the host (i.e., idling) at its current pstate. More... | |
static int | getNumberofPstates (const std::string &hostname) |
Get the total number of power states of a 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 | isHostOn (std::string hostname) |
Returns whether a host is on or not. More... | |
static bool | isInitialized () |
Determine if the simulation has been initialized. More... | |
static bool | isLinkOn (std::string linkname) |
Returns whether a link is on or not. More... | |
static void | removeFile (std::shared_ptr< DataFile >file) |
Remove a file from the simulation (use at your own peril if you're using the workflow API - use Workflow::removeFile() instead) More... | |
static void | sleep (double duration) |
Make the calling process sleep for a number of (simulated) seconds. More... | |
static void | turnOffHost (std::string hostname) |
Turns off a host. More... | |
static void | turnOffLink (std::string linkname) |
Turns off a link. More... | |
static void | turnOnHost (std::string hostname) |
Turns on a host. More... | |
static void | turnOnLink (std::string linkname) |
Turns on a link. More... | |
A class that provides basic simulation methods. Once the simulation object has been explicitly or implicitly destroyed, then any call to the WRENCH APIs has undefied behavior (due to memory_manager_service being de-allocated).
|
inline |
Method to add a service to the simulation.
T | The service class (base class is Service) |
t | the service object |
|
static |
Add a new file to the simulation (use at your own peril if you're using the workflow API - use Workflow::addFile() instead)
id | a unique string id |
size | a file size in bytes |
std::invalid_argument |
|
static |
Make the calling process compute.
flops | a number of floating point operations |
|
static |
Create a simulation.
|
static |
Wrapper for S4U_Simulation hostExists()
hostname | - name of host being queried |
|
static |
Wrapper for S4U_Simulation linkExists()
linkname | - name of link being queried |
|
static |
Get the current power state of a host.
hostname | the host name |
|
static |
Get the current simulated date.
double wrench::Simulation::getEnergyConsumed | ( | const std::string & | hostname | ) |
Obtains the current energy consumption of a host.
hostname | the host name |
std::invalid_argument |
double wrench::Simulation::getEnergyConsumed | ( | const std::string & | hostname, |
bool | record_as_time_stamp | ||
) |
Obtains the current energy consumption of a host and will add SimulationTimestampEnergyConsumption to simulation output if can_record is set to true.
hostname | the host name |
record_as_time_stamp | bool signaling whether or not to record a SimulationTimestampEnergyConsumption object |
std::invalid_argument |
std::map< std::string, double > wrench::Simulation::getEnergyConsumed | ( | const std::vector< std::string > & | hostnames | ) |
Obtains the current energy consumption of a host.
hostnames | the list of hostnames |
std::invalid_argument |
std::map< std::string, double > wrench::Simulation::getEnergyConsumed | ( | const std::vector< std::string > & | hostnames, |
bool | record_as_time_stamps | ||
) |
Obtains the current energy consumption of a host and will add SimulationTimestampEnergyConsumption to simulation output if can_record is set to true.
hostnames | the list of hostnames |
record_as_time_stamps | whether or not to record a SimulationTimestampEnergyConsumption object for each host when this method is called |
std::invalid_argument |
|
static |
|
static |
Get the list of all files in the simulation.
|
static |
Get the flop rate of one core of a host given a hostname.
hostname | the hostname |
|
static |
Get the memory_manager_service capacity of a host given a hostname.
hostname | the hostname |
|
static |
Get the list of names of all the physical hosts in the platform.
|
static |
**
Get the list of names of all the hosts in each cluster composing the platform
|
static |
Get the number of cores of a host given a hostname.
hostname | the hostname |
double wrench::Simulation::getLinkUsage | ( | const std::string & | link_name, |
bool | record_as_time_stamp | ||
) |
Get the current usage of a particular link.
Obtains the current link bandwidth usage on a link and will add SimulationTimestampLinkUsage to simulation output if record_as_time_stamp is set to true.
link_name | the link's name |
link_name | the link's name |
record_as_time_stamp | bool signaling whether or not to record a SimulationTimestampLinkUsage object |
std::invalid_argument |
|
static |
Get the list of power states available for a host.
hostname | the host name |
|
static |
Get the maximum power consumption for the host (i.e., 100% utilization) at its current pstate.
hostname | the host name |
|
static |
Get the minimum power consumption for the host (i.e., idling) at its current pstate.
hostname | the host name |
|
static |
Get the total number of power states of a host.
hostname | the host name |
SimulationOutput & wrench::Simulation::getOutput | ( | ) |
Get the simulation output object.
|
static |
Get the list of link names on the route between two hosts.
src_host | src hostname |
dst_host | dst hostname |
void wrench::Simulation::init | ( | int * | argc, |
char ** | argv | ||
) |
Initialize the simulation, which parses out WRENCH-specific and SimGrid-specific command-line arguments, if any.
argc | main()'s argument count |
argv | main()'s argument list |
std::invalid_argument |
void wrench::Simulation::instantiatePlatform | ( | const std::function< void()> & | creation_function | ) |
Instantiate a simulated platform.
creation_function | void() function to create the platform |
void wrench::Simulation::instantiatePlatform | ( | std::string | filename | ) |
Instantiate a simulated platform.
filename | the path to a SimGrid XML platform description file |
std::runtime_error |
|
static |
Returns whether a host is on or not.
hostname | the hostname |
|
static |
Determine if the simulation has been initialized.
|
static |
Returns whether a link is on or not.
linkname | the linkname |
void wrench::Simulation::launch | ( | ) |
Launch the simulation.
std::runtime_error |
|
static |
Remove a file from the simulation (use at your own peril if you're using the workflow API - use Workflow::removeFile() instead)
file | : file to remove |
void wrench::Simulation::setPstate | ( | const std::string & | hostname, |
int | pstate | ||
) |
Set the power state of the host.
hostname | the host name |
pstate | the power state index (as specified in the platform xml description file) |
|
static |
Make the calling process sleep for a number of (simulated) seconds.
duration | a number of seconds |
void wrench::Simulation::stageFile | ( | std::shared_ptr< DataFile > | file, |
std::shared_ptr< StorageService > | storage_service | ||
) |
Stage a copy of a file at a storage service in the root of the (unique) mount point.
file | a file to stage on a storage service |
storage_service | a storage service |
std::runtime_error | |
std::invalid_argument |
void wrench::Simulation::stageFile | ( | std::shared_ptr< DataFile > | file, |
std::shared_ptr< StorageService > | storage_service, | ||
std::string | directory_absolute_path | ||
) |
Stage a copy of a file at a storage service in a particular directory.
file | a file to stage on a storage service |
storage_service | a storage service |
directory_absolute_path | the absolute path of the directory where the file should be stored |
std::runtime_error | |
std::invalid_argument |
std::shared_ptr< ComputeService > wrench::Simulation::startNewService | ( | ComputeService * | service | ) |
Starts a new compute service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor.
service | An instance of a service |
std::invalid_argument | |
std::runtime_error |
std::shared_ptr< FileRegistryService > wrench::Simulation::startNewService | ( | FileRegistryService * | service | ) |
Starts a new file registry service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor.
service | An instance of a service |
std::invalid_argument | |
std::runtime_error |
std::shared_ptr< MemoryManager > wrench::Simulation::startNewService | ( | MemoryManager * | service | ) |
Starts a new memory_manager_service manager service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor.
service | An instance of a service |
std::invalid_argument | |
std::runtime_error |
std::shared_ptr< NetworkProximityService > wrench::Simulation::startNewService | ( | NetworkProximityService * | service | ) |
Starts a new network proximity service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor.
service | An instance of a service |
std::invalid_argument | |
std::runtime_error |
std::shared_ptr< StorageService > wrench::Simulation::startNewService | ( | StorageService * | service | ) |
Starts a new storage service during execution (i.e., one that was not passed to Simulation::add() before Simulation::launch() was called). The simulation takes ownership of the reference and will call the destructor.
service | An instance of a service |
std::invalid_argument | |
std::runtime_error |
|
static |
Turns off a host.
hostname | the hostname |
|
static |
Turns off a link.
linkname | the linkname |
|
static |
Turns on a host.
hostname | the hostname |
|
static |
Turns on a link.
linkname | the linkname |