Difference between revisions of "Useful Makefiles"

From CUC3
Jump to navigation Jump to search
import>Jss43
import>Jss43
Line 189: Line 189:
 
COPTS = -i-static -static-libcxa -O2 $(FLOATOPTS)
 
COPTS = -i-static -static-libcxa -O2 $(FLOATOPTS)
   
== FFTW 2.1.5 with MVAPICH ==
+
=== FFTW 2.1.5 with MVAPICH ===
   
 
This is not really well-documented elsewhere. FFTW 2.1.5 is used in (e.g.) CPMD as an alternative to the default FFT engine supplied. It is trivial to compile in serial (FFTW 3 is even easier, but sadly the parallel version is in alpha and incompatible with the widely-used FFTW2). On tardis, in fftw-2.1.5 directory formed by extracting the tarball:
 
This is not really well-documented elsewhere. FFTW 2.1.5 is used in (e.g.) CPMD as an alternative to the default FFT engine supplied. It is trivial to compile in serial (FFTW 3 is even easier, but sadly the parallel version is in alpha and incompatible with the widely-used FFTW2). On tardis, in fftw-2.1.5 directory formed by extracting the tarball:

Revision as of 23:57, 17 March 2008

This page is a place to stick Makefiles or other config files for common codes that you've got working on the local compute servers

Tardis

cp2k with intel compilers

Setting the FORT_C_NAME variable to 'intel' helps cp2k's build system select the right compiler.

You need the mkl, mpi/mvapich/intel, blacs/mvapich/intel64, and scalapack/intel modules loaded

# The following settings worked for:
# - AMD64 Opteron cluster
# - SUSE Linux 10.0 (x86_64)
# - Intel(R) Fortran Compiler for Intel(R) EM64T-based applications, Version 9.1.037
# - Intel(R) Cluster Math Kernel Library v7.2 for Linux
# - MVAPICH
# - BLACS and ScaLAPACK compiled for Intel
#
PERL     = perl
CC       = cc
CPP      = cpp
FC       = mpif90 -FR
LD       = mpif90
AR       = ar -r
DFLAGS   = -D__INTEL -D__FFTSG\
          -D__parallel -D__BLACS -D__SCALAPACK\
          -Dfftwnd_f77=fftwnd_f77_\
          -Dfftwnd_f77_one=fftwnd_f77_one_\
          -Dfftw3d_f77_create_plan=fftw3d_f77_create_plan_\
          -Dfftw2d_f77_create_plan=fftw2d_f77_create_plan_\
          -Dfftwnd_f77_destroy_plan=fftwnd_f77_destroy_plan_\
          -Dfftw_f77_create_plan=fftw_f77_create_plan_\
          -Dfftw_f77=fftw_f77_\
          -Dfftw_f77_destroy_plan=fftw_f77_destroy_plan_
CPPFLAGS = -traditional -C $(DFLAGS) -P
FCFLAGS  = $(DFLAGS) -O2
MKLPATH  = /usr/local/Cluster-Apps/intel/mkl/8.0/lib/em64t
LDFLAGS  = $(FCFLAGS) -i-static
LIBS     = \
          -L/usr/local/Cluster-Apps/scalapack/intel/lib64 -lscalapack \
          $(MKLPATH)/libmkl_lapack.a \
          -L/usr/local/Cluster-Apps/blacs/mvapich/intel/lib64 -lblacsF77init -lblacs \
          $(MKLPATH)/libmkl_em64t.a \
          $(MKLPATH)/libguide.a\
          -lpthread

OBJECTS_ARCHITECTURE = machine_intel.o

#           -D__FFTW\


Jochen's CPMD with Portland compilers and MVAPICH

You need the mpi/mvapich/pgi module but ACML comes in automatically with PGI.

#----------------------------------------------------------------------------
# Makefile for cpmd.x (plane wave electronic calculation)
# Configuration: PGI-AMD64-MPI
# Creation of Makefile: Dec  5 2006
# on Linux tardis 2.6.15.1-clustervision-128_cvos #1 SMP Mon Sep 25 12:05:46 CEST 2006   x86_64 x86_64 x86_64 GNU/Linux
# Author: jb376
#----------------------------------------------------------------------------
#
SHELL = /bin/sh
#
#--------------- Default Configuration for PGI-AMD64-MPI ---------------
SRC  = .
DEST = .
BIN  = .
#QMMM_FLAGS = -D__QMECHCOUPL
#QMMM_LIBS  = -L. -lmm
FFLAGS = -r8 -pc=64 -Msignextend  
#LFLAGS = -Bstatic -L. -latlas_x86-64 $(QMMM_LIBS)
#LFLAGS = -Bstatic -L. -latlas_x86_64 $(QMMM_LIBS)
LFLAGS = -lacml $(QMMM_LIBS)
CFLAGS = 
CPP = /lib/cpp -P -C -traditional
#CPPFLAGS = -D__Linux -D__PGI -DLAPACK -DFFT_DEFAULT -DPOINTER8 -D__pgf90 \
#               -DPARALLEL -DMP_LIBRARY=__MPI -DMYRINET  
CPPFLAGS = -D__Linux -D__PGI -DLAPACK -DFFT_DEFAULT -DPOINTER8 -D__pgf90 \
              -DPARALLEL -DMP_LIBRARY=__MPI 
NOOPT_FLAG = 
CC = mpicc -O2 -Wall -m64
FC = mpif77 -c -fastsse -tp k8-64
LD = mpif77 -fastsse -tp k8-64
AR = 
#----------------------------------------------------------------------------

I had problems compiling CPMD v3.11.1 using mpif77: the compiler complained about some valid Fortran statements (e.g. append and cycle). Using mpif90 instead resolved this.--james 11:56, 8 August 2007 (BST)

The recent upgrade to tardis has changed how some modules work. In particular, mpicc now points to pgcc rather than gcc if the portland environment module is loaded. This is, Catherine and I think, the sane approach. The above CC options cause make to barf, as pgcc uses different flags to gcc. Change "-O2 -Wall -m64" to "-O2 -Minform=inform -pc=64" to give pgcc the equivalent options.--james 19:37, 7 March 2008 (GMT)

NAMD2 with Intel compilers

This one requires the openmpi/intel64 module

Step 1: charm++

./build charm++ mpi-linux-amd64 icc

my src/arch/mpi-linux-amd64/conv-mach.sh

CMK_REAL_COMPILER=`mpiCC -show 2>/dev/null | cut -d' ' -f1 `
case "$CMK_REAL_COMPILER" in
 g++) CMK_AMD64="-m64 -fPIC" ;;
esac

CMK_CPP_CHARM="/lib/cpp -P"
CMK_CPP_C="mpicc -E"
CMK_CC="mpicc $CMK_AMD64 "
CMK_CXX="mpiCC $CMK_AMD64 "
CMK_CXXPP="mpiCC -E $CMK_AMD64 "

CMK_SYSLIBS=" "
CMK_LIBS="-lckqt $CMK_SYSLIBS "
CMK_LD_LIBRARY_PATH="-Wl,-rpath,$CHARMLIBSO/"

CMK_NATIVE_CC="gcc $CMK_AMD64 "
CMK_NATIVE_LD="gcc $CMK_AMD64 "
CMK_NATIVE_CXX="g++ $CMK_AMD64 "
CMK_NATIVE_LDXX="g++ $CMK_AMD64 "
CMK_NATIVE_LIBS=""

# fortran compiler 
CMK_CF77="f77"
CMK_CF90="f90"
CMK_F90LIBS=" "
CMK_F77LIBS=" "
CMK_MOD_NAME_ALLCAPS=1
CMK_MOD_EXT="mod"
CMK_F90_USE_MODDIR=1
CMK_F90_MODINC="-p"

CMK_QT='generic64'
CMK_RANLIB="ranlib"

and src/arch/common/cc-icc.sh

CMK_CPP_C='mpicc -E '
CMK_CC="mpicc -fpic "
CMK_CXX="mpiCC -fpic "
CMK_CXXPP='mpiCC -E '
CMK_LD='mpicc -i_dynamic '
CMK_LDXX='mpiCC -i_dynamic '
CMK_LD_LIBRARY_PATH="-Wl,-rpath,$CHARMLIBSO/"
CMK_CF90='ifc -auto '
CMK_CF90_FIXED="$CMK_CF90 -132 -FI "
CMK_NATIVE_F90="$CMK_CF90"
CMK_NATIVE_CC="$CMK_CC"
CMK_NATIVE_CXX="$CMK_CXX"
CMK_NATIVE_LD="$CMK_LD"
CMK_NATIVE_LDXX="$CMK_LDXX"
CMK_F90LIBS='-L/usr/local/intel/compiler70/ia32/lib -L/opt/intel/compiler70/ia32/lib -lintrins -lIEPCF90 -lPEPCF90 -lF90 -lintrins -limf  '
CMK_MOD_NAME_ALLCAPS=1
CMK_MOD_EXT="mod"
CMK_F90_USE_MODDIR=""

Step 2: NAMD

./config tcl fftw Linux-amd64-MPI-icc

my arch/Linux-amd64.tcl:

TCLDIR=/usr
TCLINCL=-I$(TCLDIR)/include 
TCLLIB=-L$(TCLDIR)/lib -ltcl8.4 -ldl
TCLFLAGS=-DNAMD_TCL -DUSE_NON_CONST 
TCL=$(TCLINCL) $(TCLFLAGS)


my arch/Linux-amd64.fftw:

FFTDIR=/usr/local/fftw2/intel/64/2.1.5
FFTINCL=-I$(FFTDIR)/include -I$(HOME)/fftw/include
FFTLIB=-L$(FFTDIR)/lib -L$(HOME)/fftw/lib -lsrfftw -lsfftw
FFTFLAGS=-DNAMD_FFTW
FFT=$(FFTINCL) $(FFTFLAGS)


Jochen's Linux-amd64-MPI-icc.arch (Vastly improves performance over the default):

NAMD_ARCH = Linux-amd64
CHARMARCH = mpi-linux-amd64-icc
FLOATOPTS = -fno-rtti
CXX = /usr/local/Cluster-Apps/ofed/1.0/mpi/intel/mvapich-0.9.7-mlx2.1.0/bin/mpicxx
CXXOPTS = -tpp6 -pc64 -i-static -static-libcxa -O2 -unroll $(FLOATOPTS)
CXXNOALIASOPTS = -O2 -unroll -fno-alias $(FLOATOPTS)
CC = /usr/local/Cluster-Apps/ofed/1.0/mpi/intel/mvapich-0.9.7-mlx2.1.0/bin/mpicc
COPTS = -i-static -static-libcxa -O2 $(FLOATOPTS)

FFTW 2.1.5 with MVAPICH

This is not really well-documented elsewhere. FFTW 2.1.5 is used in (e.g.) CPMD as an alternative to the default FFT engine supplied. It is trivial to compile in serial (FFTW 3 is even easier, but sadly the parallel version is in alpha and incompatible with the widely-used FFTW2). On tardis, in fftw-2.1.5 directory formed by extracting the tarball:

  1. env CC=mpicc F77=mpif90 ./configure --prefix=`pwd` --enable-mpi --enable-sse
  2. make
  3. make install

Having to set the c compiler for parallel compilation is not mentioned in the docs...