Intel Compilers
Intel compilers produce efficient executables for Intel blades and allow linking
to the intel mkl math libraries. Linking object files to produce an
executable sometimes requires shuffling the order in which the object
files are listed, or listing object files multiple times.
64 bit Intel compiled executables for AMD blades
encounter run time errors.
To use the Intel compilers it is necessary
to properly configure some environment
variables and paths.
As a convenience an alias - add - has been created
for tcsh users to set up the environment for various
software packages. To use the Intel compilers the command
add intel
will set the necessary environment variables.
Currently the command 'add intel' will set up the
environment for version
8.1 of the Intel compiler. To use the earlier
7.1 version of the Intel compilers use the command
'add intel-71'.
Once one of these files have been executed, the Intel
compilers may be invoked with the icc, icpc,
and ifort commands for the C, C++, and Fortran77/90
compilers respectively.
Intel 7.1 compilers were invoked with icc for the
C/C++ compiler and ifc for the Fortran compiler.
Compiling a Serial Program
The following command would generate an executable named
'exec' from the Fortran source code file named 'code.f'
with a moderately high level of optimization.
ifort -O3 -axW -o exec code.f
Compiling a Multi-Core Program
Intel Compilers can generate shared memory parallel executables,
e.g. for multi-core processors.
Older cluster nodes have only two processors, so shared memory
parallelization did not provide much benefit.
However, blades purchased over the last few years have 4, 8 and
even 16 cores. Other machines such as desktops and even laptops
are also likely to have multiple cores.
OpenMP directives in C and Fortran codes are one popular means
of achieving shared memory parallelism. The following command
line should enable OpenMP parallelism with a high degree
of optimisation.
ifort -o exec -openmp -O3 -xW code.f
This command produces code for either Intel or AMD blades and runs
relatively fast in either case. However,
64 bit ifort compiled codes encounter runtime errors on the AMD blades (which
are our only current blades with 16 cores).
Compiling a Distributed Memory Parallel Program
Distributed memory parallel programs written
with MPI function calls are currently the most
appropriate programming model to achieve good
performance from commodity clusters such as
henry2.
MPI parallel programs compiled with the Intel compilers
should use the mpif77, mpif90, mpicc, or mpiCC
commands to link with the MPICH libraries.
The following command line would compile an MPI
code with a high level of optimization:
mpif90 -o exec -O3 -axW code.f
The MPICH MPI library is used when the mpi* commands
are invoked with the Intel compiler environments.
When C and Fortran object files are linked together, the
-static-libcxa flag avoids a run-time error. For example,
the executable pring produced by
ifort -c ring.f
icc -c host.c
mpif90 -o pring host.o ring.o -static-libcxa
ran successfully, while leaving out the flag gave a run-time
error "error while loading shared libraries: libcxa.so.5".
Any of these compilers (and in particular the mpiCC) compiler
are prone to run-time errors when shared libraries are used.
Using a -static flag is therefore recommended. For example,
mpiCC greetings2.c -o greetings2 -static
avoids a run-time error which frequently occurs when the -static
flag is omitted.
|