Details
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 |
gfortran |
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 Group |
|
.c |
icc |
Intel |
|
.c |
g++ |
GNU |
- 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. gfortran is the Fortran GNU 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 do a good job of compiling code to make use of the architectural features of the Intel processors.
Here is a table of frequently used compiler flags, common to the above compilers.
COMPILER |
WHAT THE OPTION DOES |
-c |
Produce an object file only. |
-o filename
|
Create an executable called filename (default is a.out
). |
-O {0, 1, 2, 3}
|
Specify the optimization level ( 0 is none and 3 is most aggressive). |
-g |
Include a symbol table, needed for debugging. |
-pg |
Generate profiling code. |
-l |
Look for include files in this directory (default include directory is /usr/include
). |
-L |
Look for libraries in this directory (default library directory: /lib, /usr/lib/usr/lib64
). |
-l archive
|
Link in a library called librahive.so (or .a). |
-static |
Link only with static libraries (compilers use shared libraries by default). |
For more options and detailed information, consult man pages (e.g., man gcc
). Send questions, corrections, or additional information about these compilers to Research.Computing@dartmouth.edu
.