CHANGES: Add release notes for 6.8.1
[charm.git] / README.ampi
blobb8a1a24ec1b9446145af0f40bd3093531c7320d8
2 Adaptive MPI (AMPI)
3 -------------------
4 AMPI is an implementation of the MPI standard written on top of Charm++, meant
5 to give MPI applications access to high-level, application-independent features
6 such as overdecomposition (processor virtualization), dynamic load balancing,
7 automatic fault tolerance, and overlap of computation and communication. For
8 more information on all topics related to AMPI, consult the AMPI manual here:
10     http://charm.cs.illinois.edu/manuals/html/ampi/manual.html
13 Building AMPI
14 -------------
15 AMPI has its own target in the build system. You can run the top-level
16 build script interactively using "./build", or you can specify your
17 architecture, operating system, compilers, and other options directly.
18 For example:
20     ./build AMPI netlrts-linux-x86_64 gfortran gcc --with-production
23 Compiling and Linking AMPI Programs
24 -----------------------------------
25 AMPI source files can be compiled and linked with the wrappers found
26 in bin/, such as ampicc, ampicxx, ampif77, and ampif90:
28     ampif90 pgm.f90 -o pgm
30 To enable transparent migration of user heap data, link with
31 "-memory isomalloc". To perform dynamic load balancing, link in a Charm++
32 load balancer (suite) using "-module <LB>". For example:
34     ampicc pgm.c -o pgm -memory isomalloc -module CommonLBs
36 Note that you need to specify a Fortran compiler when building Charm++/AMPI
37 for Fortran compilation to work.
40 Running AMPI Programs
41 ---------------------
42 AMPI programs can be run with charmrun like any other Charm++ program. In
43 addition to the number of processes, specified with "+p n", AMPI programs
44 also take the total number of virtual processors (VPs) to run with as "+vp n".
45 For example, to run an AMPI program 'pgm' on 4 processors using 32 ranks, do:
47     ./charmrun +p 4 ./pgm +vp 32
49 To run with dynamic load balancing, add "+balancer <LB>":
51     ./charmrun +p 4 ./pgm +vp 32 +balancer RefineLB
54 Porting to AMPI
55 ---------------
56 Global and static variables are unsafe for use in virtualized AMPI programs.
57 This is because globals are defined at the process level, and AMPI ranks are
58 implemented as user-level threads, which may share a process with other ranks
59 Therefore, to run with more than 1 VP per processor, all globals and statics
60 that are non-readonly and whose value does not depend on rank must be modified
61 to use local storage. Consult the AMPI manual for more information on global
62 variable privatization and automated approaches to privatization.
64 AMPI programs must have the following main function signatures, so that AMPI
65 can bootstrap before invoking the user's main function:
66     * C/C++ programs should use "int main(int argc, char **argv)"
67     * Fortran programs should use "Subroutine MPI_Main" instead of
68       "Program Main"
71 Incompatibilities and Extensions
72 --------------------------------
73 AMPI has some known flaws and incompatibilities with other MPI implementations:
74     * MPI_Get_elements gives incorrect results for receives of partial derived datatypes.
75     * RMA routines do not have support for derived datatypes.
76     * Datatypes are not reused, freed, or reference counted.
77     * Not all collectives are supported on intercommunicators.
78     * MPI_Comm_free does not actually free any of the runtime's memory.
79     * The PMPI profiling interface and generalized requests are not yet implemented in AMPI.
81 AMPI also has extensions to the MPI standard to enable use of the high-level
82 features provided by the Charm++ adaptive runtime system. All extensions are
83 prefixed with AMPI_:
84     * AMPI_Migrate tells the runtime system that the application has reached a
85       point at which the runtime system may serialize and migrate ranks.
86       It is used for dynamic load balancing and fault tolerance. See the AMPI
87       manual for more information on how to use it.
88     * AMPI_Register_pup is used to register PUP routines and user data.
89     * AMPI_Get_pup_data returns a pointer to user data managed by the runtime.
90     * AMPI_Register_main is used to register multiple AMPI modules.
91     * AMPI_Load_set_value sets the calling rank's load to the given user value.
92     * AMPI_Load_start_measure starts load balance information collection.
93     * AMPI_Load_stop_measure stops load balance information collection.
94     * AMPI_Load_reset_measure clears the load balance database.
95     * AMPI_Migrate_to_pe migrates the calling rank to the given PE.
96     * AMPI_Set_migratable sets the migratability of the calling rank.
97     * AMPI_Command_argument_count returns the number of command line arguments
98       given to a Fortran AMPI program excluding charmrun and AMPI parameters.
99     * AMPI_Get_command_argument returns an argument from the command line
100       to a Fortran AMPI program.
102 Note that AMPI defines a preprocessor symbol "AMPI" so that user codes can
103 check for AMPI's presence at compile time using "#ifdef AMPI".