1 /* Copyright (c) 2004-2021. The SimGrid Team. All rights reserved. */
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. */
9 #include "simgrid/forward.h"
11 /** @ingroup SURF_models
12 * @brief The host model
14 * Note that when you create an API on top of SURF, the host model should be the only one you use
15 * because depending on the platform model, the network model and the CPU model may not exist.
17 XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
20 /*** SURF Globals **************************/
22 /** @ingroup SURF_simulation
23 * @brief Initialize SURF
24 * @param argc argument number
25 * @param argv arguments
27 * This function has to be called to initialize the common structures. Then you will have to create the environment by
28 * calling e.g. surf_host_model_init_CM02()
30 * @see surf_host_model_init_CM02(), surf_host_model_init_compound(), surf_exit()
32 XBT_PUBLIC void surf_init(int* argc, char** argv); /* initialize common structures */
34 /** @ingroup SURF_simulation
35 * @brief Finish simulation initialization
37 * This function must be called before the first call to surf_solve()
39 XBT_PUBLIC void surf_presolve();
41 /** @ingroup SURF_simulation
42 * @brief Performs a part of the simulation
43 * @param max_date Maximum date to update the simulation to, or -1
44 * @return the elapsed time, or -1.0 if no event could be executed
46 * This function execute all possible events, update the action states and returns the time elapsed.
47 * When you call execute or communicate on a model, the corresponding actions are not executed immediately but only
48 * when you call surf_solve.
49 * Note that the returned elapsed time can be zero.
51 XBT_PUBLIC double surf_solve(double max_date);
53 /** @ingroup SURF_simulation
54 * @brief Return the current time
56 * Return the current time in millisecond.
58 XBT_PUBLIC double surf_get_clock();
60 /** @ingroup SURF_simulation
67 XBT_PUBLIC void surf_exit();
69 /* surf parse file related (public because called from a test suite) */
70 XBT_PUBLIC void parse_platform_file(const std::string& file);