Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
split SMPI documentation into a specific file (no real change)
[simgrid.git] / doc / doxygen / module-smpi.doc
1 /** @addtogroup SMPI_API
2
3 This programming environment permits to study existing MPI application
4 by emulating them on top of the SimGrid simulator. In other words, it
5 will constitute an emulation solution for parallel codes. You don't
6 even have to modify your code for that, although that may help, as
7 detailed below.
8
9 \section SMPI_who Who should use SMPI (and who shouldn't)
10
11 You should use this programming environment of the SimGrid suite if
12 you want to study existing MPI applications.  If you want to study
13 some heuristics for a given problem (and if your goal is to produce
14 theorems and publications, not code), have a look at the \ref MSG_API
15 environment, or the \ref SD_API one if you need to use DAGs. If none
16 of those programming environments fits your needs, you may consider
17 implementing your own directly on top of \ref SURF_API (but you
18 probably want to contact us before).
19
20 \section SMPI_what What can run within SMPI?
21
22 You can run unmodified MPI applications (both C and Fortran) within
23 SMPI, provided you only use MPI calls that we implemented in MPI. Our
24 coverage of the interface is not bad, but will probably never be
25 complete. One sided communications and I/O primitives are not targeted
26 for now. The full list of not yet implemented functions is available
27 in file <tt>include/smpi/smpi.h</tt> of the archive, between two lines
28 containing the <tt>FIXME</tt> marker. If you really need a missing
29 feature, please get in touch with us: we can guide you though the
30 SimGrid code to help you implementing it, and we'd glad to integrate
31 it in the main project afterward if you contribute them back.
32
33 \section SMPI_adapting Adapting your MPI code to the use of SMPI
34
35 As detailed in the reference article (available at
36 http://hal.inria.fr/inria-00527150), you may want to adapt your code
37 to improve the simulation performance. But these tricks may seriously
38 hinder the result qualtity (or even prevent the app to run) if used
39 wrongly. We assume that if you want to simulate an HPC application,
40 you know what you are doing. Don't prove us wrong!
41
42 If you get short on memory (the whole app is executed on a single node
43 when simulated), you should have a look at the SMPI_SHARED_MALLOC and
44 SMPI_SHARED_FREE macros. It allows to share memory areas between
45 processes. For example, matrix multiplication code may want to store
46 the blocks on the same area. Of course, the resulting computations
47 will useless, but you can still study the application behavior this
48 way. Of course, if your code is data-dependent, this won't work.
49
50 If your application is too slow, try using SMPI_SAMPLE_LOCAL,
51 SMPI_SAMPLE_GLOBAL and friends to indicate which computation loops can
52 be sampled. Some of the loop iterations will be executed to measure
53 their duration, and this duration will be used for the subsequent
54 iterations. These samples are done per processor with
55 SMPI_SAMPLE_LOCAL, and shared between all processors with
56 SMPI_SAMPLE_GLOBAL. Of course, none of this will work if the execution
57 time of your loop iteration are not stable.
58
59 Yes, that's right, these macros are not documented yet, but we'll fix
60 it as soon as time permits. Sorry about that -- patch welcomed!
61 Meanwhile, grep for them on the examples for more information.
62
63 \section SMPI_compiling Compiling your code
64
65 This is very simply done with the <tt>smpicc</tt> script. If you
66 already compiled any MPI code before, you already know how to use it.
67 If not, you should try to get your MPI code running on top of MPI
68 before giving SMPI a spin. Actually, that's very simple even if it's
69 the first time you use MPI code: just use smpicc as a compiler (in
70 replacement of gcc or your usual compiler), and you're set.
71
72 \section SMPI_executing Executing your code on top of the simulator
73
74 This is done though the <tt>smpirun</tt> script as follows.
75 <tt>my_hostfile.txt</tt> is a classical MPI hostfile (that is, this
76 file lists the machines on which the processes must be dispatched, one
77 per line)  <tt>my_platform.xml</tt> is a classical SimGrid platform
78 file. Of course, the hosts of the hostfile must exist in the provided
79 platform. <tt>./program</tt> is the MPI program that you want to
80 simulate (must be compiled by <tt>smpicc</tt>) while <tt>-arg</tt> is
81 a command-line parameter passed to this program.
82
83 \verbatim
84 smpirun -hostfile my_hostfile.txt -platform my_platform.xml ./program -arg
85 \endverbatim
86
87 smpirun accepts other parameters, such as <tt>-np</tt> if you don't
88 want to use all the hosts defined in the hostfile, <tt>-map</tt> to
89 display on which host each rank gets mapped of <tt>-trace</tt> to
90 activate the tracing during the simulation. You can get the full list
91 by running
92 \verbatim
93 smpirun -help
94 \endverbatim
95
96 */