Compiling and Linking

A thorough discussion of compiling your code for the BG/P system is too complex to cover in this document. What follows is a brief summary. All compile/link procedures are performed on login nodes with a cross-compilation technique. Because it is cross-compiled, the resulting executable is for the BG/P only and will not run on a login computer.

The preferred way to compile and link an application is to use the predefined mpi-wrappers:

      mpixlc, mpixlcxx, mpixlf77, mpixlf90, mpixlf95                            (XL non thread-safe versions)

      mpixlc_r,  mpixlcxx_r,  mpixlf77_r,  mpixlf90_r,  mpixlf95_r        (XL thread-safe versions)

      mpicc,  mpicxx, mpif77       (GNU compilers)

Examples to compile/link a hello.c C-source program, hello.cc C++ source program, and hello.f Fortran source program into a hello executable with default compiler options are provided below.

mpixlc -O -qarch=450d -qtune=450 -o hello hello.c
mpixlcxx -O -qarch=450d -qtune=450 -o hello hello.cc
mpixlf77 -O -qarch=450d -qtune=450 o hello hello.f

The scripts will invoke the compiler, set up required environment variables, and include directories and necessary MPI libraries. The scripts with the *_r suffix do the same except they invoke thread-safe libraries and generate thread-safe object files.

For a user who wants to keep full control of the compilation/linking process, the non-wrapped IBM XL compilers may be accessed via

       bgxlc, bgxlC, bgf77, bgf90, bgf95     (likewise, add _r suffix for thread-safe versions)

Keep in mind that the names of BG/P compilers always start with the 'bg' prefix: bgxlc, bgxlC, bgxlf. The compilers without the bg prefix are intended for a login node and should be used only for syntax verification.   Note:  if you use the non-wrapped compiler invocation, you will need to explicitly list all required system libraries.

To run your compiled application, you will need to submit the job to the resource manager and scheduler. Generally, 64 node partitions (the smallest BG/P partition) are available for use at any time except during reservations.

For additional info on selecting a particular compiler version, please see How do I select XL Compiler versions.