1 /* Copyright (c) 2004-2018. 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"
10 #include "xbt/graph.h"
12 /***************************/
13 /* Generic model object */
14 /***************************/
16 /** @{ @ingroup SURF_c_bindings */
19 * @brief Get the size of the running action set of a model
21 * @param model The model
22 * @return The size of the running action set
24 XBT_PUBLIC int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model);
27 * @brief [brief description]
28 * @details [long description]
30 * @param action The surf cpu action
31 * @param bound [description]
33 XBT_PUBLIC void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound);
37 /**************************************/
38 /* Implementations of model object */
39 /**************************************/
41 /** \ingroup SURF_models
42 * \brief The CPU model object for the physical machine layer
44 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_pm;
46 /** \ingroup SURF_models
47 * \brief The CPU model object for the virtual machine layer
49 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_vm;
51 XBT_PUBLIC_DATA simgrid::surf::StorageModel* surf_storage_model;
53 /** \ingroup SURF_models
54 * \brief The host model
56 * Note that when you create an API on top of SURF, the host model should be the only one you use
57 * because depending on the platform model, the network model and the CPU model may not exist.
59 XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
62 /*** SURF Globals **************************/
64 /** \ingroup SURF_simulation
65 * \brief Initialize SURF
66 * \param argc argument number
67 * \param argv arguments
69 * This function has to be called to initialize the common structures. Then you will have to create the environment by
70 * calling e.g. surf_host_model_init_CM02()
72 * \see surf_host_model_init_CM02(), surf_host_model_init_compound(), surf_exit()
74 XBT_PUBLIC void surf_init(int* argc, char** argv); /* initialize common structures */
76 /** \ingroup SURF_simulation
77 * \brief Finish simulation initialization
79 * This function must be called before the first call to surf_solve()
81 XBT_PUBLIC void surf_presolve();
83 /** \ingroup SURF_simulation
84 * \brief Performs a part of the simulation
85 * \param max_date Maximum date to update the simulation to, or -1
86 * \return the elapsed time, or -1.0 if no event could be executed
88 * This function execute all possible events, update the action states and returns the time elapsed.
89 * When you call execute or communicate on a model, the corresponding actions are not executed immediately but only
90 * when you call surf_solve.
91 * Note that the returned elapsed time can be zero.
93 XBT_PUBLIC double surf_solve(double max_date);
95 /** \ingroup SURF_simulation
96 * \brief Return the current time
98 * Return the current time in millisecond.
100 XBT_PUBLIC double surf_get_clock();
102 /** \ingroup SURF_simulation
109 XBT_PUBLIC void surf_exit();
111 /* surf parse file related (public because called from a test suite) */
112 XBT_PUBLIC void parse_platform_file(const char* file);