GCC
To use the GCC compiler the appropriate module file needs to be loaded. GCC is available on Ekman, Ferlin, Povel, and Lindgren.
Ekman, Ferlin, Povel, and Zorn
When you first log onto these machines a version of gcc will be available by default. Which version that is can be seen by using the command
gcc --version
To see which other versions of gcc are installed on the system use the command
module avail gcc
A different version of gcc can then be loaded using for example
module load gcc/4.6.0
To use the various compilers you should use the following commands
- Fortran programs: gfortran
- C programs: gcc
- C++ programs: g++
More information on the commands and the flags used can be found on the various man pages e.g. by typing
man gcc
Lindgren
To order to use the gnu compilers on Lindgren, it is necessary to have the PrgEnv-gnu loaded. When that module is loaded the cc, CC and ftn scripts will automatically use the gnu compiler.
When you log into Lindgren the default PrgEnv is the pgi one, to swap to the Intel PrgEnv use the command
module swap PrgEnv-pgi PrgEnv-gnu
Clearly this command will be different if the PrgEnv currently loaded is not PrgEnv-pgi.
When you first load PrgEnv-gnu the default gcc compiler version will be active. To see which versions of the the gnu compiler are available use
module avail gcc
To use a different version of the compiler you can use for example
module swap gcc/4.5.3 gcc/4.4.4
To check the version of intel compiler, simply type:
cc --version
As stated in the lindgren compiling section the cc, CC and ftn scripts automatically link the different librarys depending on which modules are loaded. FFTW version 2 is a bit more complicted however.
The available drivers (also for linking of MPI applications) are:
- Fortran programs: ftn
- C programs: cc
- C++ programs: CC
Example:
cc -o myprog myprog.c
ftn -o myprog myprog.f
For more information on the flags etc that the compilers take use
man gfortran man gcc


