CMake: support CUDA 9 toolkit, and automatically disable sm_2x binaries.

Fermi cards (GTX 4xx and 5xx) are no longer supported with this version, so
we can keep supporting both CUDA 8 and 9 for a while.
This commit is contained in:
Brecht Van Lommel 2017-10-01 14:04:34 +02:00
parent 22ecea9e38
commit f55735e533

@ -321,7 +321,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}") set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
# warn for other versions # warn for other versions
if(CUDA_VERSION MATCHES "80") if(CUDA_VERSION MATCHES "80" OR CUDA_VERSION MATCHES "90")
else() else()
message(WARNING message(WARNING
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, " "CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
@ -399,6 +399,9 @@ if(WITH_CYCLES_CUDA_BINARIES)
endmacro() endmacro()
foreach(arch ${CYCLES_CUDA_BINARIES_ARCH}) foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
if(CUDA_VERSION MATCHES "90" AND ${arch} MATCHES "sm_2.")
message(STATUS "CUDA binaries for ${arch} disabled, not supported by CUDA 9.")
else()
# Compile regular kernel # Compile regular kernel
CYCLES_CUDA_KERNEL_ADD(${arch} kernel "" "${cuda_sources}" FALSE) CYCLES_CUDA_KERNEL_ADD(${arch} kernel "" "${cuda_sources}" FALSE)
CYCLES_CUDA_KERNEL_ADD(${arch} filter "" "${cuda_filter_sources}" FALSE) CYCLES_CUDA_KERNEL_ADD(${arch} filter "" "${cuda_filter_sources}" FALSE)
@ -407,6 +410,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
# Compile split kernel # Compile split kernel
CYCLES_CUDA_KERNEL_ADD(${arch} kernel_split "-D__SPLIT__" ${cuda_sources} FALSE) CYCLES_CUDA_KERNEL_ADD(${arch} kernel_split "-D__SPLIT__" ${cuda_sources} FALSE)
endif() endif()
endif()
endforeach() endforeach()
add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins}) add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins})