Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / include / surf / surf.hpp
1 /* Copyright (c) 2004-2018. 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 SURF_SURF_H
7 #define SURF_SURF_H
8
9 #include "simgrid/forward.h"
10
11 /** \ingroup SURF_models
12  *  \brief The CPU model object for the physical machine layer
13  */
14 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_pm;
15
16 /** \ingroup SURF_models
17  *  \brief The CPU model object for the virtual machine layer
18  */
19 XBT_PUBLIC_DATA simgrid::surf::CpuModel* surf_cpu_model_vm;
20
21 XBT_PUBLIC_DATA simgrid::surf::StorageModel* surf_storage_model;
22
23 /** \ingroup SURF_models
24  *  \brief The host model
25  *
26  *  Note that when you create an API on top of SURF, the host model should be the only one you use
27  *  because depending on the platform model, the network model and the CPU model may not exist.
28  */
29 XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
30
31
32 /*** SURF Globals **************************/
33
34 /** \ingroup SURF_simulation
35  *  \brief Initialize SURF
36  *  \param argc argument number
37  *  \param argv arguments
38  *
39  *  This function has to be called to initialize the common structures. Then you will have to create the environment by
40  *  calling  e.g. surf_host_model_init_CM02()
41  *
42  *  \see surf_host_model_init_CM02(), surf_host_model_init_compound(), surf_exit()
43  */
44 XBT_PUBLIC void surf_init(int* argc, char** argv); /* initialize common structures */
45
46 /** \ingroup SURF_simulation
47  *  \brief Finish simulation initialization
48  *
49  *  This function must be called before the first call to surf_solve()
50  */
51 XBT_PUBLIC void surf_presolve();
52
53 /** \ingroup SURF_simulation
54  *  \brief Performs a part of the simulation
55  *  \param max_date Maximum date to update the simulation to, or -1
56  *  \return the elapsed time, or -1.0 if no event could be executed
57  *
58  *  This function execute all possible events, update the action states  and returns the time elapsed.
59  *  When you call execute or communicate on a model, the corresponding actions are not executed immediately but only
60  *  when you call surf_solve.
61  *  Note that the returned elapsed time can be zero.
62  */
63 XBT_PUBLIC double surf_solve(double max_date);
64
65 /** \ingroup SURF_simulation
66  *  \brief Return the current time
67  *
68  *  Return the current time in millisecond.
69  */
70 XBT_PUBLIC double surf_get_clock();
71
72 /** \ingroup SURF_simulation
73  *  \brief Exit SURF
74  *
75  *  Clean everything.
76  *
77  *  \see surf_init()
78  */
79 XBT_PUBLIC void surf_exit();
80
81 /* surf parse file related (public because called from a test suite) */
82 XBT_PUBLIC void parse_platform_file(std::string file);
83
84 #endif