[CP2K:1032] cp2k.popt and g95
Luca
bellu... at unisi.it
Tue May 13 09:26:38 UTC 2008
On Tuesday 13 May 2008 11:25:22 Luca wrote:
>
> 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.
> 2-MPICH2:
> 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
>
> 3-BLAS LAPACK
> in /usr/local/lapack-3.1.1
> Edit make.inc like this:
> .....
> PLAT = _G95
> FORTRAN = g95
> OPTS = -O2 # -O3 optimization does not work
> DRVOPTS = $(OPTS)
> NOOPT = -ffloat-store # It is necessary
> LOADER = g95
> ......
> # make blaslib
> # make lapacklib
>
> 4-BLACS
> mpiblacs.tgz and mpiblacs-patch03.tgz PATCH!!!
> Edit and modify Bmake.inc in /usr/local/....yourpath../BLACS
> Set the top level BLACS directory.
> ......
> INTFACE = -DAdd_
> TRANSCOMM = -DCSameF77 -DPOINTER_64_BITS=1 -DUseMpi2
> .......
> F77 = g95
> F77NO_OPTFLAGS = -fno-second-underscore
> F77FLAGS = $(F77NO_OPTFLAGS) -O2
> F77LOADER = $(F77)
> cd ....../BLACS/SRC/MPI and make
> # make
>
> 5-SCALAPACK
> 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
> CCLOADFLAGS =
> 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 :-)
> Luca
>
> >
>
-------------- next part --------------
############################################################################
#
# Program: ScaLAPACK
#
# Module: SLmake.inc
#
# Purpose: Top-level Definitions
#
# Creation date: February 15, 2000
#
# Modified:
#
# Send bug reports, comments or suggestions to scal... at cs.utk.edu
#
############################################################################
#
SHELL = /bin/sh
#
# The complete path to the top level of ScaLAPACK directory, usually
# $(HOME)/SCALAPACK
#
homedir = /usr/local/LIBSC-G95/scalapack-1.8.0
HOMELIB = /usr/local
#
# The platform identifier to suffix to the end of library names
#
PLAT = G95
#
# BLACS setup. All version need the debug level (0 or 1),
# and the directory where the BLACS libraries are
#
BLACSDBGLVL = 0
BLACSdir = $(HOMELIB)/LIBSC-G95/BLACS/LIB
#
# MPI setup; tailor to your system if using MPIBLACS
# Will need to comment out these 6 lines if using PVM
#
USEMPI = -DUsingMpiBlacs
SMPLIB =
BLACSFINIT = $(BLACSdir)/blacsF77init_MPI-G95-0.a
BLACSCINIT = $(BLACSdir)/blacsCinit_MPI-G95-0.a
BLACSLIB = $(BLACSdir)/blacs_MPI-G95-0.a
TESTINGdir = $(homedir)/TESTING
#
# PVMBLACS setup, uncomment next 6 lines if using PVM
#
#USEMPI =
#SMPLIB = $(PVM_ROOT)/lib/$(PLAT)/libpvm3.a
#BLACSFINIT =
#BLACSCINIT =
#BLACSLIB = $(BLACSdir)/blacs_PVM-$(PLAT)-$(BLACSDBGLVL).a
#TESTINGdir = $(HOMELIB)/pvm3/bin/$(PLAT)
CBLACSLIB = $(BLACSCINIT) $(BLACSLIB) $(BLACSCINIT)
FBLACSLIB = $(BLACSFINIT) $(BLACSLIB) $(BLACSFINIT)
#
# The directories to find the various pieces of ScaLapack
#
PBLASdir = $(homedir)/PBLAS
SRCdir = $(homedir)/SRC
TESTdir = $(homedir)/TESTING
PBLASTSTdir = $(TESTINGdir)
TOOLSdir = $(homedir)/TOOLS
REDISTdir = $(homedir)/REDIST
REDISTTSTdir = $(TESTINGdir)
#
# The fortran and C compilers, loaders, and their flags
#
F77 = g95
CC = gcc
NOOPT = -fno-second-underscore
F77FLAGS = $(NOOPT) -O2 -march=nocona
CCFLAGS = -O2
SRCFLAG =
F77LOADER = $(F77)
CCLOADER = $(CC)
F77LOADFLAGS = -i-static
CCLOADFLAGS =
#
# C preprocessor defs for compilation
# (-DNoChange, -DAdd_, -DUpCase, or -Df77IsF2C)
#
CDEFS =-DAdd_ $(USEMPI)
#
# The archiver and the flag(s) to use when building archive (library)
# Also the ranlib routine. If your system has no ranlib, set RANLIB = echo
#
ARCH = ar
ARCHFLAGS = cr
RANLIB = ranlib
#
# The name of the libraries to be created/linked to
#
SCALAPACKLIB = $(homedir)/libscalapack.a
BLASLIB = $(homedir)/blas_G95.a
LAPACKLIB = $(homedir)/lapack_G95.a
#
PBLIBS = $(SCALAPACKLIB) $(FBLACSLIB) $(LAPACKLIB) $(BLASLIB) $(SMPLIB)
PRLIBS = $(SCALAPACKLIB) $(CBLACSLIB) $(SMPLIB)
RLIBS = $(SCALAPACKLIB) $(FBLACSLIB) $(CBLACSLIB) $(LAPACKLIB) $(BLASLIB) $(SMPLIB)
LIBS = $(PBLIBS)
-------------- next part --------------
#=============================================================================
#====================== SECTION 1: PATHS AND LIBRARIES =======================
#=============================================================================
# The following macros specify the name and location of libraries required by
# the BLACS and its tester.
#=============================================================================
# --------------------------------------
# Make sure we've got a consistent shell
# --------------------------------------
SHELL = /bin/sh
# -----------------------------
# The top level BLACS directory
# -----------------------------
HOME=/usr/local/LIBSC-G95
BTOPdir = $(HOME)/BLACS
# ---------------------------------------------------------------------------
# The communication library your BLACS have been written for.
# Known choices (and the machines they run on) are:
#
# COMMLIB MACHINE
# ....... ..............................................................
# CMMD Thinking Machine's CM-5
# MPI Wide variety of systems
# MPL IBM's SP series (SP1 and SP2)
# NX Intel's supercomputer series (iPSC2, iPSC/860, DELTA, PARAGON)
# PVM Most unix machines; See PVM User's Guide for details
# ---------------------------------------------------------------------------
COMMLIB = MPI
# -------------------------------------------------------------
# The platform identifier to suffix to the end of library names
# -------------------------------------------------------------
PLAT = G95
# ----------------------------------------------------------
# Name and location of the BLACS library. See section 2 for
# details on BLACS debug level (BLACSDBGLVL).
# ----------------------------------------------------------
BLACSdir = $(BTOPdir)/LIB
BLACSDBGLVL = 0
BLACSFINIT = $(BLACSdir)/blacsF77init_$(COMMLIB)-$(PLAT)-$(BLACSDBGLVL).a
BLACSCINIT = $(BLACSdir)/blacsCinit_$(COMMLIB)-$(PLAT)-$(BLACSDBGLVL).a
BLACSLIB = $(BLACSdir)/blacs_$(COMMLIB)-$(PLAT)-$(BLACSDBGLVL).a
# -------------------------------------
# Name and location of the MPI library.
# -------------------------------------
MPIdir = /usr/local/mpich2-1.0.7
MPILIBdir = $(MPIdir)/lib/
MPIINCdir = $(MPIdir)/src/include
MPILIB = $(MPILIBdir)/libmpich.a
# -------------------------------------
# All libraries required by the tester.
# -------------------------------------
BTLIBS = $(BLACSFINIT) $(BLACSLIB) $(BLACSFINIT) $(MPILIB)
# ----------------------------------------------------------------
# The directory to put the installation help routines' executables
# ----------------------------------------------------------------
INSTdir = $(BTOPdir)/INSTALL/EXE
# ------------------------------------------------
# The name and location of the tester's executable
# ------------------------------------------------
TESTdir = $(BTOPdir)/TESTING/EXE
FTESTexe = $(TESTdir)/xFbtest_$(COMMLIB)-$(PLAT)-$(BLACSDBGLVL)
CTESTexe = $(TESTdir)/xCbtest_$(COMMLIB)-$(PLAT)-$(BLACSDBGLVL)
#=============================================================================
#=============================== End SECTION 1 ===============================
#=============================================================================
#=============================================================================
#========================= SECTION 2: BLACS INTERNALS ========================
#=============================================================================
# The following macro definitions set preprocessor values for the BLACS.
# The file Bconfig.h sets these values if they are not set by the makefile.
# User's compiling only the tester can skip this entire section.
# NOTE: The MPI defaults have been set for MPICH.
#=============================================================================
# -----------------------------------------------------------------------
# The directory to find the required communication library include files,
# if they are required by your system.
# -----------------------------------------------------------------------
SYSINC = -I$(MPIINCdir)
# ---------------------------------------------------------------------------
# The Fortran 77 to C interface to be used. If you are unsure of the correct
# setting for your platform, compile and run BLACS/INSTALL/xintface.
# Choices are: Add_, NoChange, UpCase, or f77IsF2C.
# ---------------------------------------------------------------------------
INTFACE = -DAdd_
# ------------------------------------------------------------------------
# Allows the user to vary the topologies that the BLACS default topologies
# (TOP = ' ') correspond to. If you wish to use a particular topology
# (as opposed to letting the BLACS make the choice), uncomment the
# following macros, and replace the character in single quotes with the
# topology of your choice.
# ------------------------------------------------------------------------
# DEFBSTOP = -DDefBSTop="'1'"
# DEFCOMBTOP = -DDefCombTop="'1'"
# -------------------------------------------------------------------
# If your MPI_Send is locally-blocking, substitute the following line
# for the empty macro definition below.
# SENDIS = -DSndIsLocBlk
# -------------------------------------------------------------------
SENDIS =
# --------------------------------------------------------------------
# If your MPI handles packing of non-contiguous messages by copying to
# another buffer or sending extra bytes, better performance may be
# obtained by replacing the empty macro definition below with the
# macro definition on the following line.
# BUFF = -DNoMpiBuff
# --------------------------------------------------------------------
BUFF =
# -----------------------------------------------------------------------
# If you know something about your system, you may make it easier for the
# BLACS to translate between C and fortran communicators. If the empty
# macro defininition is left alone, this translation will cause the C
# BLACS to globally block for MPI_COMM_WORLD on calls to BLACS_GRIDINIT
# and BLACS_GRIDMAP. If you choose one of the options for translating
# the context, neither the C or fortran calls will globally block.
# If you are using MPICH, or a derivitive system, you can replace the
# empty macro definition below with the following (note that if you let
# MPICH do the translation between C and fortran, you must also indicate
# here if your system has pointers that are longer than integers. If so,
# define -DPOINTER_64_BITS=1.) For help on setting TRANSCOMM, you can
# run BLACS/INSTALL/xtc_CsameF77 and BLACS/INSTALL/xtc_UseMpich as
# explained in BLACS/INSTALL/README.
TRANSCOMM = -DCSameF77 -DPOINTER_64_BITS=1 -DUseMpi2
#
# If you know that your MPI uses the same handles for fortran and C
# communicators, you can replace the empty macro definition below with
# the macro definition on the following line.
# TRANSCOMM = -DCSameF77
# -----------------------------------------------------------------------
# TRANSCOMM =
# --------------------------------------------------------------------------
# You may choose to have the BLACS internally call either the C or Fortran77
# interface to MPI by varying the following macro. If TRANSCOMM is left
# empty, the C interface BLACS_GRIDMAP/BLACS_GRIDINIT will globally-block if
# you choose to use the fortran internals, and the fortran interface will
# block if you choose to use the C internals. It is recommended that the
# user leave this macro definition blank, unless there is a strong reason
# to prefer one MPI interface over the other.
# WHATMPI = -DUseF77Mpi
# WHATMPI = -DUseCMpi
# --------------------------------------------------------------------------
WHATMPI =
# ---------------------------------------------------------------------------
# Some early versions of MPICH and its derivatives cannot handle user defined
# zero byte data types. If your system has this problem (compile and run
# BLACS/INSTALL/xsyserrors to check if unsure), replace the empty macro
# definition below with the macro definition on the following line.
# SYSERRORS = -DZeroByteTypeBug
# ---------------------------------------------------------------------------
SYSERRORS =
# ------------------------------------------------------------------
# These macros set the debug level for the BLACS. The fastest
# code is produced by BlacsDebugLvl 0. Higher levels provide
# more debug information at the cost of performance. Present levels
# of debug are:
# 0 : No debug information
# 1 : Mainly parameter checking.
# ------------------------------------------------------------------
DEBUGLVL = -DBlacsDebugLvl=$(BLACSDBGLVL)
# -------------------------------------------------------------------------
# All BLACS definitions needed for compile (DEFS1 contains definitions used
# by all BLACS versions).
# -------------------------------------------------------------------------
DEFS1 = -DSYSINC $(SYSINC) $(INTFACE) $(DEFBSTOP) $(DEFCOMBTOP) $(DEBUGLVL)
BLACSDEFS = $(DEFS1) $(SENDIS) $(BUFF) $(TRANSCOMM) $(WHATMPI) $(SYSERRORS)
#=============================================================================
#=============================== End SECTION 2 ===============================
#=============================================================================
#=============================================================================
#=========================== SECTION 3: COMPILERS ============================
#=============================================================================
# The following macros specify compilers, linker/loaders, the archiver,
# and their options. Some of the fortran files need to be compiled with no
# optimization. This is the F77NO_OPTFLAG. The usage of the remaining
# macros should be obvious from the names.
#=============================================================================
F77 = g95
F77NO_OPTFLAGS = -fno-second-underscore
F77FLAGS = $(F77NO_OPTFLAGS) -O2 -march=nocona
F77LOADER = $(F77)
F77LOADFLAGS =
CC = gcc
CCFLAGS = -O4
CCLOADER = $(CC)
CCLOADFLAGS =
# --------------------------------------------------------------------------
# The archiver and the flag(s) to use when building an archive (library).
# Also the ranlib routine. If your system has no ranlib, set RANLIB = echo.
# --------------------------------------------------------------------------
ARCH = ar
ARCHFLAGS = r
RANLIB = ranlib
#=============================================================================
#=============================== End SECTION 3 ===============================
#=============================================================================
More information about the CP2K-user
mailing list