The National Institute for Computational Sciences

Compiling

Compiling

Beacon has C/C++ and Fortran compilers from GNU, Intel, and CAPS. However, only the Intel compilers can take full advantage of the Intel Xeon Phi coprocessors, unless you are using OpenACC and having the CAPS compiler convert it to OpenCL code.  Additionally, only the Intel MPI library fully supports the Intel Xeon Phi coprocessors.  As such, the module for the Intel programming is loaded by default.

One should note that spurious warnings will be given by the Intel 2015.0.024 compiler in offload mode, as it will try the mic libraries first before compiling correctly with the intel64 libraries. Also, since module files have been consolidated, you may see spurious warnings if any compiler tries the mic or intel64 libraries first before finding the correct ones for your chosen mode. Here is an example, so you know to ignore this:

  • x86_64-k1om-linux-ld: warning: libimf.so, needed by /global/opt/intel/composer_xe_2015.0.024/compiler/lib/mic/liboffload.so.5, not found (try using -rpath or -rpath-link)
  • x86_64-k1om-linux-ld: warning: libsvml.so, needed by /global/opt/intel/composer_xe_2015.0.024/compiler/lib/mic/liboffload.so.5, not found (try using -rpath or -rpath-link)
  • x86_64-k1om-linux-ld: warning: libirng.so, needed by /global/opt/intel/composer_xe_2015.0.024/compiler/lib/mic/liboffload.so.5, not found (try using -rpath or -rpath-link)
  • x86_64-k1om-linux-ld: warning: libintlc.so.5, needed by /global/opt/intel/composer_xe_2015.0.024/compiler/lib/mic/liboffload.so.5, not found (try using -rpath or -rpath-link)

Also, here is a helpful link for linking MKL with Fortran: Compiling the Intel® Math Kernel Library on the Intel® Xeon Phi™ Coprocessor using Fortran


  GNU Intel
C gcc icc/mpiicc
C++ g++ icpc/mpiicpc
Fortran gfortran ifort/mpiifort

To use the CAPS compilers for OpenACC, you need to do "module load CAPS" and set the following environment variables:

export OPENCL_INC_PATH=/global/opt/intel/opencl/include/


export HMPPRT_NO_FALLBACK=1


export ACC_DEVICE_TYPE=acc_device_opencl

export HMPPRT_OPENCL_DEVICE_TYPE=CL_DEVICE_TYPE_ACCELERATOR

Now, compile your code:

capsmc --openacc-target=OPENCL icpc acctest.cpp -o ACC

Finally, submit an interactive job and set these two environment variables:

export HMPPRT_OPENCL_DEVICE_TYPE=CL_DEVICE_TYPE_ACCELERATOR

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/global/opt/intel/opencl/lib64

To run your code, simply execute ./ACC and be sure the the openCL codelet is in the same directory as your executable, as it will be sent over to the Xeon Phi.

**Note that when cross compiling a native mode application/library using configure, the following flag must be used --host=x86_64-k1om-linux

Back to Contents