Skip to content

Commit e930209

Browse files
committed
refine
1 parent 1358250 commit e930209

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

cmake/external/cub.cmake

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ set(CUB_PREFIX_DIR ${CUB_PATH})
2424

2525
set(CUB_SOURCE_DIR ${PADDLE_SOURCE_DIR}/third_party/cub)
2626

27-
# cub 2.1.0 is not compatible with current thrust version
28-
add_definitions(-DTHRUST_IGNORE_CUB_VERSION_CHECK)
29-
if(${CMAKE_CUDA_COMPILER_VERSION} EQUAL 11.8)
30-
set(cub_patches "${PADDLE_SOURCE_DIR}/patches/cub")
31-
message(STATUS "Add cub patches: ${cub_patches}")
32-
include_directories(${cub_patches})
33-
endif()
34-
35-
if(NOT WITH_GPU)
36-
set(CUB_TAG 1.8.0)
27+
if(${CMAKE_CUDA_COMPILER_VERSION} GREATER_EQUAL 11.6)
28+
# cuda_11.6/11.7/11.8‘s own cub is 1.15.0, which will cause compiling error in windows.
29+
set(CUB_TAG 2.1.0)
3730
execute_process(COMMAND git --git-dir=${CUB_SOURCE_DIR}/.git
3831
--work-tree=${CUB_SOURCE_DIR} checkout ${CUB_TAG})
32+
# cub 2.1.0 is not compatible with current thrust version
33+
add_definitions(-DTHRUST_IGNORE_CUB_VERSION_CHECK)
34+
if(${CMAKE_CUDA_COMPILER_VERSION} EQUAL 11.8)
35+
set(cub_patches "${PADDLE_SOURCE_DIR}/patches/cub")
36+
message(STATUS "Add cub patches: ${cub_patches}")
37+
include_directories(${cub_patches})
38+
endif()
39+
else()
40+
set(CUB_TAG 1.8.0)
3941
endif()
4042

4143
set(CUB_INCLUDE_DIR ${CUB_SOURCE_DIR})

0 commit comments

Comments
 (0)