[arrayfire] 45/79: Optimized compute detection code
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Jun 15 13:38:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository arrayfire.
commit 19f92d977738296175f4685c6324d7bf399077da
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Tue Jun 9 18:49:08 2015 -0400
Optimized compute detection code
---
src/backend/cuda/CMakeLists.txt | 66 ++++++++++-------------------------------
1 file changed, 16 insertions(+), 50 deletions(-)
diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt
index d546652..1d47cea 100644
--- a/src/backend/cuda/CMakeLists.txt
+++ b/src/backend/cuda/CMakeLists.txt
@@ -8,6 +8,8 @@ INCLUDE("${CMAKE_MODULE_PATH}/FindNVVM.cmake")
# Disables running cuda_compute_check.c when build windows using remote
OPTION(CUDA_COMPUTE_DETECT "Run autodetection of CUDA Architecture" ON)
+MARK_AS_ADVANCED(CUDA_COMPUTE_DETECT)
+
IF(CUDA_COMPUTE_DETECT AND NOT DEFINED COMPUTES_DETECTED_LIST)
INCLUDE("${CMAKE_MODULE_PATH}/CUDACheckCompute.cmake")
ENDIF()
@@ -17,7 +19,9 @@ IF( CUDA_COMPUTE_20
OR CUDA_COMPUTE_32
OR CUDA_COMPUTE_35
OR CUDA_COMPUTE_50
- OR CUDA_COMPUTE_52)
+ OR CUDA_COMPUTE_52
+ OR CUDA_COMPUTE_53
+ )
SET(FALLBACK OFF)
ELSE()
SET(FALLBACK ON)
@@ -36,59 +40,21 @@ FOREACH(COMPUTE_DETECTED ${COMPUTES_DETECTED_LIST})
SET(CUDA_COMPUTE_${COMPUTE_DETECTED} ON CACHE BOOL "" FORCE)
ENDFOREACH()
-OPTION(CUDA_COMPUTE_20 "CUDA Compute Capability 2.0" OFF)
-OPTION(CUDA_COMPUTE_30 "CUDA Compute Capability 3.0" OFF)
-OPTION(CUDA_COMPUTE_32 "CUDA Compute Capability 3.2" OFF)
-OPTION(CUDA_COMPUTE_35 "CUDA Compute Capability 3.5" OFF)
-OPTION(CUDA_COMPUTE_50 "CUDA Compute Capability 5.0" OFF)
-OPTION(CUDA_COMPUTE_52 "CUDA Compute Capability 5.2" OFF)
-
-MARK_AS_ADVANCED(CUDA_COMPUTE_DETECT CUDA_COMPUTE_20
- CUDA_COMPUTE_30 CUDA_COMPUTE_32 CUDA_COMPUTE_35
- CUDA_COMPUTE_50 CUDA_COMPUTE_52)
-
-IF(${CUDA_COMPUTE_20})
- SET(VERSION 20)
- SET(CUDA_GENERATE_CODE_${VERSION} "-gencode arch=compute_${VERSION},code=sm_${VERSION}")
- SET(CUDA_GENERATE_CODE ${CUDA_GENERATE_CODE} ${CUDA_GENERATE_CODE_${VERSION}})
- LIST(APPEND COMPUTE_VERSIONS "${VERSION}")
- MESSAGE(STATUS "Setting Compute ${VERSION} to ON")
-ENDIF()
-IF(${CUDA_COMPUTE_30})
- SET (VERSION 30)
- SET(CUDA_GENERATE_CODE_${VERSION} "-gencode arch=compute_${VERSION},code=sm_${VERSION}")
- SET(CUDA_GENERATE_CODE ${CUDA_GENERATE_CODE} ${CUDA_GENERATE_CODE_${VERSION}})
- LIST(APPEND COMPUTE_VERSIONS "${VERSION}")
- MESSAGE(STATUS "Setting Compute ${VERSION} to ON")
-ENDIF()
-IF(${CUDA_COMPUTE_32})
- SET(VERSION 32)
- SET(CUDA_GENERATE_CODE_${VERSION} "-gencode arch=compute_${VERSION},code=sm_${VERSION}")
- SET(CUDA_GENERATE_CODE ${CUDA_GENERATE_CODE} ${CUDA_GENERATE_CODE_${VERSION}})
- LIST(APPEND COMPUTE_VERSIONS "${VERSION}")
- MESSAGE(STATUS "Setting Compute ${VERSION} to ON")
-ENDIF()
-IF(${CUDA_COMPUTE_35})
- SET(VERSION 35)
- SET(CUDA_GENERATE_CODE_${VERSION} "-gencode arch=compute_${VERSION},code=sm_${VERSION}")
- SET(CUDA_GENERATE_CODE ${CUDA_GENERATE_CODE} ${CUDA_GENERATE_CODE_${VERSION}})
- LIST(APPEND COMPUTE_VERSIONS "${VERSION}")
- MESSAGE(STATUS "Setting Compute ${VERSION} to ON")
-ENDIF()
-IF(${CUDA_COMPUTE_50})
- SET(VERSION 50)
+MACRO(SET_COMPUTE VERSION)
SET(CUDA_GENERATE_CODE_${VERSION} "-gencode arch=compute_${VERSION},code=sm_${VERSION}")
SET(CUDA_GENERATE_CODE ${CUDA_GENERATE_CODE} ${CUDA_GENERATE_CODE_${VERSION}})
LIST(APPEND COMPUTE_VERSIONS "${VERSION}")
MESSAGE(STATUS "Setting Compute ${VERSION} to ON")
-ENDIF()
-IF(${CUDA_COMPUTE_52})
- SET(VERSION 52)
- SET(CUDA_GENERATE_CODE_${VERSION} "-gencode arch=compute_${VERSION},code=sm_${VERSION}")
- SET(CUDA_GENERATE_CODE ${CUDA_GENERATE_CODE} ${CUDA_GENERATE_CODE_${VERSION}})
- LIST(APPEND COMPUTE_VERSIONS "${VERSION}")
- MESSAGE(STATUS "Setting Compute ${VERSION} to ON")
-ENDIF()
+ENDMACRO(SET_COMPUTE)
+
+# Iterate over compute versions. Create variables and enable computes if needed
+FOREACH(VER 20 30 32 35 50 52 53)
+ OPTION(CUDA_COMPUTE_${VER} "CUDA Compute Capability ${VER}" OFF)
+ MARK_AS_ADVANCED(CUDA_COMPUTE_${VER})
+ IF(${CUDA_COMPUTE_${VER}})
+ SET_COMPUTE(${VER})
+ ENDIF()
+ENDFOREACH()
IF(UNIX)
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fvisibility=hidden)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list