Skip to content

Commit

Permalink
chore(gpu): add debug/release modes
Browse files Browse the repository at this point in the history
  • Loading branch information
pdroalves committed Sep 5, 2024
1 parent e1a25a1 commit a1a01b2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion backends/tfhe-cuda-backend/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,21 @@ endif()

add_compile_definitions(CUDA_ARCH=${CUDA_ARCH})

# Check if the DEBUG flag is defined
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Debug mode
message("Compiling in Debug mode")
add_definitions(-DDEBUG)
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -O0 -G -g")
else()
# Release mode
message("Compiling in Release mode")
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -O3")
endif()

# in production, should use -arch=sm_70 --ptxas-options=-v to see register spills -lineinfo for better debugging
set(CMAKE_CUDA_FLAGS
"${CMAKE_CUDA_FLAGS} -ccbin ${CMAKE_CXX_COMPILER} -O3 \
"${CMAKE_CUDA_FLAGS} -ccbin ${CMAKE_CXX_COMPILER} ${OPTIMIZATION_FLAGS}\
-std=c++17 --no-exceptions --expt-relaxed-constexpr -rdc=true \
--use_fast_math -Xcompiler -fPIC")

Expand Down

0 comments on commit a1a01b2

Please sign in to comment.