-
Notifications
You must be signed in to change notification settings - Fork 10
Compilation Help
Contents
On this page we go into detail about the compilation procedure for NTPoly.
Building NTPoly requires the following software:
- CMake
- SWIG (optional)
- Python 2.7+ (optional)
CMake is used for the build system. SWIG is used to expose an interface to languages other than Fortran, C, and C++. Python is used for testing NTPoly. SWIG is required to run the python tests, so it is definitely encouraged.
Here we will go into detail about building for a few sample systems.
Our group maintains a cluster that uses the intel compilers. Here is a look at the configuration options.
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_Fortran_COMPILER mpiifort)
set(CMAKE_C_COMPILER mpiicc)
set(CMAKE_CXX_COMPILER mpiicpc)
set(CXX_TOOLCHAINFLAGS "-openmp -lgomp")
set(F_TOOLCHAINFLAGS "-check bounds -O0 -fpp -qopenmp")
Fortunately, in this case things aren't so difficult. We specify that it's a
linux machine. We specify the MPI wrappers for C, C++, and Fortran. After
the compilers are set, we set the compiler options. Here we have some debugging
settings like -check bounds
and -O0
. -fpp
is needed to use the
Fortran preprocessor, and -qopenmp
for openmp parallelization.
This isn't pretty. Here we go.
set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_C_COMPILER mpicc)
set(CMAKE_Fortran_COMPILER mpif90)
set(CMAKE_CXX_COMPILER mpicxx)
set(Python_FRAMEWORKS /usr/local/Frameworks/Python.framework)
set(PYTHON_INCLUDE_DIRS /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Headers)
set(PYTHON_INCLUDE_PATH /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Headers /usr/local/lib/python2.7/site-packages/mpi4py/include)
set(PYTHON_LIBRARIES /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib)
set(CXX_TOOLCHAINFLAGS "-openmp -lgomp")
set(F_TOOLCHAINFLAGS "-fbounds-check -O0 -cpp -fopenmp")
Unfortunately, the flavor of python that comes with the Mac doesn't have all the features we want. The solution is to install a newer version using the brew package manager. However, CMake gets very confused by all these versions of python sitting around, so we have to manually specify a lot.
The flags are similar to the intel case.
Now for the K computer.
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER mpifccpx)
set(CMAKE_Fortran_COMPILER mpifrtpx)
set(CMAKE_CXX_COMPILER mpiFCCpx)
set(CXX_TOOLCHAINFLAGS "-Kfast,-Kparallel,openmp,optmsg=2 --linkfortran")
set(F_TOOLCHAINFLAGS "-Kfast,-Kparallel,openmp,optmsg=2 -Cpp")
set(PYTHON_INCLUDE_PATH "/path/to/home/include/python2.7")
The compiler wrappers are supplied by Fujitsu. In this case, we show optimized
flags such as -Kfast
. -Cpp
is for the preprocessor, and --linkfortran
is necessary to call Fortran from C++. I had to install my own version of
python locally.