
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
A - C++ 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. 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):
g++ -o myprog myprog.cpp
• No user-defined libraries or user-defined header files are needed, but the special system library corresponding to math.h is needed:
g++ -o myprog myprog.cpp -lmath
• User-defined libraries, user-defined header files, and the special system library corresponding to math.h are needed:
g++ -o myprog myprog.cpp -I/users/kirby/includes -L/users/ kirby/libs -lSCmathlib -lmath
The string following the “-I” 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.
- Type
- Chapter
- Information
- Parallel Scientific Computing in C++ and MPIA Seamless Approach to Parallel Algorithms and their Implementation, pp. 575 - 580Publisher: Cambridge University PressPrint publication year: 2003