Child pages
  • Compiling Code
Skip to end of metadata
Go to start of metadata

Compiling and linking code

Compilers

Language

Compiler name

C

blrts_xlc

C++

blrts_xlC

F77

blrts_xlf

F90

blrts_xlf90

F95

blrts_xlf95

  • The system include files are in /bgl/BlueLight/ppcfloor/bglsys/include
  • The mpi and system driver libraries are under /bgl/BlueLight/ppcfloor/bglsys/lib
    • The libraries to link with must be listed in this order: -lmpich.rts -lmsglayer.rts -lrts.rts -ldevices.rts
  • You may also use these scripts in /contrib/bgl/bin to automatically set the include and MPI libraries for you:
    • mpxlc
    • mpxlC
    • mpxlf
    • mpxlf90

(warning) Note that mpicc and mpif77 are available, but they use the GNU gcc compilers, which do not offer the level of performance of the XL compilers. Please use the XL compilers when compiling your codes.

Compiler flags

  • Optimization levels:
    • -O: good place to start, use with -qmaxmem=64000
    • -O2: same as -O
    • -O3 -qstrict: tries more aggressive optimization, while strictly obeying program semantics
    • -O3: aggressive, allows re-association, will replace division by multiplication with the inverse
    • -qhot: turns on high-order transformation module will add vector routines, unless -qhot=novector
      • check listing: -qreport=hotlist
  • start with -g -O -qarch=440 -qmaxmem=64000

Example

  • Here's an example of compiling and linking a simple program:
bash$ blrts_xlc -c example.c -I/bgl/BlueLight/ppcfloor/bglsys/include
bash$ blrts_xlc -o example example.o -I/bgl/BlueLight/ppcfloor/bglsys/include -L/bgl/BlueLight/ppcfloor/bglsys/lib -lmpich.rts -lmsglayer.rts -lrts.rts -ldevices.rts
  • The same compile using mpxlc from /contrib/bgl/bin:
bash$ mpxlc -c example.c
bash$ mpxlc -o example example.o

Note: The compile and link flags are the same for Fortran77/90/95 and C/C++

  • No labels