SimGrid  3.12
Versatile Simulation of Distributed Systems
Create a new API

How to build a new API on top of SURF. More...

Variables

xbt_lib_t host_lib
 A library containing all known hosts.
 

Detailed Description

How to build a new API on top of SURF.

SURF provides the functionalities to simulate the platform. There are two main data types in SURF: the actions and the resources. Several types of resources exist:

The implementation of these resources depends on the platform models you choose. You can select your model by calling surf_host_model_init_current_default() (which will give you a CLM03 model), or similar (see Simulation Models).

To initialize SURF, call surf_init(). Then surf_host_model_init_current_default() or surf_host_model_init_ptask_L07() to create the platform.

Then you can access the hosts with the global variables host_lib. Some functions of the SURF Host Interface and similar can give you some information about:

During the simulation, call surf_host_model->execute() to schedule a computation task on a host, or surf_host_model->communicate() to schedule a communication task between two hosts. You can also create parallel task with surf_host_model->extension_public->execute_parallel_task(). These functions return a new action that represents the task you have just created.

To execute the actions created with execute(), communicate() or execute_parallel_task(), call surf_solve(). The function surf_solve() is where the simulation takes place. It returns the time elapsed to execute the actions. You can know what actions have changed their state thanks to the states sets. For example, if your want to know what actions are finished, extract them from surf_host_model->common_public->states.done_action_set. Depending on these results, you can schedule other tasks and call surf_solve() again.

When the simulation is over, just call surf_exit() to clean the memory.

Have a look at the implementation of MSG and Simdag to see how these module interact with SURF. But if you want to create a new API on top of SURF, we strongly recommend you to contact us before anyway.