Skip to content

Commit

Permalink
Undo -DNDEBUG flag for debug rocm builds & adjust axom spack package …
Browse files Browse the repository at this point in the history
…recipe accordingly, and undo NDEBUG requirement for mesh_tester hip policy
  • Loading branch information
bmhan12 committed Feb 5, 2025
1 parent 35b5e4b commit 716bde3
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion host-configs/[email protected]_hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set(CMAKE_Fortran_FLAGS "-ef" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -DNDEBUG" CACHE STRING "")
set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g" CACHE STRING "")

#------------------------------------------------------------------------------
# MPI
Expand Down
2 changes: 0 additions & 2 deletions host-configs/[email protected]_hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ set(CMAKE_Fortran_FLAGS "-Mfreeform" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -DNDEBUG" CACHE STRING "")

#------------------------------------------------------------------------------
# MPI
#------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions host-configs/[email protected]_hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ set(CMAKE_Fortran_FLAGS "-Mfreeform" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -DNDEBUG" CACHE STRING "")

#------------------------------------------------------------------------------
# MPI
#------------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions host-configs/[email protected]_hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ set(CMAKE_INSTALL_RPATH "/usr/WS1/axom/libs/toss_4_x86_64_ib_cray/2024_10_29_13_

set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g" CACHE STRING "")


#------------------------------------------------------------------------------
# Compilers
#------------------------------------------------------------------------------
Expand Down Expand Up @@ -41,8 +44,6 @@ set(CMAKE_Fortran_FLAGS "-ef" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -DNDEBUG" CACHE STRING "")

#------------------------------------------------------------------------------
# MPI
#------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions host-configs/[email protected]_hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ set(CMAKE_Fortran_FLAGS "-Mfreeform" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -DNDEBUG" CACHE STRING "")

#------------------------------------------------------------------------------
# MPI
#------------------------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions host-configs/[email protected]_hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ set(CMAKE_Fortran_FLAGS "-Mfreeform" CACHE STRING "")

set(ENABLE_FORTRAN ON CACHE BOOL "")

set(CMAKE_CXX_FLAGS_DEBUG "-O1 -g -DNDEBUG" CACHE STRING "")

#------------------------------------------------------------------------------
# MPI
#------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions scripts/spack/packages/axom/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ def initconfig_compiler_entries(self):
if "+cpp14" in spec and spec.satisfies("@:0.6.1"):
entries.append(cmake_cache_string("BLT_CXX_STD", "c++14", ""))

# Add optimization flag workaround for Debug builds with cray compiler or newer HIP
if "+rocm" in spec:
entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-O1 -g -DNDEBUG"))
# Add optimization flag workaround for builds with cray compiler
if spec.satisfies("%cce"):
entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-O1 -g"))

return entries

Expand Down
15 changes: 1 addition & 14 deletions src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,7 @@ if(AXOM_ENABLE_QUEST)
set (_policies "raja_seq")
blt_list_append(TO _policies ELEMENTS "raja_omp" IF AXOM_ENABLE_OPENMP)
blt_list_append(TO _policies ELEMENTS "raja_cuda" IF AXOM_ENABLE_CUDA)

# Test with HIP policy for select optimization flags.
# Check for Debug flags that have been overwritten.
if(AXOM_ENABLE_HIP)
if((CMAKE_BUILD_TYPE MATCHES "(Release|RelWithDebInfo)") OR
(CMAKE_BUILD_TYPE MATCHES "Debug" AND
CMAKE_CXX_FLAGS_DEBUG MATCHES "\-O1 \-g \-DNDEBUG"))
list(APPEND _policies "raja_hip")
else()
message(STATUS
"HIP policy for mesh_tester executable is not being tested"
)
endif()
endif()
blt_list_append(TO _policies ELEMENTS "raja_hip" IF AXOM_ENABLE_HIP)

foreach(_method ${_methods})
foreach(_policy ${_policies})
Expand Down
14 changes: 7 additions & 7 deletions src/tools/mesh_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ using seq_exec = axom::SEQ_EXEC;
using cuda_exec = seq_exec;
#endif

#if defined(AXOM_USE_HIP) && defined(AXOM_USE_UMPIRE) && defined(NDEBUG)
#if defined(AXOM_USE_HIP) && defined(AXOM_USE_UMPIRE)
constexpr int HIP_BLOCK_SIZE = 256;
using hip_exec = axom::HIP_EXEC<HIP_BLOCK_SIZE>;
#else
Expand Down Expand Up @@ -139,7 +139,7 @@ const std::map<std::string, RuntimePolicy> Input::s_validPolicies({
#ifdef AXOM_USE_CUDA
, {"raja_cuda", raja_cuda}
#endif
#if defined(AXOM_USE_HIP) && defined(NDEBUG)
#if defined(AXOM_USE_HIP)
, {"raja_hip", raja_hip}
#endif
#endif
Expand Down Expand Up @@ -181,7 +181,7 @@ void Input::parse(int argc, char** argv, axom::CLI::App& app)
#ifdef AXOM_USE_CUDA
pol_sstr << "\nSet to 'raja_cuda' or 3 to use the RAJA CUDA policy.";
#endif
#if defined(AXOM_USE_HIP) && defined(NDEBUG)
#if defined(AXOM_USE_HIP)
pol_sstr << "\nSet to 'raja_hip' or 4 to use the RAJA HIP policy.";
#endif
#endif
Expand Down Expand Up @@ -705,7 +705,7 @@ int main(int argc, char** argv)
params.intersectionThreshold);
break;
#endif
#if defined(AXOM_USE_HIP) && defined(NDEBUG)
#if defined(AXOM_USE_HIP)
case raja_hip:
collisions =
naiveIntersectionAlgorithm<hip_exec>(surface_mesh,
Expand Down Expand Up @@ -762,7 +762,7 @@ int main(int argc, char** argv)
params.intersectionThreshold);
break;
#endif
#if defined(AXOM_USE_HIP) && defined(NDEBUG)
#if defined(AXOM_USE_HIP)
case raja_hip:
quest::findTriMeshIntersectionsBVH<hip_exec, double>(
surface_mesh,
Expand Down Expand Up @@ -823,7 +823,7 @@ int main(int argc, char** argv)
params.intersectionThreshold);
break;
#endif
#if defined(AXOM_USE_HIP) && defined(AXOM_USE_UMPIRE) && defined(NDEBUG)
#if defined(AXOM_USE_HIP) && defined(AXOM_USE_UMPIRE)
case raja_hip:
quest::findTriMeshIntersectionsImplicitGrid<hip_exec, double>(
surface_mesh,
Expand Down Expand Up @@ -882,7 +882,7 @@ int main(int argc, char** argv)
params.intersectionThreshold);
break;
#endif
#if defined(AXOM_USE_HIP) && defined(AXOM_USE_UMPIRE) && defined(NDEBUG)
#if defined(AXOM_USE_HIP) && defined(AXOM_USE_UMPIRE)
case raja_hip:
quest::findTriMeshIntersectionsUniformGrid<hip_exec, double>(
surface_mesh,
Expand Down

0 comments on commit 716bde3

Please sign in to comment.