Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
9d1f81aeed23a0a59cdd2312fa65d2beab87df56
[simgrid.git] / doc / options.doc
1 /*! \page options Simgrid options and configurations
2
3 \htmlinclude .options.doc.toc
4
5 A number of options can be given at runtime to change the default
6 SimGrid behavior. For a complete list of all configuration options
7 accepted by the SimGrid version used in your simulator, simply pass
8 the --help configuration flag to your program. If some of the options
9 are not documented on this page, this is a bug that you should please
10 report so that we can fix it.
11
12 \section options_using Passing configuration options to the simulators
13
14 There is several way to pass configuration options to the simulators.
15 The most common way is to use the \c --cfg command line argument. For
16 example, to set the item \c Item to the value \c Value, simply
17 type the following: \verbatim
18 my_simulator --cfg=Item:Value (other arguments)
19 \endverbatim
20
21 Several \c --cfg command line arguments can naturally be used. If you
22 need to include spaces in the argument, don't forget to quote the
23 argument. You can even escape the included quotes (write \' for ' if
24 you have your argument between ').
25
26 Another solution is to use the \c \<config\> tag in the platform file. The
27 only restriction is that this tag must occure before the first
28 platform element (be it \c \<AS\>, \c \<cluster\>, \c \<peer\> or whatever).
29 The \c \<config\> tag takes an \c id attribute, but it is currently
30 ignored so you don't really need to pass it. The important par is that
31 within that tag, you can pass one or several \c \<prop\> tags to specify
32 the configuration to use. For example, setting \c Item to \c Value
33 can be done by adding the following to the beginning of your platform
34 file: \verbatim
35 <config>
36   <prop id="Item" value="Value"/>
37 </config>
38 \endverbatim
39
40 A last solution is to pass your configuration directly using the C
41 interface. Unfortunately, this path is not really easy to use right
42 now, and you mess directly with surf internal variables as follows. Check the
43 \ref XBT_config "relevant page" for details on all the functions you
44 can use in this context, \c _surf_cfg_set being the only configuration set
45 currently used in SimGrid. \code
46 #include <xbt/config.h>
47
48 extern xbt_cfg_t _surf_cfg_set;
49
50 int main(int argc, char *argv[]) {
51      MSG_global_init(&argc, argv);
52      
53      xbt_cfg_set_parse(_surf_cfg_set,"Item:Value");
54      
55      // Rest of your code
56 }
57 \endcode
58
59 \section options_model Configuring the platform models
60
61 \subsection options_model_select Selecting the platform models
62
63 SimGrid comes with several network and CPU models built in, and you
64 can change the used model at runtime by changing the passed
65 configuration. The three main configuration items are given below.
66 For each of these items, passing the special \c help value gives
67 you a short description of all possible values. Also, \c --help-models
68 should provide information about all models for all existing resources. 
69    - \b network/model: specify the used network model
70    - \b cpu/model: specify the used CPU model
71    - \b workstation/model: specify the used workstation model
72
73 As of writting, the accepted network models are the following. Over
74 the time new models can be added, and some experimental models can be
75 removed; check the values on your simulators for an uptodate
76 information. Note that the CM02 model is described in the research report
77 <a href="ftp://ftp.ens-lyon.fr/pub/LIP/Rapports/RR/RR2002/RR2002-40.ps.gz">A
78 Network Model for Simulation of Grid Application</a> while LV08 is
79 described in 
80 <a href="http://mescal.imag.fr/membres/arnaud.legrand/articles/simutools09.pdf">Accuracy Study and Improvement of Network Simulation in the SimGrid Framework</a>.
81
82   - \b LV08 (default one): Realistic network analytic model
83     (slow-start modeled by multiplying latency by 10.4, bandwidth by
84     .92; bottleneck sharing uses a payload of S=8775 for evaluating RTT)
85   - \b Constant: Simplistic network model where all communication
86     take a constant time (one second). This model provides the lowest
87     realism, but is (marginally) faster.
88   - \b SMPI: Realistic network model specifically tailored for HPC
89     settings (accurate modeling of slow start with correction factors on
90     three intervals: < 1KiB, < 64 KiB, >= 64 KiB). See also \ref
91     options_model_network_coefs "this section" for more info.
92   - \b CM02: Legacy network analytic model (Very similar to LV08, but
93     without corrective factors. The timings of small messages are thus
94     poorly modeled)
95   - \b Reno: Model from Steven H. Low using lagrange_solve instead of
96     lmm_solve (experts only; check the code for more info).
97   - \b Reno2: Model from Steven H. Low using lagrange_solve instead of
98     lmm_solve (experts only; check the code for more info).
99   - \b Vegas: Model from Steven H. Low using lagrange_solve instead of
100     lmm_solve (experts only; check the code for more info).
101
102 If you compiled SimGrid accordingly, you can use packet-level network
103 simulators as network models (see \ref pls). In that case, you have
104 two extra models, described below, and some \ref options_pls "specific
105 additional configuration flags".
106   - \b GTNets: Network pseudo-model using the GTNets simulator instead
107     of an analytic model 
108   - \b NS3: Network pseudo-model using the NS3 tcp model instead of an
109     analytic model      
110
111 Concerning the CPU, we have only one model for now:
112   - \b Cas01: Simplistic CPU model (time=size/power)
113   
114 The workstation concept is the aggregation of a CPU with a network
115 card. Three models exists, but actually, only 2 of them are
116 interesting. The "compound" one is simply due to the way our internal
117 code is organized, and can easily be ignored. So at the end, you have
118 two workstation models: The default one allows to aggregate an
119 existing CPU model with an existing network model, but does not allow
120 parallel tasks because these beasts need some collaboration between
121 the network and CPU model. That is why, ptask_07 is used by default
122 when using SimDag.
123   - \b default: Default workstation model. Currently, CPU:Cas01 and 
124     network:LV08 (with cross traffic enabled)
125   - \b compound: Workstation model that is automatically chosen if
126     you change the network and CPU models
127   - \b ptask_L07: Workstation model somehow similar to Cas01+CM02 but
128     allowing parallel tasks
129   
130 \subsection options_model_optim Optimization level of the platform models
131
132 The network and CPU models that are based on lmm_solve (that
133 is, all our analytical models) accept specific optimization
134 configurations.
135   - items \b network/optim and \b CPU/optim (both default to 'Lazy'):
136     - \b Lazy: Lazy action management (partial invalidation in lmm +
137       heap in action remaining).
138     - \b TI: Trace integration. Highly optimized mode when using
139       availability traces (only available for the Cas01 CPU model for
140       now). 
141     - \b Full: Full update of remaining and variables. Slow but may be
142       useful when debugging.
143   - items \b network/maxmin_selective_update and
144     \b cpu/maxmin_selective_update: configure whether the underlying
145     should be lazily updated or not. It should have no impact on the
146     computed timings, but should speed up the computation. 
147     
148 It is still possible to disable the \c maxmin_selective_update feature
149 because it can reveal counter-productive in very specific scenarios
150 where the interaction level is high. In particular, if all your
151 communication share a given backbone link, you should disable it:
152 without \c maxmin_selective_update, every communications are updated
153 at each step through a simple loop over them. With that feature
154 enabled, every communications will still get updated in this case
155 (because of the dependency induced by the backbone), but through a
156 complicated pattern aiming at following the actual dependencies.
157
158 \subsection options_model_precision Numerical precision of the platform models
159
160 The analytical models handle a lot of floating point values. It is
161 possible to change the epsilon used to update and compare them through
162 the \b maxmin/precision item (default value: 1e-9). Changing it
163 may speedup the simulation by discarding very small actions, at the
164 price of a reduced numerical precision.
165
166 \subsection options_model_nthreads Parallel threads for model updates
167
168 By default, Surf computes the analytical models sequentially to share their
169 resources and update their actions. It is possible to run them in parallel,
170 using the \b surf/nthreads item (default value: 1).
171 Depending on the workload of the models and their complexity, you may get a
172 speedup or a slowdown because of the synchronization costs of threads.
173
174 \subsection options_model_network Configuring the Network model
175
176 \subsubsection options_model_network_gamma Maximal TCP window size
177
178 The analytical models need to know the maximal TCP window size to take
179 the TCP congestion mechanism into account. This is set to 20000 by
180 default, but can be changed using the \b network/TCP_gamma item.
181
182 On linux, this value can be retrieved using the following
183 commands. Both give a set of values, and you should use the last one,
184 which is the maximal size.\verbatim
185 cat /proc/sys/net/ipv4/tcp_rmem # gives the sender window
186 cat /proc/sys/net/ipv4/tcp_wmem # gives the receiver window
187 \endverbatim
188
189 \subsubsection options_model_network_coefs Corrective simulation factors 
190
191 These factors allow to betterly take the slow start into account.
192 The corresponding values were computed through data fitting one the
193 timings of packet-level simulators. You should not change these values
194 unless you are really certain of what you are doing. See 
195 <a href="http://mescal.imag.fr/membres/arnaud.legrand/articles/simutools09.pdf">Accuracy Study and Improvement of Network Simulation in the SimGrid Framework</a>
196 for more informations about these coeficients.
197
198 If you are using the SMPI model, these correction coeficients are
199 themselves corrected by constant values depending on the size of the
200 exchange. Again, only hardcore experts should bother about this fact.
201
202 \subsubsection options_model_network_crosstraffic Simulating cross-traffic
203
204 As of SimGrid v3.7, cross-traffic effects can be taken into account in
205 analytical simulations. It means that ongoing and incoming
206 communication flows are treated independently. In addition, the LV08
207 model adds 0.05 of usage on the opposite direction for each new
208 created flow. This can be useful to simulate some important TCP
209 phenomena such as ack compression.
210
211 For that to work, your platform must have two links for each
212 pair of interconnected hosts. An example of usable platform is
213 available in <tt>examples/msg/gtnets/crosstraffic-p.xml</tt>.
214
215 This is activated through the \b network/crosstraffic item, that
216 can be set to 0 (disable this feature) or 1 (enable it). 
217
218 Note that with the default workstation model this option is activated by default.
219
220 \subsubsection options_model_network_coord Coordinated-based network models
221
222 When you want to use network coordinates, as it happens when you use
223 an \<AS\> in your platform file with \c Vivaldi as a routing, you must
224 set the \b network/coordinates to \c yes so that all mandatory
225 initialization are done in the simulator.
226
227 \subsubsection options_model_network_sendergap Simulating sender gap
228
229 (this configuration item is experimental and may change or disapear)
230
231 It is possible to specify a timing gap between consecutive emission on
232 the same network card through the \b network/sender_gap item. This
233 is still under investigation as of writting, and the default value is
234 to wait 0 seconds between emissions (no gap applied).
235
236 \subsubsection options_pls Configuring packet-level pseudo-models
237
238 When using the packet-level pseudo-models, several specific
239 configuration flags are provided to configure the associated tools.
240 There is by far not enough such SimGrid flags to cover every aspects
241 of the associated tools, since we only added the items that we
242 needed ourselves. Feel free to request more items (or even better:
243 provide patches adding more items).
244
245 When using NS3, the only existing item is \b ns3/TcpModel,
246 corresponding to the ns3::TcpL4Protocol::SocketType configuration item
247 in NS3. The only valid values (enforced on the SimGrid side) are
248 'NewReno' or 'Reno' or 'Tahoe'.
249
250 When using GTNeTS, two items exist: 
251  - \b gtnets/jitter, that is a double value to oscillate
252    the link latency, uniformly in random interval
253    [-latency*gtnets_jitter,latency*gtnets_jitter). It defaults to 0.
254  - \b gtnets/jitter_seed, the positive seed used to reproduce jitted
255    results. Its value must be in [1,1e8] and defaults to 10.
256
257 \section options_modelchecking Configuring the Model-Checking
258
259 To enable the experimental SimGrid model-checking support the program should
260 be executed with the command line argument 
261 \verbatim
262 --cfg=model-check:1 
263 \endverbatim
264 Properties are expressed as assertions using the function
265 \verbatim
266 void MC_assert(int prop);
267 \endverbatim
268
269 \section options_virt Configuring the User Process Virtualization
270
271 \subsection options_virt_factory Selecting the virtualization factory
272
273 In SimGrid, the user code is virtualized in a specific mecanism
274 allowing the simulation kernel to control its execution: when a user
275 process requires a blocking action (such as sending a message), it is
276 interrupted, and only gets released when the simulated clock reaches
277 the point where the blocking operation is done.
278
279 In SimGrid, the containers in which user processes are virtualized are
280 called contexts. Several context factory are provided, and you can
281 select the one you want to use with the \b contexts/factory
282 configuration item. Some of the following may not exist on your
283 machine because of portability issues. In any case, the default one
284 should be the most effcient one (please report bugs if the
285 auto-detection fails for you). They are sorted here from the slowest
286 to the most effient:
287  - \b thread: very slow factory using full featured threads (either
288    ptheads or windows native threads) 
289  - \b ucontext: fast factory using System V contexts (or a portability
290    layer of our own on top of Windows fibers)
291  - \b raw: amazingly fast factory using a context switching mecanism
292    of our own, directly implemented in assembly (only available for x86 
293    and amd64 platforms for now)
294
295 The only reason to change this setting is when the debuging tools get
296 fooled by the optimized context factories. Threads are the most
297 debugging-friendly contextes.
298
299 \subsection options_virt_stacksize Adapting the used stack size
300
301 (this only works if you use ucontexts or raw context factories)
302
303 Each virtualized used process is executed using a specific system
304 stack. The size of this stack has a huge impact on the simulation
305 scalability, but its default value is rather large. This is because
306 the error messages that you get when the stack size is too small are
307 rather disturbing: this leads to stack overflow (overwriting other
308 stacks), leading to segfaults with corrupted stack traces.
309
310 If you want to push the scalability limits of your code, you really
311 want to reduce the \b contexts/stack_size item. Its default value
312 is 128 (in Kib), while our Chord simulation works with stacks as small
313 as 16 Kib, for example.
314
315 \subsection options_virt_parallel Running user code in parallel
316
317 Parallel execution of the user code is only considered stable in
318 SimGrid v3.7 and higher. It is described in 
319 <a href="http://hal.inria.fr/inria-00602216/">INRIA RR-7653</a>.
320
321 If you are using the \c ucontext or \c raw context factories, you can
322 request to execute the user code in parallel. Several threads are
323 launched, each of them handling as much user contexts at each run. To
324 actiave this, set the \b contexts/nthreads item to the amount of
325 core that you have in your computer.
326
327 Even if you asked several worker threads using the previous option,
328 you can request to start the parallel execution (and pay the
329 associated synchronization costs) only if the potential parallelism is
330 large enough. For that, set the \b contexts/parallel_threshold
331 item to the minimal amount of user contexts needed to start the
332 parallel execution. In any given simulation round, if that amount is
333 not reached, the contexts will be run sequentially directly by the
334 main thread (thus saving the synchronization costs). Note that this
335 option is mainly useful when the grain of the user code is very fine,
336 because our synchronization is now very efficient.
337
338 When parallel execution is activated, you can choose the
339 synchronization schema used with the \b contexts/synchro item,
340 which value is either:
341  - \b futex: ultra optimized synchronisation schema, based on futexes
342    (fast user-mode mutexes), and thus only available on Linux systems.
343    This is the default mode when available.
344  - \b posix: slow but portable synchronisation using only POSIX
345    primitives.
346  - \b busy_wait: not really a synchronisation: the worker threads
347    constantly request new contexts to execute. It should be the most
348    efficient synchronisation schema, but it loads all the cores of your 
349    machine for no good reason. You probably prefer the other less
350    eager schemas.
351
352 \section options_tracing Configuring the tracing subsystem
353
354 The \ref tracing "tracing subsystem" can be configured in several
355 different ways depending on the nature of the simulator (MSG, SimDag,
356 SMPI) and the kind of traces that need to be obtained. See the \ref
357 tracing_tracing_options "Tracing Configuration Options subsection" to
358 get a detailed description of each configuration option.
359
360 We detail here a simple way to get the traces working for you, even if
361 you never used the tracing API.
362
363
364 - Any SimGrid-based simulator (MSG, SimDag, SMPI, ...) and raw traces:
365 \verbatim
366 --cfg=tracing:1 --cfg=tracing/uncategorized:1 --cfg=triva/uncategorized:uncat.plist
367 \endverbatim
368     The first parameter activates the tracing subsystem, the second
369     tells it to trace host and link utilization (without any
370     categorization) and the third creates a graph configuration file
371     to configure Triva when analysing the resulting trace file.
372
373 - MSG or SimDag-based simulator and categorized traces (you need to declare categories and classify your tasks according to them)
374 \verbatim
375 --cfg=tracing:1 --cfg=tracing/categorized:1 --cfg=triva/categorized:cat.plist
376 \endverbatim
377     The first parameter activates the tracing subsystem, the second
378     tells it to trace host and link categorized utilization and the
379     third creates a graph configuration file to configure Triva when
380     analysing the resulting trace file.
381
382 - SMPI simulator and traces for a space/time view:
383 \verbatim
384 smpirun -trace ...
385 \endverbatim
386     The <i>-trace</i> parameter for the smpirun script runs the
387 simulation with --cfg=tracing:1 and --cfg=tracing/smpi:1. Check the
388 smpirun's <i>-help</i> parameter for additional tracing options.
389
390 \section options_smpi Configuring SMPI
391
392 The SMPI interface provides several specific configuration items.
393 These are uneasy to see since the code is usually launched through the
394 \c smiprun script directly.
395
396 \subsection options_smpi_bench Automatic benchmarking of SMPI code
397
398 In SMPI, the sequential code is automatically benchmarked, and these
399 computations are automatically reported to the simulator. That is to
400 say that if you have a large computation between a \c MPI_Recv() and a
401 \c MPI_Send(), SMPI will automatically benchmark the duration of this
402 code, and create an execution task within the simulator to take this
403 into account. For that, the actual duration is measured on the host
404 machine and then scaled to the power of the corresponding simulated
405 machine. The variable \b smpi/running_power allows to specify the
406 computational power of the host machine (in flop/s) to use when
407 scaling the execution times. It defaults to 20000, but you really want
408 to update it to get accurate simulation results.
409
410 When the code is constituted of numerous consecutive MPI calls, the
411 previous mechanism feeds the simulation kernel with numerous tiny
412 computations. The \b smpi/cpu_threshold item becomes handy when this
413 impacts badly the simulation performance. It specify a threshold (in
414 second) under which the execution chunks are not reported to the
415 simulation kernel (default value: 1e-6). Please note that in some
416 circonstances, this optimization can hinder the simulation accuracy. 
417
418 \subsection options_smpi_timing Reporting simulation time
419
420 Most of the time, you run MPI code through SMPI to compute the time it
421 would take to run it on a platform that you don't have. But since the
422 code is run through the \c smpirun script, you don't have any control
423 on the launcher code, making difficult to report the simulated time
424 when the simulation ends. If you set the \b smpi/display_timing item
425 to 1, \c smpirun will display this information when the simulation ends. \verbatim
426 Simulation time: 1e3 seconds.
427 \endverbatim
428
429 \section options_generic Configuring other aspects of SimGrid
430
431 \subsection options_generic_path XML file inclusion path
432
433 It is possible to specify a list of directories to search into for the
434 \<include\> tag in XML files by using the \b path configuration
435 item. To add several directory to the path, set the configuration
436 item several times, as in \verbatim
437 --cfg=path:toto --cfg=path:tutu
438 \endverbatim
439
440 \subsection options_generic_exit Behavior on Ctrl-C
441
442 By default, when Ctrl-C is pressed, the status of all existing
443 simulated processes is displayed. This is very useful to debug your
444 code, but it can reveal troublesome in some cases (such as when the 
445 amount of processes becomes really big). This behavior is disabled
446 when \b verbose-exit is set to 0 (it is to 1 by default).
447
448 \section options_index Index of all existing configuration items
449
450 - \c contexts/factory: \ref options_virt_factory
451 - \c contexts/nthreads: \ref options_virt_parallel
452 - \c contexts/parallel_threshold: \ref options_virt_parallel
453 - \c contexts/stack_size: \ref options_virt_stacksize
454 - \c contexts/synchro: \ref options_virt_parallel
455
456 - \c cpu/maxmin_selective_update: \ref options_model_optim
457 - \c cpu/model: \ref options_model_select
458 - \c cpu/optim: \ref options_model_optim
459
460 - \c gtnets/jitter: \ref options_pls
461 - \c gtnets/jitter_seed: \ref options_pls
462
463 - \c maxmin/precision: \ref options_model_precision
464
465 - \c network/bandwidth_factor: \ref options_model_network_coefs
466 - \c network/coordinates: \ref options_model_network_coord
467 - \c network/crosstraffic: \ref options_model_network_crosstraffic 
468 - \c network/latency_factor: \ref options_model_network_coefs
469 - \c network/maxmin_selective_update: \ref options_model_optim
470 - \c network/model: \ref options_model_select
471 - \c network/optim: \ref options_model_optim
472 - \c network/sender_gap: \ref options_model_network_sendergap
473 - \c network/TCP_gamma: \ref options_model_network_gamma
474 - \c network/weight_S: \ref options_model_network_coefs
475
476 - \c ns3/TcpModel: \ref options_pls
477
478 - \c surf/nthreads: \ref options_model_nthreads
479
480 - \c smpi/running_power: \ref options_smpi_bench
481 - \c smpi/display_timing: \ref options_smpi_timing
482 - \c smpi/cpu_threshold: \ref options_smpi_bench
483
484 - \c path: \ref options_generic_path
485 - \c verbose-exit: \ref options_generic_exit
486
487 - \c workstation/model: \ref options_model_select
488
489 */