SimGrid  3.9.90
Versatile Simulation of Distributed Systems
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Simulation

Functions for creating the environment and launching the simulation. More...

Functions

void SD_init (int *argc, char **argv)
 Initializes SD internal data. More...
 
void SD_config (const char *key, const char *value)
 set a configuration variable More...
 
void SD_application_reinit (void)
 Reinits the application part of the simulation (experimental feature) More...
 
void SD_create_environment (const char *platform_file)
 Creates the environment. More...
 
xbt_dynar_t SD_simulate (double how_long)
 Launches the simulation. More...
 
double SD_get_clock (void)
 Returns the current clock. More...
 
void SD_exit (void)
 Destroys all SD internal data. More...
 
xbt_dynar_t SD_daxload (const char *filename)
 loads a DAX file describing a DAG More...
 
xbt_dynar_t SD_dotload (const char *filename)
 loads a DOT file describing a DAG More...
 

Detailed Description

Functions for creating the environment and launching the simulation.

This section describes the functions for initialising SimDag, launching the simulation and exiting SimDag.

Function Documentation

void SD_init ( int *  argc,
char **  argv 
)

Initializes SD internal data.

This function must be called before any other SD function. Then you should call SD_create_environment().

Parameters
argcargument number
argvargument list
See Also
SD_create_environment(), SD_exit()
void SD_config ( const char *  key,
const char *  value 
)

set a configuration variable

Do –help on any simgrid binary to see the list of currently existing configuration variables, and see Section Simgrid options and configurations.

Example: SD_config("workstation/model","default");

void SD_application_reinit ( void  )

Reinits the application part of the simulation (experimental feature)

This function allows you to run several simulations on the same platform by resetting the part describing the application.

Warning
: this function is still experimental and not perfect. For example, the simulation clock (and traces usage) is not reset. So, do not use it if you use traces in your simulation, and do not use absolute timing after using it. That being said, this function is still precious if you want to compare a bunch of heuristics on the same platforms.
void SD_create_environment ( const char *  platform_file)

Creates the environment.

The environment (i.e. the workstations and the links) is created with the data stored in the given XML platform file.

Parameters
platform_filename of an XML file describing the environment to create
See Also
Workstations, Links

The XML file follows this DTD:

<!-- Small DTD for SURF based tools. -->
<!ELEMENT platform ((config|random)*,(include|cluster|cabinet|peer|AS|trace|trace_connect)*,(process)*)>
<!ATTLIST platform version CDATA "0.0">
<!ELEMENT include (include|cluster|cabinet|peer|AS|trace|trace_connect)*>
<!ATTLIST include file CDATA #REQUIRED>
<!ELEMENT trace (#PCDATA)>
<!ATTLIST trace id CDATA #REQUIRED>
<!ATTLIST trace file CDATA "">
<!ATTLIST trace periodicity CDATA #REQUIRED>
<!ELEMENT random EMPTY>
<!ATTLIST random id CDATA #REQUIRED>
<!ATTLIST random min CDATA #REQUIRED>
<!ATTLIST random max CDATA #REQUIRED>
<!ATTLIST random mean CDATA #REQUIRED>
<!ATTLIST random std_deviation CDATA #REQUIRED>
<!ATTLIST random seed CDATA "2147483647">
<!ATTLIST random radical CDATA "">
<!ATTLIST random generator (DRAND48|RAND|RNGSTREAM|NONE) "DRAND48">
<!ELEMENT trace_connect EMPTY>
<!ATTLIST trace_connect kind (HOST_AVAIL|POWER|LINK_AVAIL|BANDWIDTH|LATENCY) "HOST_AVAIL">
<!ATTLIST trace_connect trace CDATA #REQUIRED>
<!ATTLIST trace_connect element CDATA #REQUIRED>
<!ELEMENT AS ((prop*),(((AS|include|storage_type|storage|link|backbone|cabinet|cluster|peer|trace|trace_connect)*,(ASroute|trace|trace_connect|bypassASroute)*,(trace|trace_connect)*)|((include|storage_type|storage|host|gpu|cabinet|router|link|backbone|trace|trace_connect|host_link)*,(route|trace|trace_connect|bypassRoute)*)))>
<!ATTLIST AS id CDATA #REQUIRED>
<!ATTLIST AS routing (Full|Floyd|Dijkstra|DijkstraCache|None|Vivaldi|Cluster) "None">
<!ELEMENT storage_type (prop*)>
<!ATTLIST storage_type id CDATA #REQUIRED>
<!ATTLIST storage_type model CDATA #REQUIRED>
<!ATTLIST storage_type size CDATA #REQUIRED>
<!ATTLIST storage_type content CDATA "">
<!ATTLIST storage_type content_type CDATA "txt_unix">
<!ELEMENT storage (prop*)>
<!ATTLIST storage id CDATA #REQUIRED>
<!ATTLIST storage typeId CDATA #REQUIRED>
<!ATTLIST storage content CDATA "">
<!ATTLIST storage content_type CDATA "txt_unix">
<!ELEMENT mount EMPTY>
<!ATTLIST mount storageId CDATA #REQUIRED>
<!ATTLIST mount name CDATA #REQUIRED>
<!ELEMENT mstorage EMPTY>
<!ATTLIST mstorage typeId CDATA #REQUIRED>
<!ATTLIST mstorage name CDATA #REQUIRED>
<!ELEMENT host (prop|mount|mstorage)*>
<!ATTLIST host id CDATA #REQUIRED>
<!ATTLIST host power CDATA #REQUIRED>
<!ATTLIST host core CDATA "1">
<!ATTLIST host availability CDATA "1.0">
<!ATTLIST host availability_file CDATA "">
<!ATTLIST host state (ON|OFF) "ON">
<!ATTLIST host state_file CDATA "">
<!ATTLIST host coordinates CDATA "">
<!ATTLIST host pstate CDATA "0.0">
<!ELEMENT gpu EMPTY>
<!ATTLIST gpu name CDATA #REQUIRED>
<!ELEMENT host_link EMPTY>
<!ATTLIST host_link id CDATA #REQUIRED>
<!ATTLIST host_link up CDATA #REQUIRED>
<!ATTLIST host_link down CDATA #REQUIRED>
<!ELEMENT cluster (prop*)>
<!ATTLIST cluster id CDATA #REQUIRED>
<!ATTLIST cluster prefix CDATA #REQUIRED>
<!ATTLIST cluster suffix CDATA #REQUIRED>
<!ATTLIST cluster radical CDATA #REQUIRED>
<!ATTLIST cluster power CDATA #REQUIRED>
<!ATTLIST cluster core CDATA "1">
<!ATTLIST cluster bw CDATA #REQUIRED>
<!ATTLIST cluster lat CDATA #REQUIRED>
<!ATTLIST cluster sharing_policy (SHARED|FULLDUPLEX|FATPIPE) "FULLDUPLEX">
<!ATTLIST cluster bb_bw CDATA "">
<!ATTLIST cluster bb_lat CDATA "">
<!ATTLIST cluster bb_sharing_policy (SHARED|FATPIPE) "SHARED">
<!ATTLIST cluster availability_file CDATA "">
<!ATTLIST cluster state_file CDATA "">
<!ATTLIST cluster router_id CDATA "">
<!ATTLIST cluster limiter_link CDATA "">
<!ATTLIST cluster loopback_bw CDATA "">
<!ATTLIST cluster loopback_lat CDATA "">
<!ELEMENT cabinet EMPTY>
<!ATTLIST cabinet id CDATA #REQUIRED>
<!ATTLIST cabinet prefix CDATA #REQUIRED>
<!ATTLIST cabinet suffix CDATA #REQUIRED>
<!ATTLIST cabinet radical CDATA #REQUIRED>
<!ATTLIST cabinet power CDATA #REQUIRED>
<!ATTLIST cabinet bw CDATA #REQUIRED>
<!ATTLIST cabinet lat CDATA #REQUIRED>
<!ELEMENT peer EMPTY>
<!ATTLIST peer id CDATA #REQUIRED>
<!ATTLIST peer power CDATA #REQUIRED>
<!ATTLIST peer bw_in CDATA #REQUIRED>
<!ATTLIST peer bw_out CDATA #REQUIRED>
<!ATTLIST peer lat CDATA #REQUIRED>
<!ATTLIST peer coordinates CDATA "">
<!ATTLIST peer availability_file CDATA "">
<!ATTLIST peer state_file CDATA "">
<!ELEMENT router EMPTY>
<!ATTLIST router id CDATA #REQUIRED>
<!ATTLIST router coordinates CDATA "">
<!ELEMENT backbone EMPTY>
<!ATTLIST backbone id CDATA #REQUIRED>
<!ATTLIST backbone bandwidth CDATA #REQUIRED>
<!ATTLIST backbone latency CDATA #REQUIRED>
<!ELEMENT link (prop*)>
<!ATTLIST link id CDATA #REQUIRED>
<!ATTLIST link bandwidth CDATA #REQUIRED>
<!ATTLIST link bandwidth_file CDATA "">
<!ATTLIST link latency CDATA "0.0">
<!ATTLIST link latency_file CDATA "">
<!ATTLIST link state (ON|OFF) "ON">
<!ATTLIST link state_file CDATA "">
<!ATTLIST link sharing_policy (SHARED|FATPIPE|FULLDUPLEX) "SHARED">
<!ELEMENT route (link_ctn*)>
<!ATTLIST route src CDATA #REQUIRED>
<!ATTLIST route dst CDATA #REQUIRED>
<!ATTLIST route symmetrical (YES|NO) "YES">
<!ELEMENT ASroute (link_ctn*)>
<!ATTLIST ASroute src CDATA #REQUIRED>
<!ATTLIST ASroute dst CDATA #REQUIRED>
<!ATTLIST ASroute gw_src CDATA #REQUIRED>
<!ATTLIST ASroute gw_dst CDATA #REQUIRED>
<!ATTLIST ASroute symmetrical (YES|NO) "YES">
<!ELEMENT link_ctn EMPTY>
<!ATTLIST link_ctn id CDATA #REQUIRED>
<!ATTLIST link_ctn direction (UP|DOWN|NONE) "NONE">
<!ELEMENT bypassRoute (link_ctn*)>
<!ATTLIST bypassRoute src CDATA #REQUIRED>
<!ATTLIST bypassRoute dst CDATA #REQUIRED>
<!ELEMENT bypassASroute (link_ctn*)>
<!ATTLIST bypassASroute src CDATA #REQUIRED>
<!ATTLIST bypassASroute dst CDATA #REQUIRED>
<!ATTLIST bypassASroute gw_src CDATA #REQUIRED>
<!ATTLIST bypassASroute gw_dst CDATA #REQUIRED>
<!ELEMENT process ((argument|prop)*)>
<!ATTLIST process host CDATA #REQUIRED>
<!ATTLIST process function CDATA #REQUIRED>
<!ATTLIST process start_time CDATA "-1.0">
<!ATTLIST process kill_time CDATA "-1.0">
<!ATTLIST process on_failure (DIE|RESTART) "DIE">
<!ELEMENT argument EMPTY>
<!ATTLIST argument value CDATA #REQUIRED>
<!ELEMENT config (prop*)>
<!ATTLIST config id CDATA "">
<!ELEMENT prop EMPTY>
<!ATTLIST prop id CDATA #REQUIRED> <!-- <!ATTLIST prop key CDATA #REQUIRED> -->
<!ATTLIST prop value CDATA #REQUIRED>

Here is a small example of such a platform:

<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
<platform version="3">
<AS id="AS0" routing="Full">
<!-- ljlkj -->
<host id="Tremblay" power="98.095Mf"/>
<host id="Jupiter" power="76.296Mf"/>
<host id="Fafard" power="76.296Mf"/>
<host id="Ginette" power="48.492Mf"/>
<host id="Bourassa" power="48.492Mf"/>
<link id="6" bandwidth="41.279125MBps" latency="59.904us"/>
<link id="11" bandwidth="252.75kBps" latency="5.70455ms"/>
<link id="3" bandwidth="34.285625MBps" latency="514.433us"/>
<link id="7" bandwidth="11.618875MBps" latency="189.98us"/>
<link id="9" bandwidth="7.20975MBps" latency="1.461517ms"/>
<link id="12" bandwidth="1.792625MBps" latency="7.877863ms"/>
<link id="2" bandwidth="118.6825MBps" latency="136.931us"/>
<link id="8" bandwidth="8.158MBps" latency="270.544us"/>
<link id="1" bandwidth="34.285625MBps" latency="514.433us"/>
<link id="4" bandwidth="10.099625MBps" latency="479.78us"/>
<link id="0" bandwidth="41.279125MBps" latency="59.904us"/>
<link id="10" bandwidth="4.67975MBps" latency="848.712us"/>
<link id="5" bandwidth="27.94625MBps" latency="278.066us"/>
<link id="loopback" bandwidth="498MBps" latency="15us" sharing_policy="FATPIPE"/>
<route src="Tremblay" dst="Tremblay"><link_ctn id="loopback"/></route>
<route src="Jupiter" dst="Jupiter"><link_ctn id="loopback"/></route>
<route src="Fafard" dst="Fafard"><link_ctn id="loopback"/></route>
<route src="Ginette" dst="Ginette"><link_ctn id="loopback"/></route>
<route src="Bourassa" dst="Bourassa"><link_ctn id="loopback"/></route>
<route src="Tremblay" dst="Jupiter">
<link_ctn id="9"/>
</route>
<route src="Tremblay" dst="Fafard">
<link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="8"/>
</route>
<route src="Tremblay" dst="Ginette">
<link_ctn id="4"/><link_ctn id="3"/><link_ctn id="5"/>
</route>
<route src="Tremblay" dst="Bourassa">
<link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
</route>
<route src="Jupiter" dst="Fafard">
<link_ctn id="9"/><link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="8"/>
</route>
<route src="Jupiter" dst="Ginette">
<link_ctn id="9"/><link_ctn id="4"/><link_ctn id="3"/><link_ctn id="5"/>
</route>
<route src="Jupiter" dst="Bourassa">
<link_ctn id="9"/><link_ctn id="4"/><link_ctn id="3"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
</route>
<route src="Fafard" dst="Ginette">
<link_ctn id="8"/><link_ctn id="1"/><link_ctn id="0"/><link_ctn id="2"/><link_ctn id="5"/>
</route>
<route src="Fafard" dst="Bourassa">
<link_ctn id="8"/><link_ctn id="6"/><link_ctn id="7"/>
</route>
<route src="Ginette" dst="Bourassa">
<link_ctn id="5"/><link_ctn id="2"/><link_ctn id="0"/><link_ctn id="1"/><link_ctn id="6"/><link_ctn id="7"/>
</route>
</AS>
</platform>
xbt_dynar_t SD_simulate ( double  how_long)

Launches the simulation.

The function will execute the SD_RUNNABLE runnable tasks. If how_long is positive, then the simulation will be stopped either when time reaches how_long or when a watch point is reached. A non-positive value for how_long means no time limit, in which case the simulation will be stopped either when a watch point is reached or when no more task can be executed. Then you can call SD_simulate() again.

Parameters
how_longmaximum duration of the simulation (a negative value means no time limit)
Returns
a dynar of SD_task_t whose state has changed.
See Also
SD_task_schedule(), SD_task_watch()
double SD_get_clock ( void  )

Returns the current clock.

Returns
the current clock, in second
void SD_exit ( void  )

Destroys all SD internal data.

This function should be called when the simulation is over. Don't forget to destroy too.

See Also
SD_init(), SD_task_destroy()
xbt_dynar_t SD_daxload ( const char *  filename)

loads a DAX file describing a DAG

See https://confluence.pegasus.isi.edu/display/pegasus/WorkflowGenerator for more details.

xbt_dynar_t SD_dotload ( const char *  filename)

loads a DOT file describing a DAG

See http://www.graphviz.org/doc/info/lang.html for more details. To obtain information about transfers and tasks, two attributes are required : size on task (execution time in Flop) and size on edge (the amount of data transfer in bit). if they aren't here, there choose to be equal to zero.