Subsections

B. Building and Running AMPI Programs

B..1 Building

CHARM++ provides a compiler called charmc in your charm/bin/ directory. You can use this compiler to build your AMPI program the same way as other compilers like cc. Especially, to build an AMPI program, a command line option -language ampi should be applied. All the command line flags that you would use for other compilers can be used with charmc the same way. For example:

> charmc -language ampi -c pgm.c -O3
> charmc -language ampi -o pgm pgm.o -lm -O3

Shortcuts to the AMPI compiler are provided. If you have added charm/bin into your $PATH environment variable, simply type mpicc, mpiCC, mpif77, and mpif90 as provided by other MPI implementations.

> mpicc -c pgm.c -g

B..2 Running

CHARM++ distribution contains a script called charmrun that makes the job of running AMPI programs portable and easier across all parallel machines supported by CHARM++. charmrun is copied to a directory where an AMPI prgram is built using charmc. It takes a command line parameter specifying number of processors, and the name of the program followed by AMPI options (such as number of chunks to create, and the stack size of every chunk) and the program arguments. A typical invocation of AMPI program pgm with charmrun is:

> charmrun pgm +p16 +vp32 +tcharm_stacksize 3276800

Here, the AMPI program pgm is run on 16 physical processors with 32 chunks (which will be mapped 2 per processor initially), where each user-level thread associated with a chunk has the stack size of 3,276,800 bytes.

November 23, 2009
AMPI Homepage
Charm Homepage