SimGrid
3.7
Scalable simulation of distributed systems
|
Describes how to setup and control your simulation. More...
Functions | |
void | MSG_launch_application (const char *file) |
An application deployer. | |
void | MSG_function_register (const char *name, xbt_main_func_t code) |
Registers the main function of a process in a global table. | |
void | MSG_function_register_default (xbt_main_func_t code) |
Registers a function as the default main function of processes. | |
xbt_main_func_t | MSG_get_registered_function (const char *name) |
Retrieves a registered main function. | |
void | MSG_create_environment (const char *file) |
A platform constructor. | |
void | MSG_global_init_args (int *argc, char **argv) |
Initialize some MSG internal data. | |
void | MSG_global_init (int *argc, char **argv) |
Initialize some MSG internal data. | |
MSG_error_t | MSG_main (void) |
Launch the MSG simulation. | |
int | MSG_process_killall (int reset_PIDs) |
Kill all running process. | |
MSG_error_t | MSG_clean (void) |
Clean the MSG simulation. | |
double | MSG_get_clock (void) |
A clock (in second). | |
enum | MSG_error_t { MSG_OK = 0, MSG_TIMEOUT = 1, MSG_TRANSFER_FAILURE = 2, MSG_HOST_FAILURE = 4, MSG_TASK_CANCELED = 8 } |
Return code of most MSG functions. More... |
Describes how to setup and control your simulation.
The basic workflow is the following (check the MSG Examples for details).
enum MSG_error_t |
Return code of most MSG functions.
void MSG_launch_application | ( | const char * | file | ) |
An application deployer.
Creates the process described in file.
file | a filename of a xml description of the application. This file follows this DTD : |
<!-- Small DTD for SURF based tools. --> <!ELEMENT platform ((config|random)*,(include|cluster|peer|AS|trace|trace_connect)*,(process)*)> <!ATTLIST platform version CDATA "0.0"> <!ELEMENT include (include|cluster|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 (prop*)> <!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 (((AS|include|storage_type|storage|link|cluster|peer|trace|trace_connect)*,(ASroute|trace|trace_connect|bypassASroute)*,(trace|trace_connect)*)|((include|storage_type|storage|host|router|link|trace|trace_connect)*,(route|trace|trace_connect|bypassRoute)*))> <!ATTLIST AS id CDATA #REQUIRED> <!ATTLIST AS routing CDATA #REQUIRED> <!ELEMENT storage_type (prop*)> <!ATTLIST storage_type id CDATA #REQUIRED> <!ATTLIST storage_type model CDATA #REQUIRED> <!ATTLIST storage_type content CDATA "0"> <!ELEMENT storage (prop*)> <!ATTLIST storage id CDATA #REQUIRED> <!ATTLIST storage typeId CDATA #REQUIRED> <!ELEMENT mount EMPTY> <!ATTLIST mount id 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 ""> <!ELEMENT cluster EMPTY> <!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 ""> <!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 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"> <!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"> <!-- The master process (with some arguments) --> <process host="Tremblay" function="master"> <argument value="20"/> <!-- Number of tasks --> <argument value="50000000"/> <!-- Computation size of tasks --> <argument value="1000000"/> <!-- Communication size of tasks --> <argument value="Jupiter"/> <!-- First slave --> <argument value="Fafard"/> <!-- Second slave --> <argument value="Ginette"/> <!-- Third slave --> <argument value="Bourassa"/> <!-- Last slave --> <argument value="Tremblay"/> <!-- Me! I can work too! --> </process> <!-- The slave process (with no argument) --> <process host="Tremblay" function="slave"/> <process host="Jupiter" function="slave"/> <process host="Fafard" function="slave"/> <process host="Ginette" function="slave"/> <process host="Bourassa" function="slave"/> </platform>
Have a look in the directory examples/msg/ to have a bigger example.
void MSG_function_register | ( | const char * | name, |
xbt_main_func_t | code | ||
) |
Registers the main function of a process in a global table.
Registers a code function in a global table. This table is then used by MSG_launch_application.
name | the reference name of the function. |
code | the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[])) |
void MSG_function_register_default | ( | xbt_main_func_t | code | ) |
Registers a function as the default main function of processes.
Registers a code function as being the default value. This function will get used by MSG_launch_application() when there is no registered function of the requested name in.
code | the function (must have the same prototype than the main function of any C program: int ..(int argc, char *argv[])) |
xbt_main_func_t MSG_get_registered_function | ( | const char * | name | ) |
Retrieves a registered main function.
Registers a code function in a global table. This table is then used by MSG_launch_application.
name | the reference name of the function. |
void MSG_create_environment | ( | const char * | file | ) |
A platform constructor.
Creates a new platform, including hosts, links and the routing_table.
file | a filename of a xml description of a platform. This file follows this DTD : |
<!-- Small DTD for SURF based tools. --> <!ELEMENT platform ((config|random)*,(include|cluster|peer|AS|trace|trace_connect)*,(process)*)> <!ATTLIST platform version CDATA "0.0"> <!ELEMENT include (include|cluster|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 (prop*)> <!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 (((AS|include|storage_type|storage|link|cluster|peer|trace|trace_connect)*,(ASroute|trace|trace_connect|bypassASroute)*,(trace|trace_connect)*)|((include|storage_type|storage|host|router|link|trace|trace_connect)*,(route|trace|trace_connect|bypassRoute)*))> <!ATTLIST AS id CDATA #REQUIRED> <!ATTLIST AS routing CDATA #REQUIRED> <!ELEMENT storage_type (prop*)> <!ATTLIST storage_type id CDATA #REQUIRED> <!ATTLIST storage_type model CDATA #REQUIRED> <!ATTLIST storage_type content CDATA "0"> <!ELEMENT storage (prop*)> <!ATTLIST storage id CDATA #REQUIRED> <!ATTLIST storage typeId CDATA #REQUIRED> <!ELEMENT mount EMPTY> <!ATTLIST mount id 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 ""> <!ELEMENT cluster EMPTY> <!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 ""> <!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 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"> <!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="98095000"/> <host id="Jupiter" power="76296000"/> <host id="Fafard" power="76296000"/> <host id="Ginette" power="48492000"/> <host id="Bourassa" power="48492000"/> <link id="6" bandwidth="41279125" latency="5.9904e-05"/> <link id="11" bandwidth="252750" latency="0.00570455"/> <link id="3" bandwidth="34285625" latency="0.000514433"/> <link id="7" bandwidth="11618875" latency="0.00018998"/> <link id="9" bandwidth="7209750" latency="0.001461517"/> <link id="12" bandwidth="1792625" latency="0.007877863"/> <link id="2" bandwidth="118682500" latency="0.000136931"/> <link id="8" bandwidth="8158000" latency="0.000270544"/> <link id="1" bandwidth="34285625" latency="0.000514433"/> <link id="4" bandwidth="10099625" latency="0.00047978"/> <link id="0" bandwidth="41279125" latency="5.9904e-05"/> <link id="10" bandwidth="4679750" latency="0.000848712"/> <link id="5" bandwidth="27946250" latency="0.000278066"/> <link id="loopback" bandwidth="498000000" latency="0.000015" 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>
Have a look in the directory examples/msg/ to have a big example.
int MSG_process_killall | ( | int | reset_PIDs | ) |
Kill all running process.
reset_PIDs | should we reset the PID numbers. A negative number means no reset and a positive number will be used to set the PID of the next newly created process. |
Back to the main Simgrid Documentation page |
The version of SimGrid documented here is v3.7. Documentation of other versions can be found in their respective archive files (directory doc/html). |
Generated by ![]() |