From 87dc667040e14cbcadc0720fe2b60d6b7df09fd6 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal <grzegorz@amuncode.org> Date: Fri, 31 Aug 2018 11:05:16 -0300 Subject: [PATCH] Add PGI and Intel compilers support to default host file. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org> --- build/hosts/default | 118 +++++++++++++++++++++++++++++++++++++------- build/make.default | 6 ++- 2 files changed, 105 insertions(+), 19 deletions(-) diff --git a/build/hosts/default b/build/hosts/default index a5f738c..c68dde8 100644 --- a/build/hosts/default +++ b/build/hosts/default @@ -1,56 +1,138 @@ #------------------------------------------------------------------------------- # -# depending on the compilation flags choose the right compilers and options +# Compilation flags depend on variable COMPILER set in make.default or +# make.config. This variable indicates which compiler family should be used. +# Currently, we support GNU, PGI and INTEL compilers. If you need support +# for a different compiler, please add corresponding section below. # #------------------------------------------------------------------------------- # +# GNU Fortran compiler # -#------------------------------------------------------------------------------- -# +ifeq ($(COMPILER), GNU) + # compiler and linker setup # ifeq ($(MPI),Y) -FC = mpif90 +FC = mpifort else FC = gfortran endif LD = $(FC) -# preprocessor prefix (used by IBM Fortran, e.g.) +# compiler and linker flags # -CPPPREFIX = +ifeq ($(DEBUG),Y) +FFLAGS = -Og -g -DDEBUG +else +FFLAGS = -O2 -march=native -pipe +endif +ifeq ($(PROFILE),Y) +FFLAGS += -pg +endif +LDFLAGS = $(FFLAGS) +ifeq ($(STATIC),Y) +LDFLAGS += -static +endif + +endif + +#------------------------------------------------------------------------------- +# +# PGI Fortran compiler +# +ifeq ($(COMPILER), PGI) + +# compiler and linker setup +# +ifeq ($(MPI),Y) +FC = mpifort +else +FC = pgfortran +endif +LD = $(FC) # compiler and linker flags # ifeq ($(DEBUG),Y) -FFLAGS = -g -O2 $(CPPPREFIX)-DDEBUG +FFLAGS = -O -g -DDEBUG else -FFLAGS = -O2 +FFLAGS = -fast +endif +ifeq ($(PROFILE),Y) +FFLAGS += -Mprof=dwarf +endif +LDFLAGS = $(FFLAGS) +ifeq ($(STATIC),Y) +LDFLAGS += -Bstatic endif -LDFLAGS = $(FFLAGS) - -# libraries -# -LIBS = +endif #------------------------------------------------------------------------------- # +# INTEL Fortran compiler +# +ifeq ($(COMPILER), INTEL) + +# compiler and linker setup +# +ifeq ($(MPI),Y) +FC = mpifort +else +FC = ifort +endif +LD = $(FC) + +# compiler and linker flags +# +ifeq ($(DEBUG),Y) +FFLAGS = -O -g -DDEBUG +else +FFLAGS = -O2 -xHost +endif +ifeq ($(PROFILE),Y) +FFLAGS += -p +endif +LDFLAGS = $(FFLAGS) ifeq ($(STATIC),Y) -LDFLAGS += -static +LDFLAGS += -static endif +endif + +#------------------------------------------------------------------------------- +# +# Additional common directives set in make.config +# + ifeq ($(SIGNALS),Y) -FFLAGS += $(CPPPREFIX)-DSIGNALS +FFLAGS += -DSIGNALS endif ifeq ($(MPI),Y) -FFLAGS += $(CPPPREFIX)-DMPI +FFLAGS += -DMPI endif +#------------------------------------------------------------------------------- +# +# libraries and their dependencies +# +LIBS = + +# if your HDF5 libraries not are installed in the standard location /usr, +# you can set this path using the HDF5DIR variable here +# +#HDF5DIR=/home/user/hdf5 + ifeq ($(OUTPUT),HDF5) -FFLAGS += -I/usr/include -LIBS += -lhdf5_fortran -lhdf5 -lz +ifeq ($(HDF5DIR),) +FFLAGS += -I/usr/include +else +FFLAGS += -I$(HDF5DIR)/include +LIBS += -L$(HDF5DIR)/lib +endif +LIBS += -lhdf5_fortran -lhdf5 endif # #------------------------------------------------------------------------------- diff --git a/build/make.default b/build/make.default index d1069b9..f663694 100644 --- a/build/make.default +++ b/build/make.default @@ -9,7 +9,7 @@ # SIGNALS - support for signals for proper shutdown with restart file # COMPILER = GNU -DEBUG = Y +DEBUG = N PROFILE = N STATIC = N SIGNALS = N @@ -36,3 +36,7 @@ NDIMS = 2 # #------------------------------------------------------------------------------- +# +# path for temporary files during compilation (uncomment if you wish to use it) +# +#OBJSDIR := /tmp/${USER}/amun-code/obj \ No newline at end of file