Introduction

Starting from a background in Fortran, arithmetic with C++ arrays is annoying!

  • No sub-slice operations
  • Must iterate over every index
    A++ mimics Fortran array arithmetic in C++.

P++ makes it trivial to parallelize A++ codes: Simply recompile & re-link the executable. P++ handles the data distribution and proper ghost boundary managment for you. Read on to learn how to code A++ & P++ applications.

Requirements

  • MPI C++ compiler
  • Install the A+/P+ library

These are already configured on tor.hao.ucar.edu, bluefire.ucar.edu, stic.rice.edu, discovery.dartmouth.edu and many more!

Makefiles

Utilizing A++ and P++ requires a special set of compile and link flags:

CXXFLAGS  =-I/path/to/A++/include
CXXFLAGS +=-I/path/to/P++/include
LDFLAGS  =/path/to/A++/lib -lApp -lApp_static
LDFLAGS +=/path/to/P++/lib -lPpp -lPpp_static

Part 1: A++

How does A++ differ from C++?

typeArray

Example 1a. "Hello World"

Note John's occasional convention of typeArray.setBase(1)

Mathematical Operations

See many of the subsections for Array Objects:

Exercise

Given an (x,y,z) grid, compute cell centers.

Part 2: P++

Recompile with preprocessor flag PPLUSPLUS set and link the P++ library.

Hello parallel worlds!

Example 1b. ``Parallel Hello World''

partitioning_type

Example 3. Distribution of Arrays in P++

Exercise: Heat Equation

The solution is in the A+/P+ Tutorial: Example 4. The Heat Equation

Answers to Exercises

  • A++
  • P++
  • Diffusion Equation

Resources

  • Manual/Primer - The only documentation I've found for A++ & P++.
    • Chapter 10 is very useful as a reference to the library (both A++ & P++)
  • No labels