How to compile cp2k with INTEL compilers and MKL.

fish john... at uop.com
Fri Jul 11 14:47:09 UTC 2008


After looking thought the many negative posts about the INTEL
compilers and MKL, I wanted to add a positive note.

The key to using the INTEL compilers is to source the scripts provided
by INTEL to set up your environment for the FORTRAN and C++ compilers
and MKL libraries.  I source these scripts in my .profile script.
These scripts will allow you to have much simpler make files and lower
the effort involved in compiling and linking.  I recently compiled the
serial version of cp2k on my Pentium D desktop running Fedora Core 8
at home using the "Linux-i686-intel.sopt" arch file attached below.

I have used the same arch file to compile cp2k on my SGI Altix 350.  I
think it should work with any architecure with the INTEL compilers.

After working with the INTEL compilers for several years, I am having
much better luck with them.
The MKL libraries are very convienent because they contain many of the
commonly used math libraries in them.  You can make wrappers for
FTTW3, SCALAPACK, BLAS which use the MKL libraries.  This does make
compiling open source like CP2K much easier.

The INTEL MPI library is also convienent for compiling parallel code.

A nice example is provided by the INTEL which shows how to compile
VASP with their compilers, math libraries and MPI.

(See http://support.intel.com/support/performancetools/libraries/mkl/sb/CS-028850.htm.)

This example should be helpful to someone trying to make an arch file
for compiling cp2k with the INTEL compilers and libraries.

___________________________________________________________________________

# by default some intel compilers put temporaries on the stack
# this might lead to segmentation faults if the stack limit is set to
low
# stack limits can be increased by sysadmins or e.g with ulimit -s
256000
# furthermore new ifort (tested to work fine with 10.0.015) compilers
support the option
# -heap-arrays 64
# add this to the compilation flags if the other options do not work
# These variables were simplified from earlier versions of this file.
#
# The following lines were added by jjlow 7/11/09
#
# You do not have to specify the location of mkl libraries if you run
the
# scripts provided by INTEL to setup your environment for the fortran
compiler, c++ compiler
# and mklibraries.  The names of these scripts are ifortvars.sh,
iccvars.sh and
# mklvars32.sh (for the bash or bourne shells).  Similar csh scripts
are also
# available.  Look for these scripts in the bin directory of the
fortran and
# cc installation directories and the tools/environment directory of
the mkl
# installation directory.
CC       = icc
CPP      = cpp
FC       = ifort -FR
FC_fixed = ifort -FI
LD       = ifort
AR       = ar -r
DFLAGS   = -D__INTEL -D__FFTSG -D__FFTMKL
CPPFLAGS = -traditional -C $(DFLAGS) -P
FCFLAGS  = -O3 -Vaxlib
LDFLAGS  = $(FCFLAGS)
LIBS     = -lmkl_lapack -lmkl -lguide -lpthread

OBJECTS_ARCHITECTURE = machine_intel.o


More information about the CP2K-user mailing list