Build CP2K using Intel Fortran compiler Professional Edition

Submit New Article

Last Modified On :   November 3, 2009 5:56 PM PST
Rate
 



Introduction :

CP2K (http://cp2k.berlios.de/) is a freely available (GPL) program, written in Fortran 95, to perform atomistic and molecular simulations of solid state, liquid, molecular and biological systems. It provides a general framework for different methods such as e.g. density functional theory (DFT) using a mixed Gaussian and plane waves approach (GPW), and classical pair and many-body potentials.


Version :

1.02


Obtaining Source Code :

CP2K version 2.0.1, nightly snapshot sources from ftp://ftp.berlios.de/pub/cp2k/cp2k.tar.gz, build date 2009-05-25


Prerequisites :

CP2K requires that you already have installed the Fortran compiler, math library with FFTW 2.x/3.x support.  We suggest using both Intel Fortran compiler and Intel Math Kernel Library for better performance.


Configuration Set Up :


n/a


Source Code Changes :

n/a


Building the Application :

Here we show the detail on how to build the CP2K source with Intel Fortran compiler Professional Edition for Intel 64-bit platform.

Please follow the steps listing below:.

1) Download and install Intel Fortran compiler Professional Edition version 11.0.083 or 11.1.059.
Make sure you select to install both Intel Fortran compiler and Intel Math Kernel Library (MKL).
The default installation directory is /opt/intel/Compiler/11.0/083 or /opt/intel/Compiler/11.1/059.

2) Build FFTW version 3.x wrappers library for Intel MKL Library
The source code for the wrappers and makefiles with the wrapper list files for Fortran are located in the \interfaces\fftw3xf sub-directories in the Intel MKL directory.  Please use Intel C++ compiler (or GCC) to generate the wrappers library (libffw3xf_intel.a, or libfftw3xf_gnu.a):

] cd /opt/intel/Compiler/11.0/083/mkl/interfaces/fftw3xf
] make libem64t compiler=intel (or make libem64t compiler=gnu)

3) Untar the CP2K.tar.gz, and modify configuration file “Linux-x86-64-intel.sopt” in cp2k/arch directory, which is targeting for Intel 64 platform.  

Here is an example of Linux-x86-64-intel.sopt for reference:

INTEL_MKL = /opt/intel/Compiler/11.0/083/mkl
INTEL_INC = $(INTEL_MKL)/include/fftw
INTEL_LIB = $(INTEL_MKL)/lib/em64t

FC = ifort
LD = ifort
AR = xiar -r

DFLAGS = -D__INTEL -D__FFTSG -D__FFTW3 -D__FFTMKL
CPPFLAGS = -C -traditional $(DFLAGS) -I$(INTEL_INC)
FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -O2 -xHost -openmp -heap-arrays 64 -fpp -free
LDFLAGS = $(FCFLAGS)
LIBS = -L$(INTEL_LIB) -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lfftw3xf_intel

OBJECTS_ARCHITECTURE = machine_intel.o

4) Setup the environment of Intel Fortran compiler, then build CP2K source:

] source /opt/intel/Compiler/11.0/083/bin/ifortvars.sh intel64
] cd cp2k/makefiles/
] make ARCH=Linux-x86-64-intel VERSION=sopt



Running the Application :

CP2K provide several test cases, which can be used for stability testing and verify the results to see if the compilation is correct.

] cd cp2k/tests/QS
] ./../../exe/Linux-x86-64-intel/cp2k.sopt H2O-32.inp
] ./../../exe/Linux-x86-64-intel/cp2k.sopt H2O-3x3.inp



Known Issues or Limitations :

1) For version 11.0

Currently we find only one source file “graphcon.F” in CP2K source can not pass compilation, if you set –O2 or above option with Intel Fortran compiler 11.0.083.

You could manually recompile this file with –O1 option again, then rerun the make script to resolve this issue.

] cd cp2k/obj/Linux-x86-64-intel/sopt
] ifort -c -D__INTEL -D__FFTSG -D__FFTW3 -D__FFTMKL -I/opt/intel/Compiler/11.0/083/mkl/include/fftw/ -O1 -xHost -heap-arrays 64 -fpp -free -D__COMPILE_ARCH="\"Linux-x86-64-intel\"" ../../../src/graphcon.F
] cd ../../../makefiles/
] make ARCH=Linux-x86-64-intel VERSION=sopt

You could also add the following lines in Linux-x86-64-intel.sopt to avoid this problem:

FCFLAGS2 = $(DFLAGS) -I$(INTEL_INC) -O1 -xW -heap-arrays 64 -fpp -free

graphcon.o: graphcon.F
$(FC) -c $(FCFLAGS2) $<

2) For version 11.1

The new Intel Fortran compiler 11.1 update 3 (version 11.1.059) have fixed all issues we found, with option '-O2 -xHost -openmp'. 





This article applies to: Intel® Fortran Compiler for Linux* Knowledge Base,   Intel® Math Kernel Library Knowledge Base