build: fix travis MPI/SMP build
[charm.git] / README.ampi
blob81c82992d4767032e28dd3b8b4be57ab88840d6f
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 must 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     * RMA routines do not have support for derived datatypes.
75     * Not all collectives are supported on intercommunicators.
76     * No support for MPI_Pack_external, MPI_Pack_external_size, MPI_Unpack_external,
77       or MPI_Type_match_size.
79 AMPI also has extensions to the MPI standard to enable use of the high-level
80 features provided by the Charm++ adaptive runtime system. All extensions are
81 prefixed with AMPI_:
82     * AMPI_Migrate tells the runtime system that the application has reached a
83       point at which the runtime system may serialize and migrate ranks.
84       It is used for dynamic load balancing and fault tolerance. See the AMPI
85       manual for more information on how to use it.
86     * AMPI_Register_pup is used to register PUP routines and user data.
87     * AMPI_Get_pup_data returns a pointer to user data managed by the runtime.
88     * AMPI_Register_main is used to register multiple AMPI modules.
89     * AMPI_Load_set_value sets the calling rank's load to the given user value.
90     * AMPI_Load_start_measure starts load balance information collection.
91     * AMPI_Load_stop_measure stops load balance information collection.
92     * AMPI_Load_reset_measure clears the load balance database.
93     * AMPI_Migrate_to_pe migrates the calling rank to the given PE.
94     * AMPI_Set_migratable sets the migratability of the calling rank.
95     * AMPI_Command_argument_count returns the number of command line arguments
96       given to a Fortran AMPI program excluding charmrun and AMPI parameters.
97     * AMPI_Get_command_argument returns an argument from the command line
98       to a Fortran AMPI program.
100 Note that AMPI defines a preprocessor symbol "AMPI" so that user codes can
101 check for AMPI's presence at compile time using "#ifdef AMPI".