Skip to content

Building the Software

Ben Baker edited this page Aug 10, 2018 · 24 revisions

Building

Before continuing, understand that the code is intended to run on Intel hardware. The code should compile on AMD and Power8 x86_64 processors but run sub-optimally. It likely the algorithm would realize a performance boost with coprocessors. However, the task of porting to a GPU is daunting and I'll only do this if there is sufficient interest.

Prerequisites

To build it is required that one have

To build the fully parallel software one must additionally obtain

  • Message Passing Interface v3. Recommended free versions are MPICH and OpenMPI. The Fortran 2008 bindings must be available.
  • Python3 and ctypes.

Downloading the Software

In the directory of your choosing the software and documentation can be obtained by specifying

git clone https://github.com/bakerb845/xcloc.git
cd xcloc
git clone https://github.com/bakerb845/xcloc.wiki.git

Configuring CMake

I find that the most efficient way to configure CMake is with a script. Here, multiple examples scripts are presented that, ideally, can be modified to match the details of your system.

Serial GCC Build

In this section the simplest example of compiling with GCC and without MPI is presented. This may be useful for experimentation purposes.

#!/bin/sh
export CC=gcc
export FC=gfortran
export MKL_LIB_ROOT=/opt/intel/mkl/lib/intel64
export IPP_LIB_ROOT=/opt/intel/ipp/lib/intel64
if [ -f Makefile ]; then
   echo "Cleaning..."
   make clean
fi
if [ -f CMakeCache.txt ]; then
   echo "Removing CMakeCache.txt"
   rm CMakeCache.txt
fi
if [ -d CMakeFiles ]; then
   echo "Removing CMakeFiles"
   rm -rf CMakeFiles
fi
cmake \
-DCMAKE_INSTALL_PREFIX=./ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_C_FLAGS="-g -O2 -fopenmp -Wall -std=c11" \
-DCMAKE_Fortran_FLAGS="-g -O2 -fopenmp -fbounds-check -Wall -m64" \
-DMKL_INCLUDE_DIR=/opt/intel/mkl/include \
-DMKL_LIBRARY="-Wl,--start-group ${MKL_LIB_ROOT}/libmkl_gf_lp64.a ${MKL_LIB_ROOT}/libmkl_sequential.a ${MKL_LIB_ROOT}/libmkl_core.a -Wl,--end-group" \
-DIPP_INCLUDE_DIR=/opt/intel/ipp/include \
-DIPP_LIBRARY="${IPP_LIB_ROOT}/libipps.so;${IPP_LIB_ROOT}/libippvm.so;${IPP_LIB_ROOT}/libippcore.so" \
-DH5_C_INCLUDE_DIR=/home/bakerb25/C/hdf5-1.10.1_intel/include \
-DH5_LIBRARY=/home/bakerb25/C/hdf5-1.10.1_intel/lib/libhdf5.so \
-DXML2_INCLUDE_DIR=/usr/include/libxml2 \
-DXML2_LIBRARY=/usr/lib/x86_64-linux-gnu/libxml2.so \
-DINIPARSER_INCLUDE_DIR=/home/bakerb25/C/iniparser/src \
-DINIPARSER_LIBRARY=/home/bakerb25/C/iniparser/libiniparser.so.1 \
-DADVISOR_INCLUDE_DIR=/opt/intel/advisor/include

MPI and Configuring With GNU Compilers

In this section OpenMPI is introduced to the build. It is important to observed that the XCLOC_USE_MPI flag must be toggled.

#!/bin/sh
export CC=gcc
export FC=gfortran
export MKL_LIB_ROOT=/opt/intel/mkl/lib/intel64
export IPP_LIB_ROOT=/opt/intel/ipp/lib/intel64
if [ -f Makefile ]; then
   make clean
fi
if [ -f CMakeCache.txt ]; then
   echo "Removing CMakeCache.txt"
   rm CMakeCache.txt
fi
if [ -d CMakeFiles ]; then
   echo "Removing CMakeFiles"
   rm -rf CMakeFiles
fi
cmake ./ \
-DCMAKE_INSTALL_PREFIX=./ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_Fortran_COMPILER=gfortran \
-DCMAKE_C_FLAGS="-g -O2 -fopenmp -Wall -std=c11" \
-DCMAKE_Fortran_FLAGS="-g -O2 -fopenmp -fbounds-check -Wall -m64" \
-DXCLOC_USE_MPI=TRUE \
-DMKL_INCLUDE_DIR=/opt/intel/mkl/include \
-DMKL_LIBRARY="-Wl,--start-group ${MKL_LIB_ROOT}/libmkl_gf_lp64.a ${MKL_LIB_ROOT}/libmkl_sequential.a ${MKL_LIB_ROOT}/libmkl_core.a -Wl,--end-group" \
-DIPP_INCLUDE_DIR=/opt/intel/ipp/include \
-DIPP_LIBRARY="${IPP_LIB_ROOT}/libipps.so;${IPP_LIB_ROOT}/libippvm.so;${IPP_LIB_ROOT}/libippcore.so" \
-DMPI_C_INCLUDE_PATH=/opt/intel/impi/2018.0.128/include64 \
-DMPI_Fortran_INCLUDE_PATH=/home/bakerb25/C/openmpi-3.0.2/lib/ \
-DMPI_C_LIBRARIES="/home/bakerb25/C/openmpi-3.0.2/lib//libmpi.so" \
-DMPI_Fortran_LIBRARIES="/home/bakerb25/C/openmpi-3.0.2/lib/libmpi_usempif08.so" \
-DH5_C_INCLUDE_DIR=/home/bakerb25/C/hdf5-1.10.1_intel/include \
-DH5_LIBRARY=/home/bakerb25/C/hdf5-1.10.1_intel/lib/libhdf5.so \
-DXML2_INCLUDE_DIR=/usr/include/libxml2 \
-DXML2_LIBRARY=/usr/lib/x86_64-linux-gnu/libxml2.so \
-DINIPARSER_INCLUDE_DIR=/home/bakerb25/C/iniparser/src \
-DINIPARSER_LIBRARY=/home/bakerb25/C/iniparser/libiniparser.so.1

Configuring With the Intel Compilers

In this section an example configuration script using the Intel compiler suite is used. Commercial compilers, particularly with respect to Fortran, can squeeze a little more performance out of hardware.

#!/bin/sh
export CC=/opt/intel/bin/icc
export FC=/opt/intel/bin/ifort
export F90=/opt/intel/bin/ifort
export MKL_LIB_ROOT=/opt/intel/mkl/lib/intel64
export IPP_LIB_ROOT=/opt/intel/ipp/lib/intel64
if [ -f Makefile]; then
   make clean
fi
if [ -f CMakeCache.txt ]; then
   echo "Removing CMakeCache.txt"
   rm CMakeCache.txt
fi
if [ -d CMakeFiles ]; then
   echo "Removing CMakeFiles"
   rm -rf CMakeFiles
fi
cmake ./ \
-DCMAKE_INSTALL_PREFIX=./ \
-DCMAKE_C_COMPILER=icc \
-DCMAKE_Fortran_COMPILER=ifort \
-DCMAKE_C_FLAGS="-g -O2 -xCORE-AVX2 -std=c11 -qopenmp -Wall -Wcomment -Wunused -Wcheck -qopt-report=5" \
-DCMAKE_Fortran_FLAGS="-g -O2 -qopenmp -W 1 -warn unused -align array64byte -qopt-report=4 -xHOST -nofor-main" \
-DXCLOC_USE_MPI=TRUE \
-DXCLOC_USE_INTEL=TRUE \
-DXCLOC_PROFILE=TRUE \
-DMKL_INCLUDE_DIR=/opt/intel/mkl/include \
-DMKL_LIBRARY="${MKL_LIB_ROOT}/libmkl_intel_lp64.so;${MKL_LIB_ROOT}/libmkl_sequential.so;${MKL_LIB_ROOT}/libmkl_core.so;${MKL_LIB_ROOT}/libmkl_vml_avx2.so;${MKL_LIB_ROOT}/libmkl_avx2.so" \
-DIPP_INCLUDE_DIR=/opt/intel/ipp/include \
-DIPP_LIBRARY="${IPP_LIB_ROOT}/libipps.so;${IPP_LIB_ROOT}/libippvm.so;${IPP_LIB_ROOT}/libippcore.so" \
-DMPI_C_INCLUDE_PATH=/opt/intel/impi/2018.0.128/include64 \
-DMPI_C_LIBRARIES="/opt/intel/impi/2018.0.128/lib64/libmpi.so" \
-DMPI_Fortran_INCLUDE_PATH=/opt/intel/impi/2018.1.163/include64 \
-DMPI_Fortran_LIBRARIES="/opt/intel/impi/2018.0.128/lib64/libmpifort.so" \
-DH5_C_INCLUDE_DIR=/home/bakerb25/C/hdf5-1.10.1_intel/include \
-DH5_LIBRARY=/home/bakerb25/C/hdf5-1.10.1_intel/lib/libhdf5.so \
-DSACIO_INCLUDE_DIR=/home/bakerb25/C/sacio/include \
-DSACIO_LIBRARY=/home/bakerb25/C/sacio/lib/libsacio_shared.so \
-DXML2_INCLUDE_DIR=/usr/include/libxml2 \
-DXML2_LIBRARY=/usr/lib/x86_64-linux-gnu/libxml2.so \
-DINIPARSER_INCLUDE_DIR=/home/bakerb25/C/iniparser/src \
-DINIPARSER_LIBRARY=/home/bakerb25/C/iniparser/libiniparser.so.1 \
-DADVISOR_INCLUDE_DIR=/opt/intel/advisor/include

Building

After CMake has been successfully configured one then simply types

make

in the root source directory to build the software. To install the software one then types

make install

in the root source directory.

Building the Developer Level Documentation

If Doxygen is available then the developer level documentation can be built by specifying

doxygen Doxyfile

in the root source directory.

Clone this wiki locally