cp2k.popt and g95

Luca bellu... at unisi.it
Tue May 13 09:25:22 UTC 2008

Hi all,
after having had some problems with the intel fortran compiler, I decided to compile cp2k with g95.  
I found some  difficulties to compile the parallel version of cp2k with g95.  
I wrote some notes for myself and I posted them in the group mailing list.  
This is what you need:

Stable version 0.91, March 2008 g95 compiler:  http://www.g95.org/
mpich2-1.0.7 :       http://www.mcs.anl.gov/research/projects/mpich2/
Lapack   version 3.1.1 :       http://www.netlib.org/lapack/
scalapack version 1.8.0 :    http://www.netlib.org/scalapack/
mpiblacs and mpiblacs-patch03 :  http://www.netlib.org/blacs/

Follow a brief howto. 
1-Install G95.
in /usr/local/mpich2-1.0.7
set F90 an F77 environment variables. 
>From bash shell:
 # su root
 #  F77='g95 -ffixed-form -fno-second-underscore'
 #  F90='g95 -ffree-form -fno-second-underscore'
 #  export F90 F77
check with:
 # echo $F77 $F90
Configure MPI for your system  
For SMP system with shared memory (i.e. dual or quad core) you can use:
 #./configure --with-device=ch3:shm 
 # make 
 # make install

in /usr/local/lapack-3.1.1
Edit make.inc like this:
PLAT = _G95
FORTRAN  = g95 
OPTS     = -O2                   # -O3 optimization does not work
NOOPT    = -ffloat-store   #  It is necessary
LOADER   = g95
# make blaslib
# make lapacklib

mpiblacs.tgz and mpiblacs-patch03.tgz   PATCH!!!
Edit and modify Bmake.inc in  /usr/local/....yourpath../BLACS
Set the top level BLACS directory.
   F77            = g95
   F77NO_OPTFLAGS = -fno-second-underscore
   F77FLAGS       = $(F77NO_OPTFLAGS) -O2 
   F77LOADER      = $(F77)
cd ....../BLACS/SRC/MPI and make
# make

Edit and modify SLmake.in in /usr/local/...yourpath../sclapack-1.8.0
Set the top level directory and path for blacs library.
 F77           = g95 
 CC            = gcc
 NOOPT         =  -fno-second-underscore
 F77FLAGS      = $(NOOPT) -O2 
 CCFLAGS       = -O2 
 SRCFLAG       =
 F77LOADER     = $(F77)
 CCLOADER      = $(CC)
 F77LOADFLAGS  = -i-static
 CDEFS         =-DAdd_  $(USEMPI)
In ./sclapack-1.8.0 compile library with 
# make 

In attach there are makefile for cp2k, Bmake.inc for the BLACS library and SLmake.inc 
for the scalapack library. Please pay attention, all paths directory are for my system....
Any suggestions or improvements are well accepted.
...thanks Fabiana for reviews :-)

More information about the CP2K-user mailing list