Skip to content

Commit d9c6856

Browse files
committed
Reduce build time/size by filtering support list to match original result
1 parent c0e8584 commit d9c6856

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cmake/CUDA.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ set(MSG_CUDA_MAP "\n\n"
1010
"Reference https://developer.nvidia.com/cuda-gpus#compute for arch and family name\n\n"
1111
)
1212

13+
set(USELESS_CUDA_ARCH "32;37;52;53;61;62;72;87")
14+
1315
add_definitions(-DCUB_IGNORE_DEPRECATED_CPP_DIALECT -DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT)
1416

1517
option(XMRIG_LARGEGRID "Support large CUDA block count > 128" ON)
@@ -64,6 +66,15 @@ list(REMOVE_ITEM SUPPORT_CUDA_ARCH "")
6466
message(STATUS "CUDA Architectures supported by [${CUDA_NVCC_EXECUTABLE}]: ${SUPPORT_CUDA_ARCH}")
6567
set(DEFAULT_CUDA_ARCH "${SUPPORT_CUDA_ARCH}")
6668

69+
# Filter bloaty architectures
70+
foreach(CUDA_ARCH_ELEM ${USELESS_CUDA_ARCH})
71+
list(FIND DEFAULT_CUDA_ARCH "${CUDA_ARCH_ELEM}" POS)
72+
if(POS GREATER -1)
73+
list(REMOVE_ITEM DEFAULT_CUDA_ARCH "${CUDA_ARCH_ELEM}")
74+
endif()
75+
endforeach()
76+
message(STATUS "CUDA Architectures filtered defaults: ${DEFAULT_CUDA_ARCH}")
77+
6778
set(CUDA_ARCH "${DEFAULT_CUDA_ARCH}" CACHE STRING "Set GPU architecture (semicolon separated list, e.g. '-DCUDA_ARCH=20;35;60')")
6879

6980
# validate architectures (only numbers are allowed)
@@ -116,6 +127,7 @@ endforeach()
116127
unset(POS)
117128
unset(CUDA_ARCH_ELEM)
118129
unset(SUPPORT_CUDA_ARCH)
130+
unset(USELESS_CUDA_ARCH)
119131
unset(MSG_CUDA_MAP)
120132
list(SORT CUDA_ARCH)
121133
list(REMOVE_DUPLICATES CUDA_ARCH)

0 commit comments

Comments
 (0)