Skip to main content

You may be using a Web browser that does not support standards for accessibility and user interaction. Find out why you should upgrade your browser for a better experience of this and other standards-based sites...

Dartmouth Home  Search  Index

Dartmouth Home | Search | Index

Dartmouth home page
Computing at Dartmouth
Computing > Support >  Library >  Research > Applications > Soft-Dev > Programs >

How Do I Use Compilers on Linux Systems?

Most Research Computing Linux computers have three different kinds of compilers: GNU compilers, Portland Group compilers, and Intel compilers.

Below is a table that shows the different compilers and their commands:

Language

File Suffix

Command

Type of Compiler

Fortran 77

.f

pgf77

Portland Group

 

.f

ifort

Intel

 

.f .F .for

g77

GNU

Fortran 90

.f .f90

pgf90

Portland Group

 

.f .f90

ifort

Intel

C

.c

pgcc

Portland Group

 

.c

icc

Intel

 

.c

gcc

GNU

C++

.c .C

pgCC

Portland

 

.c

icc

Intel

 

.c

g++

GNU

No one compiler works best for all kinds of code. If you are interested in speeding up your application, you will want to test various compiler options and compilers to see which ones work the best for your application. There is a man page for each compiler that lists the compiler options.

In general, gcc/g++ is the most flexible since it runs on a variety of different computer platforms. Many people use gcc/g++ so it will be easy to port their code to other platforms. g77 is the Fortran77 GNU compiler and is not as robust as the Portland Group and Intel Fortran compilers.

The Portland Group compilers will compile f77, f90, C, and C++ codes. Many Fortran codes use extensions to the language, and the Portland Group compilers support those extensions. Portland Group recommends you use the pgf90 for both Fortran 90 and Fortran 77 codes to gain additional code speed up.

The Intel compilers are more restrictive than the Portland Group and GNU compilers and don't always allow language extensions. However, they do a good job of compiling code to make use of the hyper-threading/SSE enhancements on the Pentium 4/Xeon processors.

All of the compiler commands listed above are in the standard user path. In addition, the compilers have been linked as provided below.

Useful Compiler Options

Following are some useful compiler optimization options to know about for each of the three kinds of compilers. All three kinds of compilers generate code that is optimized for the platform where they are compiled. The comments below apply to both C/C++ and Fortran77/90 codes. These optimizations will not necessarily speed up all kinds of code and should be tested individually.

Portland Group: pgcc, pgCC, pgf77, pgf90

If you want to use a number of more aggressive optimizations that make use of the features of the Pentium4/Xeon/AMD processors to speed up your code and use the options -fastsse -O4. In addition, following are other optimization options to try.

PG Compiler Option

Description of Option

-Munroll

Unroll loops.

-Mvect

Vectorize code.

-Mvect=sse

Make use of the sse/see2 vectorization.

-Mconcur

Auto-parallelization using OpenMP.

-mp parallelize using user-inserted OpenMP directives

-Mipa

Inter- procedural analysis.

Intel Compilers

Use the option -O3 to obtain more aggressive optimization. You can use the -parallel option to have the compiler insert multi-threaded code in loops that can be safely parallelized and make use of the hyper-threading capabilities of the Pentium 4/Xeon processors. Following are some other optimization options.

Intel Compiler Option

Description of Option

-ipo

Multi-file interprocedural analysis.

-unroll[n]

Unroll loops.

-parallel Auto-parallelization using OpenMP

-openmp

Generate OpenMP code in loops that can be parallelized.

GNU gcc, g++

Use the option -O3 for the most aggressive optimization. Following are some additional optimization options.

gcc/g++ Compiler Option

Description of Option

-march=machinetype (i.e., pentium4)

Generate instruction of the machine type (i.e., pentium4).

-ffast-math

Use optimized math functions (this should be used with caution).

-mfpmath=sse

Make use of sse vectorization for math calculations.

-funroll-loops

Unroll loops.

Send questions, corrections, or additional information about these compilers to Susan A. Schwarz

05/07/08

Last Updated: 5/8/08