This document is an introduction to POOMA v2.1, a C++ class library for high-performance scientific computation. POOMA runs efficiently on single-processor desktop machines, shared-memory multiprocessors, and parallel supercomputers containing dozens or hundreds of processors. What's more, by making extensive use of the advanced features of the ANSI/ISO C++ standard---particularly templates---POOMA presents a compact, easy-to-read interface to its users.
Earlier releases of POOMA v2 provided multi-dimensional arrays using a wide variety of storage schemes and parallel decompositions, multi-threading, and out-of-order execution for maximum performance. This release adds fields, coordinate systems, meshes, efficient differential operators, and particles. POOMA v2.2, which will be released in early November 1999, will support efficient distributed-memory parallelism.
To see why you might want to build your programs using POOMA, consider the following simple Laplace solver using Jacobi iteration on a fixed-size grid:
#include "Pooma/Arrays.h" #include <iostream> // The size of each side of the domain. const int N = 20; int main( int argc, // argument count char * argv[] // argument list ){ // The array we'll be solving for Array<2> x(N, N); x = 0.0; // The right hand side of the equation (spike in the center) Array<2> b(N, N); b = 0.0; b(N/2, N/2) = -1.0; // Specify the interior of the domain Interval<1> I(1, N-2), J(1, N-2); // Iterate 200 times for (int i=0; i<200; ++i) { x(I,J) = 0.25*(x(I+1,J) + x(I-1,J) + x(I,J+1) + x(I,J-1) - b(I,J)); } // Print out the result std::cout << x << std::endl; }
The syntax is very similar to that of Fortran 90: a single assignment fills an entire array with a scalar value, subscripts express ranges as well as single points, and so on. In fact, the combination of C++ and POOMA provides so many of the features of Fortran 90 that one might well ask whether it wouldn't better to just use the latter language.
The simple answer is that the abstraction facilities of C++ are much more powerful than those in Fortran. A more powerful answer is economics. While the various flavors of Fortran are still the lingua franca of scientific computing, Fortran's user base is shrinking, particularly in comparison to C++. Networking, graphics, database access, and operating system interfaces are available to C++ programmers long before they're available in Fortran (if they become available at all). What's more, support tools such as debuggers and memory inspectors are primarily targeted at C++ developers, as are hundreds of books, journal articles, and web sites.
Until recently, Fortran has had two powerful arguments in its favor: legacy applications and performance. However, the importance of the former is diminishing as the invention of new algorithms force programmers to rewrite old codes, while the invention of techniques such as expression templates has made it possible for C++ programs to match, or exceed, the performance of highly optimized Fortran 77.
POOMA was designed and implemented by scientists working at the Los Alamos National Laboratory's Advanced Computing Laboratory. Between them, these scientists have written and tuned large applications on almost every commercial and experimental supercomputer built in the last two decades. As the technology used in those machines migrates down into departmental computing servers and desktop multiprocessors, POOMA is a vehicle for its designers' experience to migrate as well. In particular, POOMA's authors understand how to get good performance out of modern architectures, with their many processors and multi-level memory hierarchies, and how to handle the subtly complex problems that arise in real-world applications.
Finally, POOMA is free for non-commercial use (i.e., your tax dollars have already paid for it). You can read its source, extend it to handle platforms or problem domains that the core distribution doesn't cater to, or integrate it with other libraries and your current application, at no cost. For more information, please see the license information included in the appendix.
Of course, nothing is perfect. At the time of this release, some C++ compilers still do not support the full ANSI/ISO C++ standard. Please refer to the appendix for a list of those that do.
A second compiler-related problem is that most compilers produce very long, and very cryptic, error messages if they encounter an error while expanding templated functions and classes, particularly if those functions and classes are nested. Since POOMA uses templates extensively, it is not uncommon for a single error to result in several pages of complaints from a compiler. The appendix on error messages discusses some strategies that can be used to find the root cause of such errors. Programs that use templates extensively are also still sometimes slower to compile than programs that do not, and the executables produced by some compilers can be surprisingly large.
Finally, some debuggers still provide only limited support for inspecting templated functions and classes. All of these problems are actively being addressed by vendors, primarily in response to the growing popularity of the Standard Template Library, or STL. Once again, the large (and growing) user base for C++ means that scientific programmers can take advantage of the fact that even the best tools are constantly being improved.
The body of this tutorial starts with a discussion of the background to POOMA, including key technologies such as caching, compiler optimization, and C++ templates. The individual tutorials take a simple program---the Laplace solver shown earlier---and add more and more functionality to it, until it is able to run on multiple processors and to control its own termination by calculating user-defined residuals.
Before you start reading these tutorials, however, you may wish to take a look at the short quiz included in the appendix. POOMA does require some familiarity with some of the less well-known features of C++; if you do not feel comfortable with the questions and their answers, you may wish to have a look at one of the books in the recommended reading list before proceeding.
You may also wish to look at the POOMA web site for updates,
bug fixes, and discussion of the library and how it can be used. If
you have any questions about POOMA or its terms of use, or if you need
help downloading or installing POOMA, please send mail to freepooma-devel@nongnu.org.
[Home] | [Next] |