GNU Compilers (gcc, g++, gfortran)
Overview
The GNU Compiler Collection supports a number of programming languages.
Several versions are available on the zCSF – please see the table below.
Programming in Fortran or C is currently beyond the scope of this webpage. IT Services for Research run training courses which may be of interest.
Restrictions on use
Code may be compiled on the login node, but aside from ‘very’ short test runs (e.g., one minute on fewer than 4 cores), executables must always be run by submitting to the batch system, or run in an interactive session on a backend node.
The GNU compiler is typically used by the Nvidia nvcc
compiler to compile CUDA (host) code.
Set up procedure
This depends on which version you require.
Version | Commands/compilers available | Module required | Additional Notes |
4.4.6 | gcc, gfortran | None | This is considered the system default |
4.8.2 | gcc, gfortran | module load compilers/gcc/4.8.2 |
By loading/swapping modules, the correct LD_LIBRARY_PATH
will be set.
Running the application
Example Code Compilations
gcc hello_world.c -o hello # # ...produces executable binary called "hello"... # gfortran hello_fworld.f77 -o f77hello gfortran hello_fworld.f95 -o f95hello # # ...produce executable binary called "f77hello" or "f95hello"... #
If you compile an application with the non-default version (i.e., you load the gcc modulefile to select a new version) then you must also load that modulefile whenever you run the application.
Further info
- Online manuals available from the command line:
man gcc # for the C/C++ compiler man gfortran # for the fortran compiler
- GNU Compiler Collection website
- Training Courses run by IT Services for Research.
- If you require advice on programming matters, for example how to debug a code, or how to use MKL, please email its-ri-team@manchester.ac.uk
Updates
None