Chapter 2. The SGI Compiling Environment

This chapter provides an overview of the SGI compiling environment on the SGI Altix family of servers and superclusters and covers the following topics:

The remainder of this book provides more detailed examples of the use of the SGI compiling environment elements.

Compiler Overview

The Intel Fortran and C/C++ compilers are provided with the SGI Altix distribution. The Fortran compiler supports OpenMP 2.0 and the C/C++ compiler is compatible with gcc and the C99 standard.

In addition, the GNU Fortran and C compilers are available on Altix systems.

The following is the general form of the compiler command line (note that the Fortran command is used in this example):

% ifort [options] filename.extension

An appropriate filename extension is required for each compiler, according to the programming language used (Fortran, C, C++, or FORTRAN 77).

Some common compiler options are:

  • -o filename: renames the output to filename.

  • -g: produces additional symbol information for debugging.

  • -O[level]: invokes the compiler at different optimization levels, from 0 to 3.

  • -ldirectory_name: looks for include files in directory_name .

  • -c: compiles without invoking the linker; this options produces an a.o file only.

Many processors do not handle denormalized arithmetic (for gradual underflow) in hardware. The support of gradual underflow is implementation-dependent. Use the -ftz option with the Intel compilers to force the flushing of denormalized results to zero.

Note that frequent gradual underflow arithmetic in a program causes the program to run very slowly, consuming large amounts of system time (this can be determined with the time command). In this case, it is best to trace the source of the underflows and fix the code; gradual underflow is often a source of reduced accuracy anyway.. prctl(1) allows you to query or control certain process behavior. In a program, prctl tracks where floating point errors occur.

Some applications can generate an excessive number of kernel KERN_WARN "floating point assist" warning messages. For more information, see http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/srch21@floating%20point%20assist/linux/bks/SGI_Admin/books/LX_ConfigOps_AG/sgi_html/ch01.html#Z1109975092tls .

Modules

A module is a user interface that provides for the dynamic modification of a user's environment. By changing the module, a user does not have to change environment variables in order to access different versions of the compilers, loaders, libraries and utilities that are installed on the system.

Modules can be used in the SGI compiling environment to customize the environment. If the use of modules is not available on your system, its installation and use is highly recommended.

To view which modules are available on your system, use the following command (for any shell environment):

% module avail 

To load modules into your environment (for any shell), use the following commands:

% module load intel-compilers-latest mpt-1.7.1rel
% module load scsl-1.4.1-1


Note: The above commands are for example use only; the actual release numbers may vary depending on the version of the software you are using. See the release notes that are distributed with your system for the pertinent release version numbers.

For details about using modules, see the module man page (you must have the module man page loaded).

Library Overview

Libraries are files that contain one or more object (.o) files. Libraries are used to simplify local software development by hiding compilation details. Libraries are sometimes also called archives.

The SGI compiling environment contains several types of libraries; an overview about each library is provided in this subsection.

Static Libraries

Static libraries are used when calls to the library components are satisfied at link time by copying text from the library into the executable. To create a static library, use the ar(1), or an archiver command.

To use a static library, include the library name on the compiler's command line. If the library is not in a standard library directory, be sure to use the -L option to specify the directory and the -l option to specify the library filename.

To build an appplication to have all static versions of standard libraries in the application binary, use the -static option on the compiler command line.

Dynamic Libraries

Dynamic libraries are linked into the program at run time and when loaded into memory can be accessed by multiple programs. Dynamic libraries are formed by creating a Dynamic Shared Object (DSO).

Use the link editor command (ld(1)) to create a dynamic library from a series of object files or to create a DSO from an existing static library.

To use a dynamic library, include the library on the compiler's command line. If the dynamic library is not in one of the standard library directories, use the -rpath compiler option during linking. You must also set the LD_LIBRARY_PATH environment variable to the directory where the library is stored before running the executable.

C/C++ Libraries

The following C/C++ libraries are provided with the Intel compiler:

  • libguide.a, libguide.so: for support of OpenMP-based programs.

  • libsvml.a: short vector math library

  • libirc.a: Intel's support for Profile-Guided Optimizations (PGO) and CPU dispatch

  • libimf.a, libimf.so: Intel's math library

  • libcprts.a, libcprts.so: Dinkumware C++ library

  • libunwind.a, libunwind.so : Unwinder library

  • libcxa.a, libcxa.so: Intel's runtime support for C++ features

SHMEM Message Passing Libraries

The Shared Memory Access Library (libsma) is part of the Message Passing Toolkit (MPT) product on SGI Altix systems. The SHMEM programming model consists of library routines that provide low-latency, high-bandwidth communication for use in highly parallelized, scalable programs. The routines in the SHMEM application programming interface (API) provide a programming model for exchanging data between cooperating parallel processes. The resulting programs are similar in style to Message Passing Interface (MPI) programs. The SHMEM API can be used either alone or in combination with MPI routines in the same parallel program.

A SHMEM program is SPMD (single program, multiple data) in style. The SHMEM processes, called processing elements or PEs, all start at the same time, and they all run the same program. Usually the PEs perform computation on their own subdomains of the larger problem, and periodically communicate with other PEs to exchange information on which the next computation phase depends.

The SHMEM routines minimize the overhead associated with data transfer requests, maximize bandwidth, and minimize data latency. Data latency is the period of time that starts when a PE initiates a transfer of data and ends when a PE can use the data.

SHMEM routines support remote data transfer through put operations, which transfer data to a different PE, get operations, which transfer data from a different PE, and remote pointers, which allow direct references to data objects owned by another PE. Other operations supported are collective broadcast and reduction, barrier synchronization, and atomic memory operations. An atomic memory operation is an atomic read-and-update operation, such as a fetch-and-increment, on a remote or local data object.

For details about using the SHMEM routines, see the intro_shmem(3) man page or the Message Passing Toolkit (MPT) User's Guide.

Other Compiling Environment Features

The SGI compiling environment includes several other products as part of its distribution:

  • idb: the Intel debugger (available if your system is licensed for the Intel compilers). This is a fully symbolic debugger and supports Fortran, C, and C++ debugging.

  • gdb: the GNU project debugger, which supports C, C++ and Modula-2. It also supports Fortran 95 debugging when the gdbf95 patch is installed.

  • ddd: a graphical user interface to gdb and the other debuggers.

  • TotalView: a licensed graphical debugger useful in an MPI environment (see http://www.totalviewtech.com/ )

These and other performance analysis tools are discussed in Chapter 3, “Performance Analysis and Debugging”.