Skip to content

Commit e19495f

Browse files
committed
feat:support CUDA 13.0+
1 parent 6f00250 commit e19495f

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

source/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ if(NOT DEEPMD_C_ROOT)
2929
set_if_higher(CMAKE_CXX_STANDARD 14)
3030
endif()
3131

32+
# CUDA 13.0+ requires C++17
33+
if(USE_CUDA_TOOLKIT)
34+
if(DEFINED CUDAToolkit_VERSION AND CUDAToolkit_VERSION VERSION_GREATER_EQUAL
35+
"13.0")
36+
set_if_higher(CMAKE_CXX_STANDARD 17)
37+
message(
38+
STATUS "CUDA ${CUDAToolkit_VERSION} detected, setting C++ standard to 17")
39+
endif()
40+
endif()
41+
3242
if(ENABLE_PADDLE)
3343
if(NOT DEFINED PADDLE_INFERENCE_DIR)
3444
# message(FATAL_ERROR "Make sure PADDLE_INFERENCE_DIR is set when

source/lib/src/gpu/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ if(USE_CUDA_TOOLKIT)
4343
message(FATAL_ERROR "CUDA version must be >= 9.0")
4444
endif()
4545

46+
# CUDA 13.0+ requires C++17
47+
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL "13.0")
48+
set(CMAKE_CUDA_STANDARD 17)
49+
message(
50+
STATUS
51+
"CUDA ${CMAKE_CUDA_COMPILER_VERSION} detected, setting C++ standard to 17"
52+
)
53+
endif()
54+
4655
message(STATUS "NVCC version is " ${CMAKE_CUDA_COMPILER_VERSION})
4756

4857
# arch will be configured by CMAKE_CUDA_ARCHITECTURES

0 commit comments

Comments
 (0)