Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : new test unit for snapshot comparison
[simgrid.git] / doc / module-surf.doc
1 /** \addtogroup SURF_API
2
3   \section SURF_doc Surf documentation
4    - \ref SURF_simulation
5    - \ref SURF_actions
6    - \ref SURF_resources
7    - \ref SURF_build_api
8
9 */
10
11 /** \defgroup SURF_simulation Simulation
12     \ingroup SURF_API
13     \brief Functions for creating the environment and launching the simulation
14
15     This section describes the functions for initialising SURF, performing
16     the simulation and exiting SURF.
17 */
18
19 /** \defgroup SURF_actions SURF actions
20     \ingroup SURF_API
21     \brief This section describes the different datatypes and operations related to the actions in SURF.
22
23     \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Actions" --> \endhtmlonly
24 */
25
26 /** \defgroup SURF_resources SURF resources
27     \ingroup SURF_API
28     \brief This section describes the different datatypes and operations related to the resources in SURF.
29
30     \htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Resources" --> \endhtmlonly
31 */
32
33 /** \defgroup SURF_build_api Create a new API
34     \ingroup SURF_API
35     \brief How to build a new API on top of SURF
36
37     SURF provides the functionnalities to simulate the platform. There are two main datatypes in SURF:
38     the actions and the resources. Several types of resources exist:
39         - the workstation resource,
40         - the network resource,
41         - the CPU resource,
42         - the timer resource.
43
44     The implentation of these resources depends on the platform model you choose. There are several
45     platform models. You can select your model by calling surf_workstation_resource_init_CLM03()
46     or surf_workstation_resource_init_KCCFLN05(). See the documentation of these functions to have
47     more details about the models. Remember that the model KCCFLN05 is an implementation of both the
48     workstation resource and the network.
49
50     Typically, your functions should call the SURF functions provided by the structures
51     \a surf_workstation_resource->common_public and \a surf_workstation_resource->extension_public.
52     See surf_resource_public and surf_workstation_resource_extension_public to know the available functions.
53
54     To initialize SURF, call surf_init(). Then call surf_timer_resource_init() and
55     surf_workstation_resource_init_CLM03() or surf_workstation_resource_init_KCCFLN05()
56     to create the platform.
57
58     Then you can access the workstations and the network links with
59     the global variables \ref host_lib
60     and \ref link_lib. Some functions in \a surf_workstation_resource->extension_public can give
61     you some information about:
62         - a workstation: get_speed(), get_available_speed();
63         - a network link: get_link_name(), get_link_latency(), get_link_bandwith();
64         - a route: get_route(), get_route_size().
65
66     During the simulation, call \a surf_workstation_resource->extension_public->execute() to schedule a
67     computation task on a workstation, or \a surf_workstation_resource->extension_public->communicate()
68     to schedule a communication task between two workstations. You can also create parallel task
69     with \a surf_workstation_resource->extension_public->execute_parallel_task(). These functions return
70     a new action that represents the task you have just created.
71
72     To execute the actions created with \a execute(), \a communicate() or \a execute_parallel_task(), call
73     surf_solve(). The function surf_solve() is where the simulation takes place. It returns the
74     time elapsed to execute the actions. You can know what actions have changed their state thanks
75     to the states sets. For example, if your want to know what actions are finished,
76     extract them from \a surf_workstation_resource->common_public->states.done_action_set.
77     Depending on these results, you can schedule other tasks and call surf_solve() again.
78
79     When the simulation is over, just call surf_exit() to clean the memory.
80
81     Have a look at the implementation of \ref MSG_API "MSG" and \ref SD_API "Simdag" to see how these module
82     interact with SURF. But if you want to create a new API on top of SURF,
83     we strongly recommand you to contact us before anyway.
84
85 */