Skip to content
CP2K_Build_README.txt 2.93 KiB
Newer Older
Valeriu Codreanu's avatar
Valeriu Codreanu committed
Build instructions for CP2K.
2014-04-09 : ntell@iasa.gr

CP2K needs a number of external libraries and a threads enabled MPI implementation.
These are : BLAS/LAPACK, BLACS/SCALAPACK, LIBINT, FFTW3.
It is advised to use the vendor optimized versions of these libraries.
If some of these are not available on your machine,
there some implementations of these libraries. Some of these are below.

1. 	BLAS/LAPACK : 
	netlib BLAS/LAPACK : http://netlib.org/lapack/
	ATLAS              : http://math-atlas.sf.net/
	GotoBLAS	   : http://www.tacc.utexas.edu/tacc-projects
	MKL                : refer to your Intel MKL installation, if available
	ACML	           : refer to your ACML installation if available

2.	BLACS/SCALAPACK	   : http://netlib.org/scalapack/
			     Intel BLACS/SCALAPACK Implementation

3.	LIBINT		   : http://sourceforge.net/projects/libint/files/v1-releases/

4.	FFTW3		   : http://www.fftw.org/
			     

In the directory cp2k-VERSION/arch there are some ARCH files with instructions how
to build CP2K. For each architecture/compiler there are few arch files describing how to build cp2k.
Select one of the .psmp files that fits your architecture/compiler.
cd to cp2k-VERSION/makefiles
If the arch file for your machine is called SOMEARCH_SOMECOMPILER.psmp,
issue : make ARCH=SOMEARCH_SOMECOMPILER VERSION=psmp
If everything goes fine, you'll find the executable cp2k.psmp in the directory
cp2k-VERSION/exe/SOMEARCH_SOMECOMPILER

In most cases you need to create a custom arch file that fits cpu type,
compiler, and the installation path of external libraries.
As an example below is the arch file for a machine with mpif90/gcc/gfortran, that supports SSE2, has 
all the external libraries installed under /usr/local/, uses ATLAS with full
LAPACK support for BLAS/LAPACK, Scalapack-2 for BLACS/Scalapack, fftw3 FFTW3 and libint-1.1.4:


#=======================================================================================================
CC       = gcc
CPP      = 
FC       = mpif90 -fopenmp
LD       = mpif90 -fopenmp
AR       = ar -r
DFLAGS   =  -D__GFORTRAN -D__FFTSG -D__parallel -D__BLACS -D__SCALAPACK -D__FFTW3 -D__LIBINT  -I/usr/local/fftw3/include -I/usr/local/libint-1.1.4/include 
CPPFLAGS = 
FCFLAGS  = $(DFLAGS) -O3 -msse2 -funroll-loops -finline -ffree-form
FCFLAGS2 = $(DFLAGS) -O3 -msse2 -funroll-loops -finline -ffree-form
LDFLAGS  = $(FCFLAGS) 
LIBS     = /usr/local/Scalapack/lib/libscalapack.a \
           /usr/local/Atlas/lib/liblapack.a \
           /usr/local/Atlas/lib/libf77blas.a \
           /usr/local/Atlas/lib/libcblas.a \
           /usr/local/Atlas/lib/libatlas.a \
           /usr/local/fftw3/lib/libfftw3_threads.a \
           /usr/local/fftw3/lib/libfftw3.a \
           /usr/local/libint-1.1.4/lib/libderiv.a \
           /usr/local/libint-1.1.4/lib/libint.a \
           -lstdc++ -lpthread

OBJECTS_ARCHITECTURE = machine_gfortran.o
#=======================================================================================================