Building with xlc compiler

NumPy

We currently do not know how to build NumPy with xlc on BG/P.

GPAW

A performance improvement of 25% has been observed using xlc over gcc for medium-size systems where DGEMM does not dominate the wall-clock time. For large-systems, NBANDS > 5000, there is is little performance improvement since DGEMM makes up a large fraction of the wall-clock time.

Proceed as in the Building with gcc compiler, but use the following bgp_xlc.py file:

#!/usr/bin/env python
"""bgp_xlc.py is a wrapper for the BGP xlc compiler,
   converting/removing incompatible gcc args.   """
from __future__ import print_function
import sys
from subprocess import call
from glob import glob

args2change = {"-fno-strict-aliasing":"",
               "-fmessage-length=0":"",
               "-Wall":"",
               "-std=c99":"-qlanglvl=extc99",
               "-fPIC":"",
               "-g":"",
               "-D_FORTIFY_SOURCE=2":"",
               "-DNDEBUG":"",
               "-UNDEBUG":"",
               "-pthread":"",
               "-shared":"-qmkshrobj",
               "-Xlinker":"",
               "-export-dynamic":"",
               "-Wstrict-prototypes":"",
               "-dynamic":"",
               "-O3":"",
               "-O2":"",
               "-O1":"",
               "-fwrapv":""}

fragile_files = ["test.c"]
qhot_files = ["c/blas.c", "c/utilities.c","c/lfc.c","c/localized_functions.c"]
non_c99files = glob('c/libxc/src/*.c')

cmd = ""
opt = 1

for arg in sys.argv[1:]:
    cmd += " "
    t = arg.strip()
    if t in fragile_files:
        opt = 2
    if t in non_c99files:
        opt = 3
    if t in qhot_files:
        opt = 4
    if t in args2change:
        cmd += args2change[t]
    else:
        cmd += arg

flags_list = {1: "-g -O3 -qlanglvl=extc99 -qflag=w:w -qpic",
              2: "-g -O3 -qstrict -qlanglvl=extc99 -qflag=w:w -qpic",
              3: "-g -O3 -qflag=w:w -qpic",
              4: "-g -O3 -qhot -qlanglvl=extc99 -qflag=w:w -qpic",
              }

flags = flags_list[opt]  
# make sure this matches the version of the XL compiler in bgp_xlc_linker.py
# as well as the libraries in customize_surveyor_xlc.py
cmd = "mpixlc_r %s %s"%(flags, cmd)

print("\nexecmd: %s\n"%cmd)
call(cmd, shell=True)

Finally, change the lines in customize_surveyor_gcc.py accordingly:

mpicompiler = "bgp_xlc.py"
compiler = "bgp_xlc.py"
mpilinker = "bgp_xlc_linker.py"

Everything else should be the same.