Repository navigation
Expand file tree
/
Copy pathREADME.ampi
More file actions
131 lines (100 loc) · 5.84 KB
/
Copy pathREADME.ampi
File metadata and controls
131 lines (100 loc) · 5.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Adaptive MPI (AMPI)
-------------------
AMPI is an implementation of the MPI standard written on top of Charm++, meant
to give MPI applications access to high-level, application-independent features
such as overdecomposition (processor virtualization), dynamic load balancing,
automatic fault tolerance, and overlap of computation and communication. For
more information on all topics related to AMPI, consult the AMPI manual here:
https://charm.readthedocs.io/en/latest/ampi/manual.html
Building AMPI
-------------
AMPI has its own target in the build system. Give the build script the
target, the version, and any other options. For example:
./build AMPI reconverse-linux-x86_64 --with-production -j8
The Fortran wrappers (ampif77, ampif90) are built when CMake finds a
Fortran compiler; a compiler word such as "gfortran" selects one, and
"--disable-fortran" leaves them out.
Compiling and Linking AMPI Programs
-----------------------------------
AMPI source files can be compiled and linked with the wrappers found
in bin/, such as ampicc, ampicxx, ampif77, and ampif90:
ampif90 pgm.f90 -o pgm
For consistency with other MPI implementations, these wrappers are also
provided using their standard names with the suffix ".ampi".
Additionally, the "bin/ampi" subdirectory contains the wrappers with
their standard names, for simplicity of overriding the default system MPI
via the $PATH environment variable.
Running AMPI Programs
---------------------
An AMPI program is an ordinary executable, like any other Charm++
program. The number of PEs is given with "+pe N", the total across all
processes, and the number of AMPI ranks (virtual processors, VPs) with
"+vp R". For example, to run an AMPI program 'pgm' with 32 ranks on 4 PEs
in one process, do:
./pgm +pe 4 +vp 32
To run with dynamic load balancing, add "+balancer <LB>":
./pgm +pe 4 +vp 32 +balancer RefineLB
To run several processes on one machine, use LCI's lcrun launcher, which
the build puts in bin/:
lcrun -n 2 ./pgm +pe 4 +vp 32
The ampirun script, copied next to the program by ampicc, takes
MPI-style options. "ampirun -np R ./pgm" runs R ranks as one process
with one PE per rank, and "--procs P" runs P processes through lcrun:
./ampirun -np 16 --procs 4 ./pgm # runs lcrun -n 4 ./pgm +pe 16
Under a batch system, use the site launcher (srun, mpirun) and give the
program its total number of PEs with "+pe".
A rank that migrates to another process, or is restored from a
checkpoint by a new process, needs the program loaded at the same address
in every process, so address space randomization must be off. On Linux,
ampirun runs the program under "setarch $(uname -m) -R" to do this; with
a site launcher, put the prefix inside the launch:
srun -n 4 setarch $(uname -m) -R ./pgm +pe 16 +vp 64
macOS has no setarch, so there ranks migrate only between the PEs of
one process. The AMPI manual has the details.
Porting to AMPI
---------------
Global and static variables are unsafe for use in virtualized AMPI programs.
This is because globals are defined at the process level, and AMPI ranks are
implemented as user-level threads, which may share a process with other ranks
Therefore, to run with more than 1 VP per processor, all globals and statics
that are non-readonly and whose value does not depend on rank must be modified
to use local storage. Consult the AMPI manual for more information on global
variable privatization and automated approaches to privatization. Of the
automated approaches, -pieglobals and -fsglobals are supported; -tlsglobals
is not supported on reconverse.
AMPI programs must have the following main function signatures, so that AMPI
can bootstrap before invoking the user's main function:
* C/C++ programs should use "int main(int argc, char **argv)"
* Fortran programs must use "Subroutine MPI_Main" instead of
"Program Main"
Incompatibilities and Extensions
--------------------------------
AMPI has some known flaws and incompatibilities with other MPI implementations:
* RMA routines do not have support for derived datatypes.
* Not all collectives are supported on intercommunicators.
* No support for MPI_Pack_external, MPI_Pack_external_size, MPI_Unpack_external.
AMPI also has extensions to the MPI standard to enable use of the high-level
features provided by the Charm++ adaptive runtime system. All extensions are
prefixed with AMPI_:
* AMPI_Migrate tells the runtime system that the application has reached a
point at which the runtime system may serialize and migrate ranks.
It is used for dynamic load balancing and fault tolerance. See the AMPI
manual for more information on how to use it.
* AMPI_Register_pup is used to register PUP routines and user data.
* AMPI_Get_pup_data returns a pointer to user data managed by the runtime.
* AMPI_Load_set_value sets the calling rank's load to the given user value.
* AMPI_Load_start_measure starts load balance information collection.
* AMPI_Load_stop_measure stops load balance information collection.
* AMPI_Load_reset_measure clears the load balance database.
* AMPI_Migrate_to_pe migrates the calling rank to the given PE.
* AMPI_Set_migratable sets the migratability of the calling rank.
* AMPI_Command_argument_count returns the number of command line arguments
given to a Fortran AMPI program excluding runtime and AMPI parameters.
* AMPI_Get_command_argument returns an argument from the command line
to a Fortran AMPI program.
MPI-IO support is available via our port of the ROMIO library. However:
* ROMIO is not built by default due to the fact that the current port is
incompatible with GCC 14 and beyond. Add --with-romio to your
build line to enable MPI-IO support via ROMIO.
Note that AMPI defines a preprocessor symbol "AMPI" so that user codes can
check for AMPI's presence at compile time using "#ifdef AMPI".