Difference between revisions of "Compilers"
(Created page with "We have access to several different sets of compilers and libraries. Ideally your code should work with all of them, and you can test which produces the fastest executables. Some...") |
(No difference)
|
Revision as of 17:16, 28 September 2012
We have access to several different sets of compilers and libraries. Ideally your code should work with all of them, and you can test which produces the fastest executables. Some also have different debugging features.
GNU
The GNU toolchain is the standard in the open source world and tends to be the most compatible (at least for C/C++ code). Several versions which ship with the operating system should be available by default and can be invoked as:
gcc #C code g++ #C++ code gfortran #F77, F90
To compile with debug support add at least
-g
to your compile flags. Adding
-g -O0 -fno-omit-frame-pointer -fbounds-check -ftrapv
may make the code easier to debug. See the manpages for language specific options.
To generate an optimized build start with
-O3
and see the manpage for more optional optimizations.
There are also some newer versions available using the softenv tool. Note that if you use a newer GNU toolchain, you should also have it loaded into your environment at runtime to ensure that the correct libraries are used.
Intel
The Intel toolchain typically generates fast executables for Intel processors. It also ships with some debugging and profiling tools. You can load the Intel toolchain by executing:
soft add +intelcompilers-64bit
There are some known issues with debugging Fortran code (particularly if it uses dynamically allocated arrays) using the Intel toolchain.