A class that provides basic simulation methods. More...

#include <Simulation.h>

Public Member Functions

 Simulation ()
 Constructor.
 
 ~Simulation ()
 Destructor.
 
ComputeServiceadd (ComputeService *)
 Add a ComputeService to the simulation. The simulation takes ownership of the reference and will call the destructor. More...
 
StorageServiceadd (StorageService *)
 Add a StorageService to the simulation. The simulation takes ownership of the reference and will call the destructor. More...
 
NetworkProximityServiceadd (NetworkProximityService *)
 Add a NetworkProximityService to the simulation. The simulation takes ownership of the reference and will call the destructor. More...
 
WMSadd (WMS *)
 Add a WMS for the simulation. The simulation takes ownership of the reference and will call the destructor. More...
 
FileRegistryServiceadd (FileRegistryService *)
 Set a FileRegistryService for the simulation. The simulation takes ownership of the reference and will call the destructor. More...
 
double getCurrentSimulatedDate ()
 Get the current simulated date. More...
 
std::vector< std::string > getHostnameList ()
 Get the list of names of all the hosts in the platform. More...
 
std::map< std::string,
std::vector< std::string > > 
getHostnameListByCluster ()
 Get the list of names of all the hosts in each cluster composing the platform. More...
 
SimulationOutputgetOutput ()
 Get the simulation output object. More...
 
bool hostExists (std::string hostname)
 Check that a hostname exists in the platform. More...
 
void init (int *, char **)
 Initialize the simulation, which parses out WRENCH-specific and SimGrid-specific command-line arguments, if any. More...
 
void instantiatePlatform (std::string)
 Instantiate a simulated platform. More...
 
void launch ()
 Launch the simulation. More...
 
void stageFile (WorkflowFile *file, StorageService *storage_service)
 Stage a copy of a file on a storage service (to the "/" partition) More...
 
void stageFile (WorkflowFile *file, StorageService *storage_service, std::string partition)
 Stage a copy of a file on a storage service. More...
 
void stageFiles (std::map< std::string, WorkflowFile * > files, StorageService *storage_service)
 Stage file copies on a storage service (to the "/" partition) More...
 
void stageFiles (std::map< std::string, WorkflowFile * > files, StorageService *storage_service, std::string partition)
 Stage file copies on a storage service. More...
 
ComputeServicestartNewService (ComputeService *service)
 Starts a new compute service during WMS 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...
 
StorageServicestartNewService (StorageService *service)
 Starts a new storage service during WMS 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...
 
NetworkProximityServicestartNewService (NetworkProximityService *service)
 Starts a new network proximity service during WMS 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...
 
FileRegistryServicestartNewService (FileRegistryService *service)
 Starts a new file registry service during WMS 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 void compute (double flops)
 Make the calling process compute. 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 one core of the host on which the calling process is running. 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 capacity of a host given a hostname. 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 getMaxPowerPossible (const std::string &hostname)
 Get the maximum power available for a host. More...
 
static double getMemoryCapacity ()
 Get the memory capacity of the host on which the calling process is running. More...
 
static double getMinPowerAvailable (const std::string &hostname)
 Get the minimum power available for a host. More...
 
static int getNumberofPstates (const std::string &hostname)
 Get the total number of power states of a host. More...
 
static unsigned long getNumCores ()
 Get the number of cores of the host on which the calling process is running. More...
 
static double getTotalEnergyConsumed (const std::vector< std::string > &hostnames)
 Get the total energy consumed by a set of hosts. More...
 
static void setPstate (const std::string &hostname, int pstate)
 Set the power state of the host. More...
 
static void sleep (double duration)
 Make the calling process sleep for a number of (simulated) seconds. More...
 

Detailed Description

A class that provides basic simulation methods.

Member Function Documentation

ComputeService * wrench::Simulation::add ( ComputeService service)

Add a ComputeService to the simulation. The simulation takes ownership of the reference and will call the destructor.

Parameters
servicea compute service
Returns
the ComputeService
Exceptions
std::invalid_argument
std::runtime_error
StorageService * wrench::Simulation::add ( StorageService service)

Add a StorageService to the simulation. The simulation takes ownership of the reference and will call the destructor.

Parameters
servicea storage service
Returns
the StorageService
Exceptions
std::invalid_argument
std::runtime_error
NetworkProximityService * wrench::Simulation::add ( NetworkProximityService service)

Add a NetworkProximityService to the simulation. The simulation takes ownership of the reference and will call the destructor.

Parameters
servicea network proximity service
Returns
the NetworkProximityService
Exceptions
std::invalid_argument
std::runtime_error
WMS * wrench::Simulation::add ( WMS wms)

Add a WMS for the simulation. The simulation takes ownership of the reference and will call the destructor.

Parameters
wmsa WMS
Returns
the WMS
Exceptions
std::invalid_argument
std::runtime_error
FileRegistryService * wrench::Simulation::add ( FileRegistryService file_registry_service)

Set a FileRegistryService for the simulation. The simulation takes ownership of the reference and will call the destructor.

Parameters
file_registry_servicea file registry service
Returns
the FileRegistryService
Exceptions
std::invalid_argument
void wrench::Simulation::compute ( double  flops)
static

Make the calling process compute.

Parameters
durationa number of floating point operations
int wrench::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)
double wrench::Simulation::getCurrentSimulatedDate ( )

Get the current simulated date.

Returns
a date
double wrench::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
double wrench::Simulation::getFlopRate ( )
static

Get the flop rate of one core of the host on which the calling process is running.

Returns
a flop rate
double wrench::Simulation::getHostFlopRate ( std::string  hostname)
static

Get the flop rate of one core of a host given a hostname.

Parameters
hostnamethe hostname
Returns
a flop rate (flop / sec)
double wrench::Simulation::getHostMemoryCapacity ( std::string  hostname)
static

Get the memory capacity of a host given a hostname.

Parameters
hostnamethe hostname
Returns
a memory capacity in bytes
std::vector< std::string > wrench::Simulation::getHostnameList ( )

Get the list of names of all the hosts in the platform.

Returns
a vector of hostnames
std::map< std::string, std::vector< std::string > > wrench::Simulation::getHostnameListByCluster ( )

Get the list of names of all the hosts in each cluster composing the platform.

Returns
a map of lists of hosts, indexed by cluster name
unsigned long wrench::Simulation::getHostNumCores ( std::string  hostname)
static

Get the number of cores of a host given a hostname.

Parameters
hostnamethe hostname
Returns
a number of cores
std::vector< int > wrench::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)
double wrench::Simulation::getMaxPowerPossible ( const std::string &  hostname)
static

Get the maximum power available for a host.

Parameters
hostnamethe host name
Returns
The maximum power available for the host (as specified in the platform xml description file)
double wrench::Simulation::getMemoryCapacity ( )
static

Get the memory capacity of the host on which the calling process is running.

Returns
a memory capacity in bytes
double wrench::Simulation::getMinPowerAvailable ( const std::string &  hostname)
static

Get the minimum power available for a host.

Parameters
hostnamethe host name
Returns
The minimum power available for the host (as specified in the platform xml description file)
int wrench::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)
unsigned long wrench::Simulation::getNumCores ( )
static

Get the number of cores of the host on which the calling process is running.

Returns
a number of cores
SimulationOutput & wrench::Simulation::getOutput ( )

Get the simulation output object.

Returns
simulation output object
double wrench::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
bool wrench::Simulation::hostExists ( std::string  hostname)

Check that a hostname exists in the platform.

Parameters
hostnamea host name
Returns
true or false
void wrench::Simulation::init ( int *  argc,
char **  argv 
)

Initialize the simulation, which parses out WRENCH-specific and SimGrid-specific command-line arguments, if any.

Parameters
argcmain()'s argument count
argvmain()'s argument list
Exceptions
std::invalid_argument
void wrench::Simulation::instantiatePlatform ( std::string  filename)

Instantiate a simulated platform.

Parameters
filenamethe path to a SimGrid XML platform description file
Exceptions
std::runtime_error
void wrench::Simulation::launch ( )

Launch the simulation.

Exceptions
std::runtime_error
void wrench::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)
void wrench::Simulation::sleep ( double  duration)
static

Make the calling process sleep for a number of (simulated) seconds.

Parameters
durationa number of seconds
void wrench::Simulation::stageFile ( WorkflowFile file,
StorageService storage_service 
)

Stage a copy of a file on a storage service (to the "/" partition)

Parameters
filea file to stage on a storage service
storage_servicethe storage service
Exceptions
std::runtime_error
std::invalid_argument
void wrench::Simulation::stageFile ( WorkflowFile file,
StorageService storage_service,
std::string  partition 
)

Stage a copy of a file on a storage service.

Parameters
filea file to stage on a storage service
storage_servicethe storage service
partitionthe partition on which to store the files
Exceptions
std::runtime_error
std::invalid_argument
void wrench::Simulation::stageFiles ( std::map< std::string, WorkflowFile * >  files,
StorageService storage_service 
)

Stage file copies on a storage service (to the "/" partition)

Parameters
filesa map of files (indexed by file ids) to stage on a storage service
storage_servicethe storage service
Exceptions
std::runtime_error
std::invalid_argument
void wrench::Simulation::stageFiles ( std::map< std::string, WorkflowFile * >  files,
StorageService storage_service,
std::string  partition 
)

Stage file copies on a storage service.

Parameters
filesa map of files (indexed by file ids) to stage on a storage service
storage_servicethe storage service
partitionthe partition on which to store the files
Exceptions
std::runtime_error
std::invalid_argument
ComputeService * wrench::Simulation::startNewService ( ComputeService service)

Starts a new compute service during WMS 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.

Parameters
serviceAn instance of a service
Returns
A pointer to the service instance
Exceptions
std::invalid_argument
std::runtime_error
StorageService * wrench::Simulation::startNewService ( StorageService service)

Starts a new storage service during WMS 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.

Parameters
serviceAn instance of a service
Returns
A pointer to the service instance
Exceptions
std::invalid_argument
std::runtime_error
NetworkProximityService * wrench::Simulation::startNewService ( NetworkProximityService service)

Starts a new network proximity service during WMS 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.

Parameters
serviceAn instance of a service
Returns
A pointer to the service instance
Exceptions
std::invalid_argument
std::runtime_error
FileRegistryService * wrench::Simulation::startNewService ( FileRegistryService service)

Starts a new file registry service during WMS 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.

Parameters
serviceAn instance of a service
Returns
A pointer to the service instance
Exceptions
std::invalid_argument
std::runtime_error

The documentation for this class was generated from the following files:
  • /home/wrench/wrench/include/wrench/simulation/Simulation.h
  • /home/wrench/wrench/src/wrench/simulation/Simulation.cpp