Book contents
- Frontmatter
- Contents
- Preface
- Acknowledgments
- 1 Scientific Computing and Simulation Science
- 2 Basic Concepts and Tools
- 3 Approximation
- 4 Roots and Integrals
- 5 Explicit Discretizations
- 6 Implicit Discretizations
- 7 Relaxation: Discretization and Solvers
- 8 Propagation: Numerical Diffusion and Dispersion
- 9 Fast Linear Solvers
- 10 Fast Eigensolvers
- A C++ Basics
- B MPI Basics
- Bibliography
- Index
B - MPI Basics
Published online by Cambridge University Press: 05 October 2013
- Frontmatter
- Contents
- Preface
- Acknowledgments
- 1 Scientific Computing and Simulation Science
- 2 Basic Concepts and Tools
- 3 Approximation
- 4 Roots and Integrals
- 5 Explicit Discretizations
- 6 Implicit Discretizations
- 7 Relaxation: Discretization and Solvers
- 8 Propagation: Numerical Diffusion and Dispersion
- 9 Fast Linear Solvers
- 10 Fast Eigensolvers
- A C++ Basics
- B MPI Basics
- Bibliography
- Index
Summary
COMPILATION GUIDE
For the purposes of this compilation example, we will assume that we are using the GNU g++ compiler to compile a C++ program we have written contained within the file myprog.cpp. We will also assume that the machine on which you are trying to compile is a parallel machine with some version of MPI installed. You will need to contact your system administrator to find out the exact version of MPI that is available and the paths on your local architecture. In the following examples, the argument following the “-o” flag designates the file name to be used for the output. If no “-o” option is specified, most compilers default to using the name “a.out.” We now present several different programming scenarios:
• No user-defined libraries or user-defined header files are needed, and no special system libraries (such as those associated with math.h) are needed other than the MPI libraries:
g++ -o myprog myprog.cpp -lmpi
• No user-defined libraries or user-defined header files are needed, but the special system library corresponding to math.h is needed along with the MPI libraries:
g++ -o myprog myprog.cpp -lmath -lmpi
• User-defined libraries, user-defined header files, and the special system library corresponding to math.h are needed along with the MPI libraries:
g++ -o myprog myprog.cpp -I/users/kirby/includes -L/users/ kirby/libs -lSCmathlib -lmath -lmpi
The string following the flag designates the location of the user-defined header files to be included. The string following the “-L” flag designates the location of the user-defined libraries to be included. The string “-lSCmathlib” links the program with the user-defined library we created, and the string “-lmath” links the program with the system math library corresponding to math.h. The string “-lmpi” links the MPI libraries.
- Type
- Chapter
- Information
- Parallel Scientific Computing in C++ and MPIA Seamless Approach to Parallel Algorithms and their Implementation, pp. 581 - 606Publisher: Cambridge University PressPrint publication year: 2003