Section: 3.2 Compiling and linking

3.2.2 Compiler support

Scali MPI Connect is a C library built using the GNU compiler. Applications can however be compiled with most compilers, as long as they are linked with the GNU runtime library. The details of the process of linking with the Scali MPI Connect libraries vary depending on which compiler is used. Check the "Scali MPI Connect Release Notes" for information on supported compilers and how linking is done.

When compiling the following string must be included as compiler flags (bash syntax):

“-I$MPI_HOME/include”

The pattern for compiling is:

user% gcc -c -I$MPI_HOME/include hello-world.c user% g77 -c -I$MPI_HOME/include hello-world.f

3.2.3 Linker flags

The following string outlines the setup for the necessary linker flags (bash syntax):

“-L/opt/scali/lib -lmpi”

The following versions of MPI libraries are available:

libmpi - Standard library containing the C API.

libfmpi - Library containing the Fortran API wrappers.

The pattern for linking is:

user% gcc hello-world.o -L$MPI_HOME/lib -lmpi -o hello-world

user% g77 hello-world.o -L$MPI_HOME/lib -lfmpi -lmpi -o hello-world

3.2.4 Notes on Compiling and linking on AMD64 and EM64T

AMDs AMD64 and Intels EM64T (also known as x86-64) are instruction set architectures (ISA) that add 64 bit extensions to Intel x86 (ia32) ISA.

These processors are capable of running 32 bit programs at full speed while running a 64 bit OS. For this reason Scali supports running both 32 bit and 64 bit MPI programs while running 64 bit OS.

Having both 32 bit and 64 bit libraries installed at the same time require some tweaks to the compiler and linker flags.

All compilers for x86_64 generate 64 bit code by default, but have flags for 32 bit code generation. For gcc/g77 these are -m32and -m64for making 32 and 64 bit code respectively. For Portland Group Compilers these are -tpk8-32and -tpk8-64. For other compilers please check the compiler documentation.

It is not possible to link 32 and 64 bit object code into one executable, (no cross dynamic linking either) so there must be double set of libraries. It is common convention on x86_64 systems that all 32 bit libraries are placed in lib directories (for compatibility with x86 OS’es) and all 64 bit libraries in lib64. This means that when linking a 64 bit application with Scali MPI, you must use the -L$MPI_HOME/lib64argument instead of the normal -L$MPI_HOME/lib.

Scali MPI Connect Release 4.4 Users Guide

22

Page 34
Image 34
Escali 4.4 manual Compiler support, Linker flags