Compiler-level optimization

From HP-SEE Wiki

Revision as of 11:32, 17 April 2012 by Gurov (Talk | contribs)
Jump to: navigation, search

Contents

Using GNU compilers

FORTRAN

Contributed by UKIM

1. Compiling

The general rule to make an executable file from free source fortran code in file with extension .f90 or .f95 is to run:

g95 myprog.f90 -o myprog

This creates the executable with filename "myprog" All include files should be present in the same directory.

2. Compiler options

One may try to invoke g95 with speed optimization option:

g95 myprog.f90 -o myprog -O2

Many other options are available however and one may wish to consult online docs repository at http://www.g95.org/docs.shtml If several subprograms (or modules) have be included in the main program, and compiled and recompiled many times during testing and debugging phase, one may wish to invest some time to learn to use "make"

3. Running the executable

With

$ myprog (or, for some configurations $ ./myprog) 

the executable runs interactively - the program have to exit (with DONE or with an ERROR) for the command prompt to reappear. With

$ myprog & 

the process runs into background. The screen output and (eventual) error messages may be redirected to corrseponding files with:

$ myprog 1>myoutput 2>myerrors &

4.Terminating the program

In case one wish to terminate the running program the following steps are advised:

$ ps -ax (to list the running processes with their PID)
$ kill -9 "process number"

Using IBM XL compilers

Section contributed by IICT-BAS

The IBM XL suite of compilers is deployed at the Blue Gene/P. The most important advantage of these compilers with respect to the GNU compiler collection is that they support the special features of the processors of Blue Gene/P that allow to double the floating point performance in double precision. Thus one should always try to compile with these compilers first. One should also remember that the compilation is in effect a cross-compilation, since it is done on the front-end node, which has slightly different architecture. The configure script or whatever build system is used, must be instructed to use the cross-compiler instead of the standard gcc or other, to perform compilation. Usually, it can be done by setting the environment variable like CC, F90, CXX, MPICC, MPIF90, MPICXX to point to the respective IBM XL compilers. The usual flags to achieve optimal result on the Blue Gene/P in Sofia are:

-O2 -qarch=450d -qtune=450

which specify the CPU architecture.

Intel® Parallel Studio XE development suite

Sun Studio

PGI

javac