15 reserved symbols and names, 2 building parallel applications, 1 compiling and linking non-mpi applications – HP XC System 2.x Software User Manual
Page 48: 2 compiling and linking hp-mpi applications, Section 3.7.2)
![background image](/manuals/398425/48/background.png)
3.7.1.15 Reserved Symbols and Names
The HP XC system reserves certain symbols and names for internal use. Reserved symbols
and names should not be included in user code. If a reserved symbol or name is used, errors
could occur.
3.7.2 Building Parallel Applications
This section describes how to build MPI and non-MPI parallel applications on an HP XC system.
3.7.2.1 Compiling and Linking Non-MPI Applications
If you are building non-MPI applications, such as an OpenMP application for example, you can
compile and link them on an HP XC as you normally would, with standard header files and
switches.
3.7.2.2 Compiling and Linking HP-MPI Applications
This section provides some general information about how to build an HP-MPI application
in the HP XC environment. Refer to Chapter 8 for complete details, examples, and further
information about building HP-MPI applications.
Compiling and linking an MPI application on an HP XC system is performed by invoking the
HP-MPI compiler utilities. HP-MPI compiler utilities are scripts supplied by HP-MPI to make
it easier to invoke a compiler with the appropriate libraries and search paths. The HP-MPI
compiler utilities add all the necessary path locations and library specifications to the compile
and link steps that are required to build a HP XC parallel application. It is highly recommended
that you use the HP-MPI compiler utilities to compile and link your MPI application on an HP
XC cluster, rather than invoke a compiler directly.
The
mpicc
,
mpic++
,
mpif90
, and
mpif77
MPI compiler commands are used to invoke
the HP-MPI compiler utilities that compile and link an MPI application. The
mpicc
and
mpic++
commands invoke the drivers of the C and C++ compilers. The
mpif77
and
mpif90
commands invoke the drivers of the Fortran 77 and Fortran 90 compilers.
Before you can compile and link an MPI program using the MPI compiler commands, the MPI
compiler utilities module (
mpi
) must be loaded, or you must arrange for them to be in your
$PATH search list. The use of modules is described in Section 2.2.
3.7.2.3 Examples of Compiling and Linking HP-MPI Applications
The following examples show how to compile and link your application code by invoking a
compiler utility.
If you have not already loaded the
mpi
compiler utilities module , load it now as follows:
$ module load mpi
To compile and link a C application using the
mpicc
command:
$ mpicc -o mycode hello.c
To compile and link a Fortran application using the
mpif90
command:
$ mpif90 -o mycode hello.f
In the above examples, the HP-MPI commands invoke compiler utilities which call the C and
Fortran compilers with appropriate libraries and search paths specified to build the parallel
application called
hello
. The
-o
specifies that output is directed to a file called
mycode
.
Refer to Chapter 8 for additional information about building applications with HP-MPI.
3-8
Developing Applications