Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / include / simgrid / engine.h
1 /* Copyright (c) 2018-2022. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef INCLUDE_SIMGRID_ENGINE_H_
7 #define INCLUDE_SIMGRID_ENGINE_H_
8
9 #include <simgrid/forward.h>
10 #include <stddef.h>
11
12 SG_BEGIN_DECL /* C interface */
13
14     /** Initialize the SimGrid engine, taking the command line parameters of your main function. */
15     XBT_PUBLIC void
16     simgrid_init(int* argc, char** argv);
17
18 /** Creates a new platform, including hosts, links, and the routing table.
19  *
20  * \beginrst
21  * See also: :ref:`platform`.
22  * \endrst
23  */
24 XBT_PUBLIC void simgrid_load_platform(const char* filename);
25 /** Load a deployment file and launch the actors that it contains
26  *
27  * \beginrst
28  * See also: :ref:`deploy`.
29  * \endrst
30  */
31 XBT_PUBLIC void simgrid_load_deployment(const char* filename);
32 /** Run the simulation until its end */
33 XBT_PUBLIC void simgrid_run();
34 /** Run the simulation until the specified date */
35 XBT_PUBLIC void simgrid_run_until(double max_date);
36 /** Registers the main function of an actor that will be launched from the deployment file */
37 XBT_PUBLIC void simgrid_register_function(const char* name, void (*code)(int, char**));
38 /** Registers a function as the default main function of actors
39  *
40  * It will be used as fallback when the function requested from the deployment file was not registered.
41  * It is used for trace-based simulations (see examples/cpp/replay-comms and similar).
42  */
43 XBT_PUBLIC void simgrid_register_default(void (*code)(int, char**));
44 /** Retrieve the simulation time (in seconds) */
45 XBT_PUBLIC double simgrid_get_clock();
46 /* Set some code to execute in the maestro (must be used before the engine creation)
47  *
48  * If no maestro code is registered (the default), the main thread
49  * is assumed to be the maestro. */
50 XBT_PUBLIC void simgrid_set_maestro(void (*code)(void*), void* data);
51
52 /** @brief Allow other libraries to react to the --help flag, too
53  *
54  * When finding --help on the command line, simgrid usually stops right after displaying its help message.
55  * If you are writing a library using simgrid, you may want to display your own help message before everything stops.
56  * If so, just call this function before having simgrid parsing the command line, and you will be given the control
57  * even if the user is asking for help.
58  */
59 XBT_PUBLIC void sg_config_continue_after_help();
60
61 SG_END_DECL
62
63 #endif /* INCLUDE_SIMGRID_ENGINE_H_ */