| March 29, 2009 8:00 AM PDT | |
CP2K (http://cp2k.berlios.de/) is a freely available (GPL) program, written in Fortran, 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.08
Obtaining Source Code :
CP2K stable version
- the cp2k-2_1-branch: ftp://ftp.berlios.de/pub/cp2k/cp2k-2_1-branch.tar.gz
- the cp2k-2_2-branch: ftp://ftp.berlios.de/pub/cp2k/cp2k-2_2-branch.tar.gz
CP2K development version
- (nightly snapshot): ftp://ftp.berlios.de/pub/cp2k/cp2k.tar.gz
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 for Intel 64 platform.
Part I. Intel Fortran Composer XE 2011
1) Download and install Intel Fortran Composer XE 2011 (first release version 2011.0.084).
Make sure you select to install both Intel Fortran compiler and Intel Math Kernel Library (MKL). The default installation directory is /opt/intel/composerxe-2011/ .
2) Build FFTW version 3.x wrappers library for Intel MKL Library
From Intel MKL version 10.2 and later, FFTW3 interface for Intel Fortran compiler is pre-built and ntegrated in Intel MKL core libraries. See http://software.intel.com/en-us/articles/intel-mkl-main-libraries-contain-fftw3-interfaces/.
Source code is still available to create wrappers for use with other compilers. Here is example to build Fortran version by gnu compiler.
] cd /opt/intel/composerxe-2011/mkl/interfaces/fftw3xf
] make libintel64 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/composerxe-2011/mklNotice: The options (-O2 -xHost) are available for both Intel® and non-Intel microprocessors but it may result in more optimizations for Intel microprocessors than for non-Intel microprocessors.
INTEL_INC = $(INTEL_MKL)/include/fftw
INTEL_LIB = $(INTEL_MKL)/lib/intel64
LIBINT_PATH = /usr/lib/libint-1.1.4
LIBINT_LIB = $(LIBINT_PATH)/lib/libderiv.a $(LIBINT_PATH)/lib/libint.a -lstdc++
FC = ifort
LD = ifort
AR = xiar -r
DFLAGS = -D__INTEL -D__FFTSG -D__FFTW3 -D__FFTMKL -D__LIBINT
CPPFLAGS = -C -traditional $(DFLAGS) -I$(INTEL_INC)
FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -O2 -xHost -heap-arrays 64 -fpp -free
LDFLAGS = $(FCFLAGS)
#LIBS = -mkl
LIBS = -L$(INTEL_LIB) -mkl $(LIBINT_LIB)
OBJECTS_ARCHITECTURE = machine_intel.o
4) Setup the environment of Intel Fortran compiler, then build CP2K source:
] source /opt/intel/composerxe-2011/bin/compilervars.sh intel64
] cd cp2k/makefiles/
] make ARCH=Linux-x86-64-intel VERSION=sopt
Part II. Intel Fortran Compiler Professional Edition (version 11.0 / 11.1)
Please follow the steps listing below:.
1) Download and install Intel Fortran compiler Professional Edition version.
Make sure you select to install both Intel Fortran compiler and Intel Math Kernel Library (MKL). For example, the default installation directory is under /opt/intel/Compiler/11.0/083 or /opt/intel/Compiler/11.1/072.
2) Build FFTW version 3.x wrappers library for Intel MKL Library
Note: Please skip this step if you are using Intel Fortran compiler version 11.1, or Intel MKL libraries version 10.2 and later.
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/mklNotice: The options (-O2 -xHost) are available for both Intel® and non-Intel microprocessors but it may result in more optimizations for Intel microprocessors than for non-Intel microprocessors.
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 -heap-arrays 64 -fpp -free
LDFLAGS = $(FCFLAGS)
# If you are using ifort verison 11.1 with MKL version 10.2 and later, Intel MKL libraries and FFTW interfaces will be linked automatically with -mkl option
# LIBS = -L$(INTEL_LIB) -mkl
LIBS = -L$(INTEL_LIB) -lfftw3xf_intel -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
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 CP2K version 2.1 branch
We recommended to use Intel Fortran Compiler version 11.1 update 6 (version 11.1.072) or later version.
If you want to use new Intel Fortran Composer XE 2011 (aka version 12.0), we suggest that one source file "qs_vxc_atom.F" should be compiled with -O1 option only. You could add the following lines into Linux-x86-64-intel.sopt to avoid this problem:
FCFLAGS2 = -I$(INTEL_INC) -O1 -xHost -heap-arrays 64 -fpp -free $(DFLAGS)
qs_vxc_atom.o: qs_vxc_atom.F
$(FC) -c $(FCFLAGS2) $<
2) For CP2K version 2.2 branch
Suggested to use the Intel Fortran compiler 11.1 update 6 and later version.
There are some known issues with new Composer XE 2011 (ifort version 12.x.xxx). Please use the XE 2011 update 8 and future version, also apply the following patches in configuration file "Linux-x86-64-intel.sopt":
FCFLAGS2 = -I$(INTEL_INC) -O1 -xHost -heap-arrays 64 -fpp -free $(DFLAGS)
et_coupling.o: et_coupling.F
$(FC) -c $(FCFLAGS2) $<
qs_vxc_atom.o: qs_vxc_atom.F
$(FC) -c $(FCFLAGS2) $<
<end>
- DPD200161616
- DPD200172602
| Optimization Notice |
|---|
|
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 |
This article applies to: Intel® Fortran Compiler for Linux* Knowledge Base, Intel® Math Kernel Library Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (22) 
| June 3, 2009 9:20 PM PDT
wsl
| Thank you - compiles seamlessly on Dell T3500 w/Xeon W3503. |
| June 16, 2009 5:51 AM PDT
John J. Low |
This makefile worked on my HP pavillon a Pentium Dual-Core CPU E5200@2.5 Ghz running Fedora core 10. Thanks. |
| June 23, 2009 11:34 PM PDT
Hao Jiang (Intel)
|
If you want to enable '-openmp' option, please modify the following line in 'Linux-x86-64-intel.sopt': FCFLAGS = $(DFLAGS) -I$(INTEL_INC) -O2 -xHost -openmp -heap-arrays 64 -fpp -free Note: need to disable 'openmp' on two source files: 'hartree_local_2centers.F' and 'qs_rho0_ggrid.F'. We are working on fix them in version 11.1 update. |
| June 30, 2009 8:19 PM PDT
John J. Low |
Intel Fortran 11.1 fails to compile c2pk on my SGI Altix 350. 11.0 works fine. I have also seen many small errors when I run ~/cp2k/tools/do_regtest when I link mkl 10.0.3.020. Almost all of these errors (only one left) when I link to mkl 10.2.0.013. |
| June 30, 2009 10:22 PM PDT
Hao Jiang (Intel)
| Yes, there are some issues with the first 11.1 release (11.1.038). I can not find the easy workaround at this time. |
| July 4, 2009 8:50 AM PDT
achimb | Did you make and test also the parallel version? |
| July 9, 2009 2:46 PM PDT
John J. Low |
I got the parallel version to compile and pass the regtests on a HP RX5670. I can get the parallel version to compile on my Altix. I can not get the parallel version to pass all the regtests on my Altix. |
| September 16, 2009 10:34 PM PDT
Hao Jiang (Intel)
|
11.1 update 2 (11.1.056) fixed most issues I found, except for one source file 'orbital_transformation_matrices.F' ]$ ifort -c -D__INTEL -D__FFTSG -D__FFTW3 -D__FFTMKL -I"$INCL_DIR" -O1 -openmp -heap-arrays 64 -fpp -free -D__COMPILE_ARCH=""$ARCH"" "$CP2K_DIR"/cp2k/src/orbital_transformation_matrices.F |
| November 3, 2009 5:00 PM PST
Hao Jiang (Intel)
| ifort 11.1 update 3 (11.1.059) works well with '-O2 -xHost -openmp -heap-arrays 64 -fpp -free' on my systems. |
| May 5, 2010 8:37 AM PDT
Anne Shelton |
When I run this test cd cp2k/tests/QS ] ./../../exe/Linux-x86-64-intel/cp2k.sopt H2O-32.inp I am getting *** 11:16:13 ERRORL2 in cp_fm_cholesky:cp_fm_cholesky_decompose processor *** I am using ifort 11.1.069 [as845383@pauling QS]$ ldd /opt/cp2k/exe/Linux-x86-64-intel/cp2k.sopt libmkl_intel_lp64.so => /opt/intel/mkl/10.2.4.032/lib/em64t/libmkl_intel_lp64.so (0x00002ae74e810000) libmkl_sequential.so => /opt/intel/mkl/10.2.4.032/lib/em64t/libmkl_sequential.so (0x00002ae74ec0a000) libmkl_core.so => /opt/intel/mkl/10.2.4.032/lib/em64t/libmkl_core.so (0x00002ae74f382000) libm.so.6 => /lib64/libm.so.6 (0x0000003a1e400000) libiomp5.so => /opt/intel/mkl/10.2.4.032/lib/em64t/libiomp5.so (0x00002ae74f75f000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003a1e800000) libc.so.6 => /lib64/libc.so.6 (0x0000003a1dc00000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003a2be00000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003a1e000000) /lib64/ld-linux-x86-64.so.2 (0x0000003a1d800000) |
| July 13, 2010 2:52 AM PDT
Hao Jiang (Intel)
|
Hi, Anne What version of CP2K you have used ? version 2.1.xxx is recommended to use Intel Fortran compiler 11.1 update 6 (version 11.1.072). Please let us know if you still have problems with that ifort verison. |
| September 30, 2010 10:49 AM PDT
mecej4
|
I successfully compiled CP2K version 2.1.390 (Development Version) using l_cprof_p_11.1.073 on Suse-Linux-X64 11.3. I found it necessary to list the FFTW library before the MKL libraries, as follows in the file Linux-x86-64-intel.sopt. LIBS = -L$(INTEL_LIB) -lfftw3xf_intel -lmkl_intel_lp64 -lmkl_sequential -lmkl_core |
| October 7, 2010 6:43 PM PDT
Hao Jiang (Intel)
| Thanks for your update, mecej4. Welocome to report any issue you find and share with us. |
| March 2, 2011 9:04 PM PST
Joonho Park |
I got error in ifort v 12.0.2.137 /home/joonho/cp2k/makefiles/../lib/Linux-x86-64-intel/sopt/libcp2 k_fft_lib.a(fftacml_lib.o): In function `fftacml3d_': /home/joonho/cp2k/makefiles/../src/lib/fftacml_lib.F:(.text+0xbe0 ): undefined reference to `zfft3dx_' /home/joonho/cp2k/makefiles/../src/lib/fftacml_lib.F:(.text+0xc50 ): undefined reference to `zfft3dx_' |
| April 11, 2011 9:33 AM PDT
Roger |
Can you indicate me how to compile cp2k with libint? I always get segmentation errors at the stage where HFX_MEM_INFO would be printed out: forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source cp2k.popt 0000000001321BCE Unknown Unknown Unknown ... Usually, it does not happen with gfortran. Does ifort really not support ISO_C_BINDINGS? Thanks! |
| April 12, 2011 8:22 AM PDT
Roger | I was able to compile cp2k with libint and calculating with hybrid functionals without getting seg faults. One simply has to remove -xHost from FCFLAGS. I'll try to find out which source file actually is responsible for the problem, therefore, it should be possible to optimize the rest of the program with -xHost put and apply FCFLAGS2 to the affected routine, module, source file. |
| July 2, 2011 6:13 AM PDT
zh |
It seems that ifort (e.g.11.1.072) doesn't support ISO_C_BINDINGS. Using the following setup in Linux-x86-64-intel.popt, I successfully compiled cp2k with libint for the hybrid functional calculation without segmental fault. CC = cc CPP = FC = mpif90 LD = mpif90 AR = ar -r DFLAGS = -D__INTEL -D__FFTSG -D__parallel -D__BLACS -D__SCALAPACK -D__FFTW3 -D__LIBINT -D__HAS_NO_ISO_C_BINDING CPPFLAGS = INTEL_INC = /usr/apps/isv/intel/11.1.072/include LIBINT_INC = $(HOME)/soft/libint-1.1.4/include FFTW_INC = /usr/apps/free/fftw/3.2.2_i/include FCFLAGS = $(DFLAGS) -I$(LIBINT_INC) -I$(INTEL_INC) -I$(FFTW_INC) -O2 -xW -heap-arrays 64 -funroll-loops -fpp -free FCFLAGS2 = $(DFLAGS) -I$(LIBINT_INC) -I$(INTEL_INC) -O1 -xW -heap-arrays 64 -fpp -free LDFLAGS = $(FCFLAGS) -I$(INTEL_INC) FFTW_LIB = /usr/apps/free/fftw/3.2.2_i INTEL_LIB = /usr/apps/isv/intel/11.1.072/mkl/lib/em64t LIBINT = $(HOME)/soft/libint-1.1.4 LIBS =-L$(INTEL_LIB)/ -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core $(HOME)/soft/cp2k-2.1/tools/hfx_tools/libint_tools/libint_cpp_wra pper.o $(LIBINT)/lib/libderiv.a $(LIBINT)/lib/libint.a -lstdc++ $(FFTW_LIB)/lib/libfftw3.a OBJECTS_ARCHITECTURE = machine_intel.o graphcon.o: graphcon.F $(FC) -c $(FCFLAGS2) $< qs_vxc_atom.o: qs_vxc_atom.F $(FC) -c $(FCFLAGS2) $< ------- The gcc and ifort are used for compiling the libint-1.1.4. |
| September 19, 2011 1:59 AM PDT
Hao Jiang (Intel)
|
If want to use libint, please add/modify the following lines in “Linux-x86-64-intel.sopt”: LIBINT_PATH= <your install path>/libint-1.1.4 LIBINT_LIB = $(LIBINT_LIB)/lib/libderiv.a $(LIBINT_LIB)/lib/libint.a -lstdc++ DFLAGS = -D__INTEL -D__FFTSG -D__FFTW3 -D__FFTMKL -D__LIBINT LIBS = -L$(INTEL_LIB) -mkl $(LIBINT_LIB) It works with Composer XE 2011 (aka 12.0) and later version. |
| September 19, 2011 2:11 AM PDT
Hao Jiang (Intel)
|
There are some known issues found on Fortran Composer XE 2011 update 6 (or version 12.1.233) with latest CP2K 2.2 branch (using CP2K version 2.2.347 in my testing) In summary : 1) Two source files 'et_coupling.F' and 'qs_vxc_atom.F' need to compiled with -O1 option. Please apply FCFLAGS2 patch to them. 2) One source file 'xc_pot_saop.F' need to compile with -xSSE2 option (instead of -xHost). Suggest to apply another FCFLAGS3 patch looks like: FCFLAGS3 = -I$(INTEL_INC) -O2 -xSSE2 -heap-arrays 64 -fpp -free $(DFLAGS) xc_pot_saop.o: xc_pot_saop.F $(FC) -c $(FCFLAGS3) $< Please report any other issues you have found. Thanks |
| September 20, 2011 6:16 PM PDT
Hao Jiang (Intel)
|
Sorry, the correct configuration to use libint should looks like this: LIBINT_PATH= <your install path>/libint-1.1.4 LIBINT_LIB = $(LIBINT_PATH)/lib/libderiv.a $(LIBINT_PATH)/lib/libint.a -lstdc++ |
| December 21, 2011 11:12 PM PST
Hao Jiang (Intel)
| The second issue reported in Sept. 9 (source file 'xc_pot_saop.F') has been fixed in Composer XE 2011 update 8. We still need work around for the first issue. |




HIADSI