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 Pop an action from the done actions set
21 * @param model The model from which the action is extracted
22 * @return An action in done state
24 XBT_PUBLIC simgrid::kernel::resource::Action*
25 surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model);
28 * @brief Pop an action from the failed actions set
30 * @param model The model from which the action is extracted
31 * @return An action in failed state
33 XBT_PUBLIC simgrid::kernel::resource::Action*
34 surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model);
37 * @brief Get the size of the running action set of a model
39 * @param model The model
40 * @return The size of the running action set
42 XBT_PUBLIC int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model);
45 * @brief [brief description]
46 * @details [long description]
48 * @param action The surf cpu action
49 * @param bound [description]
51 XBT_PUBLIC void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound);
55 /**************************************/
56 /* Implementations of model object */
57 /**************************************/
59 /** \ingroup SURF_models
60 * \brief The CPU model object for the physical machine layer
62 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_pm;
64 /** \ingroup SURF_models
65 * \brief The CPU model object for the virtual machine layer
67 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_vm;
69 XBT_PUBLIC_DATA simgrid::surf::StorageModel* surf_storage_model;
71 /** \ingroup SURF_models
72 * \brief The host model
74 * Note that when you create an API on top of SURF, the host model should be the only one you use
75 * because depending on the platform model, the network model and the CPU model may not exist.
77 XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
80 /*** SURF Globals **************************/
82 /** \ingroup SURF_simulation
83 * \brief Initialize SURF
84 * \param argc argument number
85 * \param argv arguments
87 * This function has to be called to initialize the common structures. Then you will have to create the environment by
88 * calling e.g. surf_host_model_init_CM02()
90 * \see surf_host_model_init_CM02(), surf_host_model_init_compound(), surf_exit()
92 XBT_PUBLIC void surf_init(int* argc, char** argv); /* initialize common structures */
94 /** \ingroup SURF_simulation
95 * \brief Finish simulation initialization
97 * This function must be called before the first call to surf_solve()
99 XBT_PUBLIC void surf_presolve();
101 /** \ingroup SURF_simulation
102 * \brief Performs a part of the simulation
103 * \param max_date Maximum date to update the simulation to, or -1
104 * \return the elapsed time, or -1.0 if no event could be executed
106 * This function execute all possible events, update the action states and returns the time elapsed.
107 * When you call execute or communicate on a model, the corresponding actions are not executed immediately but only
108 * when you call surf_solve.
109 * Note that the returned elapsed time can be zero.
111 XBT_PUBLIC double surf_solve(double max_date);
113 /** \ingroup SURF_simulation
114 * \brief Return the current time
116 * Return the current time in millisecond.
118 XBT_PUBLIC double surf_get_clock();
120 /** \ingroup SURF_simulation
127 XBT_PUBLIC void surf_exit();
129 /* surf parse file related (public because called from a test suite) */
130 XBT_PUBLIC void parse_platform_file(const char* file);
132 /********** Tracing **********/
134 /* instr_routing.c */
135 xbt_graph_t instr_routing_platform_graph();
136 void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename);