SimGrid  3.21
Versatile Simulation of Distributed Systems
simgrid::s4u::Engine Class Reference

Detailed Description

Simulation engine.

This class is an interface to the simulation engine.

#include <Engine.hpp>

Public Member Functions

 Engine (int *argc, char **argv)
 Constructor, taking the command line parameters of your main function. More...
 
 Engine (const Engine &)=delete
 Currently, only one instance is allowed to exist. More...
 
 Engine (Engine &&)=delete
 
 ~Engine ()
 
void run ()
 Run the simulation. More...
 
void load_platform (std::string platf)
 Load a platform file describing the environment. More...
 
void register_function (std::string name, int(*code)(int, char **))
 Registers the main function of an actor that will be launched from the deployment file. More...
 
void register_function (std::string name, void(*code)(std::vector< std::string >))
 Registers the main function of an actor that will be launched from the deployment file. More...
 
void register_default (int(*code)(int, char **))
 Registers a function as the default main function of actors. More...
 
template<class F >
void register_actor (std::string name)
 
template<class F >
void register_actor (std::string name, F code)
 
void load_deployment (std::string deploy)
 Load a deployment file and launch the actors that it contains. More...
 
size_t get_host_count ()
 
std::vector< Host * > get_all_hosts ()
 Returns the list of all hosts found in the platform. More...
 
std::vector< Host * > get_filtered_hosts (std::function< bool(Host *)> filter)
 
simgrid::s4u::Hosthost_by_name (std::string name)
 
simgrid::s4u::Hosthost_by_name_or_null (std::string name)
 
size_t get_link_count ()
 
std::vector< Link * > get_all_links ()
 
std::vector< Link * > get_filtered_links (std::function< bool(Link *)> filter)
 
simgrid::s4u::Linklink_by_name (std::string name)
 
simgrid::s4u::Linklink_by_name_or_null (std::string name)
 
size_t get_actor_count ()
 
std::vector< ActorPtr > get_all_actors ()
 
std::vector< ActorPtr > get_filtered_actors (std::function< bool(ActorPtr)> filter)
 
size_t get_storage_count ()
 
std::vector< Storage * > get_all_storages ()
 
simgrid::s4u::Storagestorage_by_name (std::string name)
 
simgrid::s4u::Storagestorage_by_name_or_null (std::string name)
 
std::vector< simgrid::kernel::routing::NetPoint * > get_all_netpoints ()
 
simgrid::kernel::routing::NetPointnetpoint_by_name_or_null (std::string name)
 
simgrid::s4u::NetZoneget_netzone_root ()
 
void set_netzone_root (s4u::NetZone *netzone)
 
simgrid::s4u::NetZonenetzone_by_name_or_null (std::string name)
 
template<class T >
std::vector< T * > get_filtered_netzones ()
 Retrieves all netzones of the type indicated by the template argument. More...
 
void set_config (std::string str)
 set a configuration variable More...
 
void loadPlatform (std::string platf)
 
void registerFunction (std::string name, int(*code)(int, char **))
 
void registerDefault (int(*code)(int, char **))
 
template<class F >
void registerFunction (std::string name)
 
template<class F >
void registerFunction (std::string name, F code)
 
void loadDeployment (std::string deploy)
 
simgrid::s4u::HosthostByName (std::string name)
 
simgrid::s4u::HosthostByNameOrNull (std::string name)
 
simgrid::s4u::StoragestorageByName (std::string name)
 
simgrid::s4u::StoragestorageByNameOrNull (std::string name)
 
size_t getHostCount ()
 
void getHostList (std::vector< Host *> *whereTo)
 
std::vector< Host * > getAllHosts ()
 
size_t getLinkCount ()
 
void getLinkList (std::vector< Link *> *list)
 
std::vector< Link * > getAllLinks ()
 
std::vector< Storage * > getAllStorages ()
 
void getNetpointList (std::vector< simgrid::kernel::routing::NetPoint *> *list)
 
simgrid::kernel::routing::NetPointgetNetpointByNameOrNull (std::string name)
 
simgrid::s4u::NetZonegetNetRoot ()
 
simgrid::s4u::NetZonegetNetzoneByNameOrNull (std::string name)
 
template<class T >
void getNetzoneByType (std::vector< T *> *whereto)
 
void setConfig (std::string str)
 

Static Public Member Functions

static void shutdown ()
 Finalize the default engine and all its dependencies. More...
 
static double get_clock ()
 Retrieve the simulation time. More...
 
static s4u::Engineget_instance ()
 Retrieve the engine singleton. More...
 
static bool is_initialized ()
 Returns whether SimGrid was initialized yet – mostly for internal use. More...
 
static double getClock ()
 
static s4u::EnginegetInstance ()
 
static bool isInitialized ()
 

Constructor & Destructor Documentation

◆ Engine() [1/3]

simgrid::s4u::Engine::Engine ( int *  argc,
char **  argv 
)
explicit

Constructor, taking the command line parameters of your main function.

◆ Engine() [2/3]

simgrid::s4u::Engine::Engine ( const Engine )
delete

Currently, only one instance is allowed to exist.

This is why you can't copy or move it

◆ Engine() [3/3]

simgrid::s4u::Engine::Engine ( Engine &&  )
delete

◆ ~Engine()

simgrid::s4u::Engine::~Engine ( )

Member Function Documentation

◆ shutdown()

static void simgrid::s4u::Engine::shutdown ( )
static

Finalize the default engine and all its dependencies.

◆ run()

void simgrid::s4u::Engine::run ( )

Run the simulation.

◆ get_clock()

static double simgrid::s4u::Engine::get_clock ( )
static

Retrieve the simulation time.

◆ get_instance()

static s4u::Engine* simgrid::s4u::Engine::get_instance ( )
static

Retrieve the engine singleton.

◆ load_platform()

void simgrid::s4u::Engine::load_platform ( std::string  platf)

Load a platform file describing the environment.

The environment is either a XML file following the simgrid.dtd formalism, or a lua file. Some examples can be found in the directory examples/platforms.

◆ register_function() [1/2]

void simgrid::s4u::Engine::register_function ( std::string  name,
int(*)(int, char **)  code 
)

Registers the main function of an actor that will be launched from the deployment file.

◆ register_function() [2/2]

void simgrid::s4u::Engine::register_function ( std::string  name,
void(*)(std::vector< std::string >)  code 
)

Registers the main function of an actor that will be launched from the deployment file.

◆ register_default()

void simgrid::s4u::Engine::register_default ( int(*)(int, char **)  code)

Registers a function as the default main function of actors.

It will be used as fallback when the function requested from the deployment file was not registered. It is used for trace-based simulations (see examples/s4u/replay-comms and similar).

◆ register_actor() [1/2]

template<class F >
void simgrid::s4u::Engine::register_actor ( std::string  name)
inline

◆ register_actor() [2/2]

template<class F >
void simgrid::s4u::Engine::register_actor ( std::string  name,
code 
)
inline

◆ load_deployment()

void simgrid::s4u::Engine::load_deployment ( std::string  deploy)

Load a deployment file and launch the actors that it contains.

◆ get_host_count()

size_t simgrid::s4u::Engine::get_host_count ( )

◆ get_all_hosts()

std::vector<Host*> simgrid::s4u::Engine::get_all_hosts ( )

Returns the list of all hosts found in the platform.

◆ get_filtered_hosts()

std::vector<Host*> simgrid::s4u::Engine::get_filtered_hosts ( std::function< bool(Host *)>  filter)

◆ host_by_name()

simgrid::s4u::Host* simgrid::s4u::Engine::host_by_name ( std::string  name)

◆ host_by_name_or_null()

simgrid::s4u::Host* simgrid::s4u::Engine::host_by_name_or_null ( std::string  name)

◆ get_link_count()

size_t simgrid::s4u::Engine::get_link_count ( )

◆ get_all_links()

std::vector<Link*> simgrid::s4u::Engine::get_all_links ( )

◆ get_filtered_links()

std::vector<Link*> simgrid::s4u::Engine::get_filtered_links ( std::function< bool(Link *)>  filter)

◆ link_by_name()

simgrid::s4u::Link* simgrid::s4u::Engine::link_by_name ( std::string  name)

◆ link_by_name_or_null()

simgrid::s4u::Link* simgrid::s4u::Engine::link_by_name_or_null ( std::string  name)

◆ get_actor_count()

size_t simgrid::s4u::Engine::get_actor_count ( )

◆ get_all_actors()

std::vector<ActorPtr> simgrid::s4u::Engine::get_all_actors ( )

◆ get_filtered_actors()

std::vector<ActorPtr> simgrid::s4u::Engine::get_filtered_actors ( std::function< bool(ActorPtr)>  filter)

◆ get_storage_count()

size_t simgrid::s4u::Engine::get_storage_count ( )

◆ get_all_storages()

std::vector<Storage*> simgrid::s4u::Engine::get_all_storages ( )

◆ storage_by_name()

simgrid::s4u::Storage* simgrid::s4u::Engine::storage_by_name ( std::string  name)

◆ storage_by_name_or_null()

simgrid::s4u::Storage* simgrid::s4u::Engine::storage_by_name_or_null ( std::string  name)

◆ get_all_netpoints()

std::vector<simgrid::kernel::routing::NetPoint*> simgrid::s4u::Engine::get_all_netpoints ( )

◆ netpoint_by_name_or_null()

simgrid::kernel::routing::NetPoint* simgrid::s4u::Engine::netpoint_by_name_or_null ( std::string  name)

◆ get_netzone_root()

simgrid::s4u::NetZone* simgrid::s4u::Engine::get_netzone_root ( )

◆ set_netzone_root()

void simgrid::s4u::Engine::set_netzone_root ( s4u::NetZone netzone)

◆ netzone_by_name_or_null()

simgrid::s4u::NetZone* simgrid::s4u::Engine::netzone_by_name_or_null ( std::string  name)

◆ get_filtered_netzones()

template<class T >
std::vector<T*> simgrid::s4u::Engine::get_filtered_netzones ( )
inline

Retrieves all netzones of the type indicated by the template argument.

◆ is_initialized()

static bool simgrid::s4u::Engine::is_initialized ( )
static

Returns whether SimGrid was initialized yet – mostly for internal use.

◆ set_config()

void simgrid::s4u::Engine::set_config ( std::string  str)

set a configuration variable

Do –help on any simgrid binary to see the list of currently existing configuration variables (see also options).

Example: e->set_config("host/model:ptask_L07");

◆ loadPlatform()

void simgrid::s4u::Engine::loadPlatform ( std::string  platf)
inline

◆ registerFunction() [1/3]

void simgrid::s4u::Engine::registerFunction ( std::string  name,
int(*)(int, char **)  code 
)
inline

◆ registerDefault()

void simgrid::s4u::Engine::registerDefault ( int(*)(int, char **)  code)
inline

◆ registerFunction() [2/3]

template<class F >
void simgrid::s4u::Engine::registerFunction ( std::string  name)
inline

◆ registerFunction() [3/3]

template<class F >
void simgrid::s4u::Engine::registerFunction ( std::string  name,
code 
)
inline

◆ loadDeployment()

void simgrid::s4u::Engine::loadDeployment ( std::string  deploy)
inline

◆ hostByName()

simgrid::s4u::Host* simgrid::s4u::Engine::hostByName ( std::string  name)
inline

◆ hostByNameOrNull()

simgrid::s4u::Host* simgrid::s4u::Engine::hostByNameOrNull ( std::string  name)
inline

◆ storageByName()

simgrid::s4u::Storage* simgrid::s4u::Engine::storageByName ( std::string  name)
inline

◆ storageByNameOrNull()

simgrid::s4u::Storage* simgrid::s4u::Engine::storageByNameOrNull ( std::string  name)
inline

◆ getHostCount()

size_t simgrid::s4u::Engine::getHostCount ( )
inline

◆ getHostList()

void simgrid::s4u::Engine::getHostList ( std::vector< Host *> *  whereTo)

◆ getAllHosts()

std::vector<Host*> simgrid::s4u::Engine::getAllHosts ( )
inline

◆ getLinkCount()

size_t simgrid::s4u::Engine::getLinkCount ( )
inline

◆ getLinkList()

void simgrid::s4u::Engine::getLinkList ( std::vector< Link *> *  list)

◆ getAllLinks()

std::vector<Link*> simgrid::s4u::Engine::getAllLinks ( )
inline
Deprecated:
See Engine::get_link_list()

◆ getAllStorages()

std::vector<Storage*> simgrid::s4u::Engine::getAllStorages ( )
inline

◆ getClock()

static double simgrid::s4u::Engine::getClock ( )
inlinestatic

◆ getNetpointList()

void simgrid::s4u::Engine::getNetpointList ( std::vector< simgrid::kernel::routing::NetPoint *> *  list)

◆ getNetpointByNameOrNull()

simgrid::kernel::routing::NetPoint* simgrid::s4u::Engine::getNetpointByNameOrNull ( std::string  name)
inline

◆ getNetRoot()

simgrid::s4u::NetZone* simgrid::s4u::Engine::getNetRoot ( )
inline

◆ getNetzoneByNameOrNull()

simgrid::s4u::NetZone* simgrid::s4u::Engine::getNetzoneByNameOrNull ( std::string  name)
inline

◆ getNetzoneByType()

template<class T >
void simgrid::s4u::Engine::getNetzoneByType ( std::vector< T *> *  whereto)
inline
Deprecated:
See Engine::filter_netzones_by_type()

◆ getInstance()

static s4u::Engine* simgrid::s4u::Engine::getInstance ( )
inlinestatic

◆ isInitialized()

static bool simgrid::s4u::Engine::isInitialized ( )
inlinestatic

◆ setConfig()

void simgrid::s4u::Engine::setConfig ( std::string  str)
inline

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