added Option DEBUG to Makefile to turn run time debugging on, compile tests use this option

This commit is contained in:
Martin Diehl 2013-02-08 15:43:15 +00:00
parent 32a416e298
commit 59e59c90c5
1 changed files with 62 additions and 34 deletions

View File

@ -85,6 +85,25 @@ PORTABLE_SWITCH =-msse3
endif endif
ifdef ACMLROOT
LIB_DIRS +=-L$(ACMLROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES +=-lacml$(ACML_ARCH)
else
ifdef LAPACKROOT
LIB_DIRS +=-L$(LAPACKROOT)/lib64 -L$(LAPACKROOT)/lib
LIBRARIES +=-llapack
endif
endif
COMPILE_OPTIONS_ifort :=
ifeq "$(F90)" "ifort"
ifdef IMKLROOT
COMPILE_OPTIONS_ifort +=-I$(IMKLROOT)/include -mkl=sequential
LIBRARIES :=
LIB_DIRS :=
endif
endif
# settings for multicore support # settings for multicore support
ifeq "$(OPENMP)" "ON" ifeq "$(OPENMP)" "ON"
OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel OPENMP_FLAG_ifort =-openmp -openmp-report0 -parallel
@ -96,20 +115,6 @@ endif
LIBRARIES +=-lfftw3 LIBRARIES +=-lfftw3
LIB_DIRS +=-L$(FFTWROOT)/lib LIB_DIRS +=-L$(FFTWROOT)/lib
ifdef IMKLROOT
LIB_DIRS +=-L$(IMKLROOT)/lib/intel64
LIBRARIES +=-mkl
else
ifdef ACMLROOT
LIB_DIRS +=-L$(ACMLROOT)/$(F90)64$(ACML_ARCH)/lib
LIBRARIES +=-lacml$(ACML_ARCH)
else
ifdef LAPACKROOT
LIB_DIRS +=-L$(LAPACKROOT)/lib64 -L$(LAPACKROOT)/lib
LIBRARIES +=-llapack
endif
endif
endif
ifdef PETSC_DIR ifdef PETSC_DIR
include ${PETSC_DIR}/conf/variables include ${PETSC_DIR}/conf/variables
@ -137,11 +142,11 @@ OPTIMIZATION_AGGRESSIVE_ifort :=-O3 $(PORTABLE_SWITCH) -no-prec-div -fp-model
OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 $(PORTABLE_SWITCH) -ffast-math -funroll-loops -ftree-vectorize OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 $(PORTABLE_SWITCH) -ffast-math -funroll-loops -ftree-vectorize
COMPILE_OPTIONS_ifort :=-fpp\ COMPILE_OPTIONS_ifort +=-fpp\
-ftz\ -ftz\
-assume byterecl -assume byterecl
ifneq "$(FASTBUILD)" "YES" ifneq "$(FASTBUILD)" "YES"
COMPILE_OPTIONS_ifort :=$(COMPILE_OPTIONS_ifort)\ COMPILE_OPTIONS_ifort +=$(COMPILE_OPTIONS_ifort)\
-implicitnone\ -implicitnone\
-diag-enable sc3\ -diag-enable sc3\
-diag-disable 5268\ -diag-disable 5268\
@ -154,7 +159,8 @@ COMPILE_OPTIONS_ifort :=$(COMPILE_OPTIONS_ifort)\
-warn unused\ -warn unused\
-warn errors -warn errors
endif endif
###################################################################################################
#COMPILE SWITCHES
#-fpp: preprocessor #-fpp: preprocessor
#-ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0 #-ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0
#-fimplicit-none: assume "implicit-none" even if not present in source #-fimplicit-none: assume "implicit-none" even if not present in source
@ -172,32 +178,41 @@ endif
# stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK) # stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK)
# #
################################################################################################### ###################################################################################################
#MORE OPTIONS FOR DEBUGGING DURING COMPILING #MORE OPTIONS FOR DEBUGGING DURING COMPILATION
#-warn: enables warnings, where #-warn: enables warnings, where
# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132) # truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132)
# uncalled: Determines whether warnings occur when a statement function is never called # uncalled: Determines whether warnings occur when a statement function is never called
# all: # all:
#
#OPTIONS FOR DEGUBBING DURING RUNTIME DEBUG_OPTIONS_ifort :=-g\
# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/ -traceback\
-gen-interfaces\
-fp-stack-check\
-check bounds,format,output_conversion,pointers,uninit
###################################################################################################
#COMPILE SWITCHES FOR RUNTIME DEBUGGING
#-g: Generate symbolic debugging information in the object file #-g: Generate symbolic debugging information in the object file
#-traceback: Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time. #-traceback: Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time.
#-gen-interfaces: Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/ #-gen-interfaces: Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/
#-fp-stack-check: Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state. #-fp-stack-check: Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state.
#-check: checks at runtime, where #-check: checks at runtime, where
# bounds: check if an array index is too small (<1) or too large! # bounds: check if an array index is too small (<1) or too large!
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays
# format: Checking for the data type of an item being formatted for output. # format: Checking for the data type of an item being formatted for output.
# output_conversion: Checking for the fit of data items within a designated format descriptor field. # output_conversion: Checking for the fit of data items within a designated format descriptor field.
# pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects. # pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects.
# uninit: Checking for uninitialized variables. # uninit: Checking for uninitialized variables.
#-heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits
#-fpe-all0 capture all floating-point exceptions, sets -ftz automatically #-fpe-all0 capture all floating-point exceptions, sets -ftz automatically
# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/
################################################################################################### ###################################################################################################
#MORE OPTIONS FOR RUNTIME DEBUGGING
#-heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits
#-check: checks at runtime, where
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
COMPILE_OPTIONS_gfortran :=-xf95-cpp-input COMPILE_OPTIONS_gfortran :=-xf95-cpp-input
ifneq "$(FASTBUILD)" "YES" ifneq "$(FASTBUILD)" "YES"
COMPILE_OPTIONS_gfortran :=$(COMPILE_OPTIONS_gfortran)\ COMPILE_OPTIONS_gfortran +=$(COMPILE_OPTIONS_gfortran)\
-ffree-line-length-132\ -ffree-line-length-132\
-fimplicit-none\ -fimplicit-none\
-pedantic\ -pedantic\
@ -223,7 +238,8 @@ COMPILE_OPTIONS_gfortran :=$(COMPILE_OPTIONS_gfortran)\
-Wreal-q-constant\ -Wreal-q-constant\
-pedantic-errors -pedantic-errors
endif endif
###################################################################################################
#COMPILE SWITCHES
#-xf95-cpp-input: preprocessor #-xf95-cpp-input: preprocessor
#-ffree-line-length-132: restrict line length to the standard 132 characters #-ffree-line-length-132: restrict line length to the standard 132 characters
#-fno-range-check: disables checking if result can be represented by variable. Needs to be set to enable DAMASK_NaN #-fno-range-check: disables checking if result can be represented by variable. Needs to be set to enable DAMASK_NaN
@ -249,24 +265,36 @@ endif
#-Wsuggest-attribute=const: #-Wsuggest-attribute=const:
#-Wsuggest-attribute=noreturn: #-Wsuggest-attribute=noreturn:
#-Wsuggest-attribute=pure: #-Wsuggest-attribute=pure:
#-pedantic-errors:
#-Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter #-Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter
#-pedantic-errors:
################################################################################################### ###################################################################################################
#MORE OPTIONS FOR DEBUGGING DURING COMPILING #MORE OPTIONS FOR RUNTIME DEBUGGING
#-Wline-truncation: too many warnings because we have comments beyond character 132 #-Wline-truncation: too many warnings because we have comments beyond character 132
#-Warray-temporarieswarnings: because we have many temporary arrays (performance issue?): #-Warray-temporarieswarnings: because we have many temporary arrays (performance issue?):
#-Wimplicit-interface: #-Wimplicit-interface:
#-fmodule-private: #-fmodule-private:
#
#OPTIONS FOR DEGUBBING DURING RUNTIME DEBUG_OPTIONS_gfortran :=-g\
#-fcheck-bounds: check if an array index is too small (<1) or too large! -fbacktrace\
-fbounds-check\
-ffpe-trap=invalid,zero,overflow
###################################################################################################
#COMPILE SWITCHES FOR RUNTIME DEBUGGING
#-fbounds-check: check if an array index is too small (<1) or too large!
#-ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent) #-ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent)
# zero,\ # zero,\
# overflow,\ # overflow,\
# underflow,\ # underflow
# precision,\ ###################################################################################################
# denormal #COMPILE SWITCHES FOR RUNTIME DEBUGGING
################################################################################################## #-fbounds-check: check if an array index is too small (<1) or too large!
#-ffpe-trap=precision,\
# denormal, \
# underflow
ifeq "$(DEBUG)" "ON"
COMPILE_OPTIONS_$(F90) :=$(COMPILE_OPTIONS_$(F90)) $(DEBUG_OPTIONS_$(F90))
endif
PRECISION_ifort :=-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 PRECISION_ifort :=-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4
#-real-size 32: set precision to one of those 32/64/128 (= 4/8/16 bytes) for standard real (=8 for pReal) #-real-size 32: set precision to one of those 32/64/128 (= 4/8/16 bytes) for standard real (=8 for pReal)