wrench::Simulation
-
class Simulation
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).
Public Functions
-
~Simulation()
Destructor.
Method to add a service to the simulation.
- Template Parameters
T – The service class (base class is Service)
- Parameters
t – the service object (shared ptr)
- Returns
a shared_ptr to the service object
Method to add a service to the simulation.
- Template Parameters
T – The service class (base class is Service)
- Parameters
t – the service object
- Returns
a shared_ptr to the service object
-
double getEnergyConsumed(const std::string &hostname)
Obtains the current energy consumption of a host.
- Parameters
hostname – the host name
- Throws
std::invalid_argument –
- Returns
current energy consumption in joules
-
std::map<std::string, double> getEnergyConsumed(const std::vector<std::string> &hostnames)
Obtains the current energy consumption of a host.
- Parameters
hostnames – the list of hostnames
- Throws
std::invalid_argument –
- Returns
current energy consumption in joules for each host, as a map indexed by hostnames
-
SimulationOutput &getOutput()
Get the simulation output object.
- Returns
simulation output object
-
void init(int*, char**)
Initialize the simulation, which parses out WRENCH-specific and SimGrid-specific command-line arguments, if any.
- Parameters
argc – main()’s argument count
argv – main()’s argument list
- Throws
std::invalid_argument –
-
void instantiatePlatform(const std::function<void()>&)
Instantiate a simulated platform.
- Parameters
creation_function – void() function to create the platform
-
void instantiatePlatform(const std::string&)
Instantiate a simulated platform.
- Parameters
filename – the path to a SimGrid XML platform description file
- Throws
std::runtime_error –
-
void launch()
Launch the simulation.
- Throws
std::runtime_error –
Stage a copy of a file at a storage service in the root of the (unique) mount point.
- Parameters
file – a file to stage on a storage service
storage_service – a storage service
- Throws
std::runtime_error –
std::invalid_argument –
Stage a copy of a file at a storage service in a particular directory.
- Parameters
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
- Throws
std::runtime_error –
std::invalid_argument –
Public Static Functions
-
static std::shared_ptr<DataFile> addFile(const 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)
- Parameters
id – a unique string id
size – a file size in bytes
- Throws
std::invalid_argument –
- Returns
the DataFile instance
Store a file at a particular mount point ex-nihilo. Doesn’t notify a file registry service and will do nothing (and won’t complain) if the file already exists at that location.
- Parameters
file – a file
location – a file location
- Throws
std::invalid_argument –
Store a file on a particular file server ex-nihilo. Doesn’t notify a file registry service and will do nothing (and won’t complain) if the file already exists at that location.
- Parameters
file – a file
service – a storage service
- Throws
std::invalid_argument –
-
static std::shared_ptr<Simulation> createSimulation()
Create a simulation.
- Returns
a simulation
-
static std::shared_ptr<DataFile> getFileByID(const std::string &id)
Find a DataFile based on its ID.
- Parameters
id – a string id
- Throws
std::invalid_argument –
- Returns
the DataFile instance (or throws a std::invalid_argument if not found)
-
static std::map<std::string, std::shared_ptr<DataFile>> &getFileMap()
Get the list of all files in the simulation.
- Returns
a reference to the map of files in the simulation, indexed by file ID
-
static double getHostFlopRate(const std::string &hostname)
Get the flop rate of one core of a host given a hostname.
- Parameters
hostname – the hostname
- Returns
a flop rate (flop / sec)
-
static double getHostMemoryCapacity(const std::string &hostname)
Get the memory_manager_service capacity of a host given a hostname.
- Parameters
hostname – the hostname
- Returns
a memory_manager_service capacity in bytes
-
static std::vector<std::string> getHostnameList()
Get the list of names of all the physical hosts in the platform.
- Returns
a vector of hostnames
-
static std::map<std::string, std::vector<std::string>> 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
-
static unsigned long getHostNumCores(const std::string &hostname)
Get the number of cores of a host given a hostname.
- Parameters
hostname – the hostname
- Returns
a number of cores
-
static std::vector<int> getListOfPstates(const std::string &hostname)
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)
-
static double getMaxPowerConsumption(const std::string &hostname)
Get the maximum power consumption for the host (i.e., 100% utilization) at its current pstate.
- Parameters
hostname – the host name
- Returns
The “100% used” power consumption (as specified in the platform xml description file)
-
static double getMinPowerConsumption(const std::string &hostname)
Get the minimum power consumption for the host (i.e., idling) at its current pstate.
- Parameters
hostname – the host name
- Returns
The “idling” power consumption (as specified in the platform xml description file)
-
static int getNumberofPstates(const std::string &hostname)
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)
-
static bool isInitialized()
Determine if the simulation has been initialized.
- Returns
true or false
Remove a file from the simulation (use at your own peril if you’re using the workflow API - use Workflow::removeFile() instead)
- Parameters
file – : file to remove
-
~Simulation()