You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to chase down what I think is an array-out-of-bounds error, so I've turned on the debug option in CMake. However, it isn't returning an information which led me to wonder if the debug option actually turns on checking bounds. I don't see any reference to bounds checking or floating point exceptions in the CMake files. We use both of those options regularly in debugging GEOS-Chem (that is the BOUNDS=y FPE=y switches in GNU Make) so we should also include them in CMake. In Makefile_Header.mk:
# Turn on checking for floating-point exceptions
# These are approximately equivalent to -fpe0 -ftrapuv in IFORT
# NOTE: GNU Fortran 4.4.7 does not allow for -finit-real-snan, so
# we will only add this flag for versions newer than 4.4.7
REGEXP :=(^[Yy]|^[Yy][Ee][Ss])
ifeq ($(shell [[ "$(FPE)" =~ $(REGEXP) ]] && echo true),true)
FFLAGS += -ffpe-trap=invalid,zero,overflow
ifeq ($(NEWER_THAN_447),1)
FFLAGS += -finit-real=snan
endif
endif
ifeq ($(shell [[ "$(FPEX)" =~ $(REGEXP) ]] && echo true),true)
FFLAGS += -ffpe-trap=invalid,zero,overflow
ifeq ($(NEWER_THAN_447),1)
FFLAGS += -finit-real=snan
endif
endif
# Add option for "array out of bounds" checking
REGEXP := (^[Yy]|^[Yy][Ee][Ss])
ifeq ($(shell [[ "$(BOUNDS)" =~ $(REGEXP) ]] && echo true),true)
FFLAGS += -fbounds-check
endif
@LiamBindle can you confirm that (1) these options aren't already included in GEOS-Chem Classic's CMake options so far? and (2) advise on the best way to add this capability? If I understand correctly, I think we need to add to GC-DefaultCompilerOptions.cmake. Does it makes sense to include these in the debug option or as separate options?
The text was updated successfully, but these errors were encountered:
@msulprizio Yeah, you're correct, and GC-DefaultCompilerOptions.cmake is the right place to add these. I think it makes sense to add these--initially I omitted most of the debug flags with the idea that we'd add them on a need-to-use basis (to avoid carrying forward any old unsed flags). Feel free to update these to whatever you think is appropriate.
ifort's debug options for build type Debug are set here:
Oh, one more thing that I think might be relevent. Just so you know, you can set extra compiler options for your build directory by setting CMAKE_Fortran_FLAGS (see here). I think the flags that you're talking about should be added to the DEBUG flags, but I just wanted to mention this feature to increase awareness of it. This feature is useful for building GEOS-Chem with uncommon compiler options, like compiler options for using TAU or architecture-specific optimizations.
Also heads up that file geos-chem/CMakeScripts/GC-DefaultCompilerOptions.cmake is deleted starting 13.0.0. Once this update goes into 12.8.1 we should also port it to dev/13.0.0.
I am trying to chase down what I think is an array-out-of-bounds error, so I've turned on the debug option in CMake. However, it isn't returning an information which led me to wonder if the debug option actually turns on checking bounds. I don't see any reference to bounds checking or floating point exceptions in the CMake files. We use both of those options regularly in debugging GEOS-Chem (that is the
BOUNDS=y FPE=y
switches in GNU Make) so we should also include them in CMake. InMakefile_Header.mk
:@LiamBindle can you confirm that (1) these options aren't already included in GEOS-Chem Classic's CMake options so far? and (2) advise on the best way to add this capability? If I understand correctly, I think we need to add to
GC-DefaultCompilerOptions.cmake
. Does it makes sense to include these in the debug option or as separate options?The text was updated successfully, but these errors were encountered: