Skip to content

Commit

Permalink
Merge pull request #317 from xcompact3d/pbartholomew08-patch-1
Browse files Browse the repository at this point in the history
Add DEBG macro to DEBUG builds
  • Loading branch information
slaizet authored Nov 19, 2024
2 parents afdf902 + bb2a111 commit 1bfe7e5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
58 changes: 28 additions & 30 deletions cmake/X3D_Compilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,35 @@ message(STATUS "COMP ID ${Fortran_COMPILER_NAME}")
message(STATUS "Fortran compiler name ${Fortran_COMPILER_NAME}")
message(STATUS "Fortran compiler version ${CMAKE_Fortran_COMPILER_VERSION}")

set(CMAKE_Fortran_PREPROCESS ON)
if (CMAKE_BUILD_TYPE MATCHES "DEBUG")
add_definitions("-DDEBUG -DDEBG")
endif (CMAKE_BUILD_TYPE MATCHES "DEBUG")

if (CMAKE_BUILD_TYPE MATCHES "DEV")
message(FATAL_ERROR "The code is not ready for DEV builds")
endif (CMAKE_BUILD_TYPE MATCHES "DEV")

if (ENABLE_INPLACE)
add_definitions("-DOVERWRITE")
endif ()

execute_process(
COMMAND git describe --tag --long --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DVERSION=\"${GIT_VERSION}\"")
option(DOUBLE_PRECISION "Build Xcompact with double precision" ON)
if (DOUBLE_PRECISION)
add_definitions("-DDOUBLE_PREC")
endif()

option(SINGLE_PRECISION_OUTPUT "Build XCompact with output in single precision" OFF)
if (SINGLE_PRECISION_OUTPUT)
add_definitions("-DSAVE_SINGLE")
endif()

if (Fortran_COMPILER_NAME MATCHES "GNU")
# gfortran
Expand Down Expand Up @@ -44,36 +72,6 @@ if (NOT FLAGS_SET)
set(FLAGS_SET 1 CACHE INTERNAL "Flags are set")
endif()

if (CMAKE_BUILD_TYPE MATCHES "DEBUG")
add_definitions("-DDEBUG")
endif (CMAKE_BUILD_TYPE MATCHES "DEBUG")

if (CMAKE_BUILD_TYPE MATCHES "DEV")
message(FATAL_ERROR "The code is not ready for DEV builds")
endif (CMAKE_BUILD_TYPE MATCHES "DEV")

if (ENABLE_INPLACE)
add_definitions("-DOVERWRITE")
endif ()

execute_process(
COMMAND git describe --tag --long --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DVERSION=\"${GIT_VERSION}\"")
option(DOUBLE_PRECISION "Build Xcompact with double precision" ON)
if (DOUBLE_PRECISION)
add_definitions("-DDOUBLE_PREC")
endif()

option(SINGLE_PRECISION_OUTPUT "Build XCompact with output in single precision" OFF)
if (SINGLE_PRECISION_OUTPUT)
add_definitions("-DSAVE_SINGLE")
endif()


if (IO_BACKEND MATCHES "mpi")
message(STATUS "Using mpi (default) IO backend")
elseif (IO_BACKEND MATCHES "adios2")
Expand Down
2 changes: 1 addition & 1 deletion cmake/compilers/X3D_flags_gnu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else (CMAKE_Fortran_COMPILER_VERSION GREATER_EQUAL "10")
endif (CMAKE_Fortran_COMPILER_VERSION GREATER_EQUAL "10")
# Flags extracted from the Makefile
set(X3D_FFLAGS_RELEASE "-O3 -funroll-loops -floop-optimize -g") #"-O3 -funroll-loops -floop-optimize -march=native")
set(X3D_FFLAGS_DEBUG "-g3 -Og -ffpe-trap=invalid,zero -fcheck=bounds -fimplicit-none") #"-DDEBUG -g3 -Og -ffpe-trap=invalid,zero -fcheck=all -fimplicit-none")
set(X3D_FFLAGS_DEBUG "-g -Og -ffpe-trap=invalid,zero -fcheck=bounds -fimplicit-none") #"-DDEBUG -g3 -Og -ffpe-trap=invalid,zero -fcheck=all -fimplicit-none")
# Dev flag below is new and not working yet
if (FIND_MPICH AND X3D_GNU10)
set(X3D_FFLAGS_DEV "${X3D_FFLAGS_DEBUG} -Wall -Wno-unused-function -Wno-integer-division")
Expand Down
1 change: 1 addition & 0 deletions src/poisson.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module decomp_2d_poisson
use decomp_2d_constants
use decomp_2d
use decomp_2d_fft
use decomp_2d_mpi, only: nrank

use mod_stret, only : alpha, beta
use param
Expand Down

0 comments on commit 1bfe7e5

Please sign in to comment.