Compiler Flags

  • Typical C compilation command line:

    • gcc matmulc.c fill.c -O3 -lm -o matmulc

  • Typical Fortran compilation command line:

    • pgf95 mm.f fill.f matrix_multiply.f -fast -o mm_pgf_fast

  • Some commonly used flags (type "man compiler_name" for more)

    • -o filename - specify name of executable

    • -c - request compilation without linking

    • -I directory - specify directory in which to find include files

    • -L directory - specify directory in which to find library files

    • -lm - link with math library

  • Flags to facilitate development and debugging

    • -Wall - turn on warnings

    • -check bounds - array bounds checking

    • -g - add debugging symbols to output file (for use by debugger later)

    • -fpe0 - Cause program to quit when a floating point exception occurs

  • Portability options

    • -extend_source - allow fixed format Fortran to extend beyond 72 columns

    • -assume byterecl - record lengths to be specified in bytes rather than 4-byte words

    • -std=c99 - Enable c99 support

  • Optimization

    • -fast - combines several common optimization options

    • -O3 - request a fairly high level of optimization (some compilers go to -O5)

    • There are numerous other compiler and platform-specific options.

  • Performance profiling

    • -pg - adds timing code, for post-processing with gprof

Last modified: 2007-11-07

Direct questions to .