Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Documentation
[simgrid.git] / doc / doxygen / community_giveback.doc
1 /*! @page community_giveback Giving back to SimGrid
2
3 @tableofcontents
4
5 We are sometimes asked by users how to give back to the project. Here
6 are some ideas, but if you have new ones, feel free.
7
8 @section contributing_spread Spread the word
9
10 There is many ways to help the SimGrid project. The first and most
11 natural one is to <b>use it for your research, and say so</b>. Cite
12 the SimGrid framework in your paper and discuss of its advantages with
13 your colleagues to spread the word. When we ask for new fundings to
14 sustain the project, the amount of publications enabled by SimGrid is
15 always the first question that we get. The more you use the framework,
16 the better for us. 
17
18 We use several systems to detect the scientific publications citing
19 our work, so actually citing correctly the framework (see 
20 <a href="http://simgrid.gforge.inria.fr/Publications.html">here</a>)
21 should be enough to get us adding your paper to our list. But if you
22 remark that your paper is missing on 
23 <a href="http://simgrid.gforge.inria.fr/Usages.html">our 
24 page listing all papers using SimGrid</a>, please say so. Likewise, if
25 your paper is badly cited, please drop us an email so that we can fix
26 it.
27
28 Also, <b>help us constituting an active and welcoming user
29 community</b>. Get subscribed to the mailing lists, and answer the
30 questions that newcommers have if you can. Point them (gentely ;) to
31 the relevant part of the documentation on need, and help them becoming
32 part of our community too. 
33
34 Another easy way to help the project is to add a link to the
35 <a href="http://simgrid.gforge.inria.fr">SimGrid homepage</a>
36 on your homepage to <b>improve SimGrid's ranking in the search
37 engines</b>. Internet visibility is a battle where you can make the
38 difference. This can be done by adding the following html snipet to
39 your page, that simply renders as <a href="http://simgrid.gforge.inria.fr/">Simgrid</a>.
40
41 @verbatim
42 <a href="http://simgrid.gforge.inria.fr/" 
43    title="Versatile simulation of distributed systems: Grid Simulator, P2P simulator, MPI simulator, Cloud Simulator or HPC Simulator">
44    Simgrid</a>
45 @endverbatim
46
47 Or you can prefer this version with a little logo (if you want to
48 contribute another logo for that, please don't hesitate ;)
49 <img src="http://simgrid.gforge.inria.fr/logos/simgrid_logo.png"/>
50
51 @verbatim
52 <a href="http://simgrid.gforge.inria.fr/" 
53    title="Versatile simulation of distributed systems: Grid Simulator, P2P simulator, MPI simulator, Cloud Simulator or HPC Simulator">
54    <img src="http://simgrid.gforge.inria.fr/logos/simgrid_logo.png"
55         alt="Versatile simulation of distributed systems: Grid Simulator, P2P simulator, MPI simulator, Cloud Simulator or HPC Simulator" align="center"> 
56 </a>
57 @endverbatim
58
59 Finally, if you organize a scientific event where you expect many
60 potential users, <b>invite us to give a tutorial on SimGrid</b>. We
61 found that 45 minutes to one hour is sufficient. It allows to explain
62 the main motivations and outcomes of the project in order to motivate
63 the attendees get more information on SimGrid, and eventually improve
64 their scientific habits by using a sound simulation framework. 
65 <a href="http://webloria.loria.fr/~quinson/blog/2012/1120/Simgrid_at_Louvain/">Here</a>
66 is an example of such a presentation.
67
68 @section contributing_bugs Reporting (and fixing) any issue you find
69
70 Because of its size and complexity, SimGrid is not perfect and
71 contains a large amount of glitches and issues. When you find one,
72 don't assume that it's here because we don't care. It survived only
73 because nobody told us. We unfortunately cannot endlessly review our
74 large code and documentation base. So please, <b>report any issue you
75 find</b>, be it a typo in the documentation, a paragraph that
76 needs to be reworded, a bug in the code or any other problem. The best
77 way to do so is to open a bug on our 
78 <a href="https://gforge.inria.fr/tracker/?atid=165&group_id=12&func=browse">Bug
79 Tracking System</a> so that we don't forget about it (we have other
80 obligations too and are sometimes unable to fix bugs right away, no
81 matter how easy the fix it). The worst way to report such issue is to
82 go through private emails. These are unreliable, and we are trying to
83 develop SimGrid openly, so private discussions are to be avoided if
84 possible. 
85
86 If you can provide a patch fixing the issue you report, that's even
87 better, and often ensures that it will get fixed very soon.
88
89 Of course, a very good way to give back to the SimGrid community is to
90 <b>triage and fix the bugs in the BTS</b>. If you
91 can come up with a patch fixing them, we will be more than happy to
92 apply your changes so that the entier community enjoys them.
93
94 @section contributing_contrib Contributing features and associated tools
95
96 If you deeply miss a feature in the framework, you should consider
97 implementing it yourself. That's free software, meaning that you are
98 free to help yourself. Of course, we'll do our best to assist you in
99 this task, so don't hesitate to contact us with your idea.
100
101 If you develop an independent tool that is somehow associated to
102 SimGrid, we'd love helping you gaining visibility by listing it on our 
103 <a href="http://simgrid.gforge.inria.fr/contrib.html">Contrib
104 section</a>. 
105
106 @section contributing_todo Enchancements
107
108 If you want to want to start working on the SimGrid codebase, here are a few
109 ideas of things that could be done to improved the current code (not all of them
110 are easy, though):
111
112 @subsection contributing_todo_cxxification Migration to C++
113
114 The code is being migrated to C++ but a large part is still C (or C++ with
115 C idioms). It would be valuable to replace C idioms with C++ ones:
116
117  - replace XBT structures and C dynamic arrays with C++ containers;
118
119  - replace `char*` strings with `std::string`;
120
121  - use exception-safe RAII (`std::unique_ptr`, etc.) instead of explicit
122    `malloc/free` or `new/delete`;
123
124  - use `std::function` (or template functionoid arguments) instead of function
125    pointers;
126
127 @subsubsection contributing_todo_exceptions Exceptions
128
129 SimGrid used to implement exceptions in C. This has been replaced with C++
130 exceptions but some bits of the C exceptions are still remaining:
131
132  - `xbt_ex` was the type of C exceptions. It is now a standard C++ exception.
133     We might want to remove this exception and use a more idiomatic C++
134     solution with dedicated exception classes for different errors.
135     `std::system_error` might be used as well by replacing some `xbt_errcat_t`
136     with custom subclasses of `std::error_category`.
137
138  - The C API currently throws exceptions. Throwing exceptions out of a C API is
139    not very friendly. C code does not expect them, cannot catch them and cannot
140    handle resource management properly in face of exceptions. We should clearly
141    separate the C++ API and the C API and catch all exceptions before they get
142    ouf of C APIs.
143
144 @subsubsection contributing_todo_time Time and duration
145
146 Some support for C++11-style time/duration is implemented (see `chrono.hpp`)
147 but only available in some (S4U) APIs. It would be nice to add support for
148 them in the rest of the C++ code.
149
150 @subsubsection contributing_todo_futures Futures
151
152  - Some features are missing in the Maestro future implementation
153   (`simgrid::kernel::Future`, `simgrid::kernel::Promise`)
154   could be extended to support additional features:
155   `when_any`, `shared_future`, etc.
156
157  - The corresponding feature might then be implemented in the user process
158    futures (`simgrid::simix::Future`).
159
160  - Currently `.then()` is not available for user futures. We would need to add
161    a basic user event loop in order to queue the pending continuations.
162
163  - We might need to provide the option to cancel a pending operation. This
164    might be achieved by defining some `Action` or `Operation` class with an
165    API compatible with `Future` (and convertiable to it) but with an
166    additional `.cancel()` method.
167
168 @subsection contributing_todo_smpi SMPI
169
170 @subsubsection contributing_smpi_split_process Process-based privatization
171
172 Currently, all the simulated processes live in the same process as the SimGrid
173 simulator. The benefit is that we don't have to do context switches and IPC
174 between the simulator and the processes.
175
176 The fact that they share the same address space means that one memory corruption
177 in one simulated process can propagate to the other ones and the SimGrid
178 simulator itself.
179
180 Moreover, the current design for SMPI applications is to compile the MPI code
181 normally and execute it once per simulated process in the same system process:
182 This means that all the existing simulated MPI processes share the same virtual
183 address space and share by default sthe same global variables. This is not
184 correct as each MPI process is expected to use its own address space and have
185 its own global variables. In order to fix, this problem we have an optional
186 SMPI privatization feature which creates a instanciation of the executable
187 data segment per MPI process and map the correct one (using `mmap`) at each
188 context switch.
189
190 This approach has many problems:
191
192  1. It is not completely safe. We only handle SMPI privatization for the global
193     variables in the execute data segment. Shared objects are ignored but some
194     may contain global variables which may need to be privatized:
195
196     - libsimgrid for example must not be privatized because it contains
197       shared state for the simulator;
198
199     - libc must not be privatized for the same reason (but some global variables
200       in the libc may not be privatized);
201
202     - if we use global variables of some shared object in the executable, this
203       global variable will be instanciated in the executable (because of copy
204       relocation) and will be privatized even if it shoud not.
205
206  2. We cannot execute the MPI processes in parallel. Only one can execute at
207     the same time because only one privatization segment can be mapped at a
208     given time.
209
210 In order to fix this, the standard solution is to move each MPI process in its
211 system process and use IPC to communicate with the simulator. One concern would
212 be the impact on performance and memory consumption:
213
214  - It would introduce a lot of context switches and IPC communications between
215    the MPI processes and the SimGrid simulator. However, currently every context
216    switch needs a `mmap` for SMPI privatization which is costly as well
217    (TLB flush).
218
219  - Instanciating a lot of processes might consume more memory which might be a
220    problem if we want to simulate a lot of MPI processes. Compiling MPI programs
221    as static executables with a lightweight libc might help and we might want to
222    support that. The SMPI processes should probably not embed all the SimGrid
223    simulator and its dependencies, the C++ runtime, etc.
224
225 We would need to modify the model-checker as well which currently can only
226 manage on model-checked process. For the model-checker we can expect some
227 benefits from this approach: if a process did not execute, we know its state
228 did not change and we don't need to take its snapshot and compare its state.
229
230 Other solutions for this might include:
231
232  - Mapping each MPI process in the process of the simulator but in a different
233    symbol namespace (see `dlmopen`). Each process would have its own separate
234    instanciation and would not share libraries.
235
236  - Instanciate each MPI process in a separate lightweight VM (for example based
237    on WebAssembly) in the simualtor process.
238
239 @subsection contributing_todo_mc Model-checker
240
241 @subsubsection contributing_todo_mc_state_compare Overhaul the state comparison code
242
243 The state comparison code is quite complicated. It has very long functions and
244 is programmed mostly using C idioms and is difficult to understanda and debug.
245 It is in need or an overhaul:
246
247   - cleanup, refactorisation, usage of C++ features.
248
249   - The state comparison code works by infering types of blocks allocated on the
250     heap by following pointers from known roots (global variables, local
251     variables). Usually the first type found for a given block is used even if
252     a better one could be found later. By using a first pass of type inference,
253     on each snapshot before comparing the states, we might use a better type
254     information on the different blocks.
255
256   - We might benefit from adding logic for handling some known types. For
257     example, both `std::string` and `std::vector` have a capacity which might
258     be larger than the current size of the container. We should might ignore
259     the corresponding elements when comparing the states and infering the types.
260
261   - Another difficulty in the state comparison code is the detection of
262     dangling pointers. We cannot easily know if a pointer is dangling and
263     dangling pointers might lead us to choose the wrong type when infering
264     heap blocks. We might mitigate this problem by delaying the reallocation of
265     a freed block until there is no blocks pointing to it anymore using some
266     sort of basic garbage-collector.
267
268 @subsubsection contributing_todo_mc_separation Separate the model-checker code from libsimgrid
269
270 @subsubsection contributing_todo_mc_mced_interface Interface with the model-checked processes
271
272 The model-checker reads many informations about the model-checked process
273 by `process_vm_readv()`-ing brutally the data structure of the model-checked
274 process leading to some horrible code such as walking a swag from another
275 process. It prevents us as well from replacing some XBT data structures with
276 standard C++ ones. We need a sane way to expose the relevant informations to
277 the model-checker.
278
279 @subsubsection contributing_todo_mc_generic_simcalls Generic simcalls
280
281 We have introduced some generic simcalls which can be used to execute a
282 callback in SimGrid Maestro context. It makes it a lot easier to interface
283 the simulated process with the maestro. However, the callbacks for the
284 model-checker which cannot decide how it should handle them. We would need a
285 solution for this if we want to be able to replace the simcalls the
286 model-checker cares about by generic simcalls.
287
288 @subsubsection contributing_todo_mc_api Definig an API for writing Model-Checking algorithms
289
290 Currently, writing a new model-checking algorithms in SimGridMC is quite
291 difficult: the logic of the model-checking algorithm is mixed with a lot of
292 low-level concerns about the way the model-checker is implemented. This makes it
293 difficult to write new algorithms and difficult to understand, debug and modify
294 the existing ones. We need a clean API to express the model-checking algorithms
295 in a form which is closer to the text-book/paper description. This API muste
296 be exposed in a a language which is more adequate to this task.
297
298 Tasks:
299
300   1. Design and implement a clean API for expression model-checking algorithms.
301      A `Session` class currently exists for this but is not feature complete
302      and should probably be rewritten. It should be easy to create bindings
303      for different languages on top of this API.
304
305   2. Create a binding to some better suited, dynamic, scripting language
306      (eg. Lua).
307
308   3. Rewrite the existing model-checking algorithms in this language using the
309      new API.
310
311 */