]> https://gitweb.dealii.org/ - dealii.git/commitdiff
set default compute capability to 3.5, or check that something valid was specified
authorKarl Ljungkvist <k.ljungkvist@gmail.com>
Tue, 1 Nov 2016 16:01:00 +0000 (17:01 +0100)
committerKarl Ljungkvist <k.ljungkvist@gmail.com>
Wed, 2 Nov 2016 07:31:08 +0000 (08:31 +0100)
cmake/configure/configure_1_cuda.cmake
cmake/setup_write_config.cmake

index 84e09feff2712cecfd827c431b87699d15cbb77c..a855dcd741c4fbaa41f18e354797d84b6b0d403d 100644 (file)
@@ -41,6 +41,34 @@ MACRO(FEATURE_CUDA_FIND_EXTERNAL var)
 
   IF(CUDA_FOUND)
 
+    IF("${CUDA_NVCC_FLAGS}" MATCHES "-arch")
+
+      # Compute Capability specified explicitly.
+      # Now parse:
+
+      IF("${CUDA_NVCC_FLAGS}" MATCHES "-arch[ ]*sm_([0-9]*)")
+        SET(CUDA_COMPUTE_CAPABILITY "${CMAKE_MATCH_1}")
+      ELSEIF("${CUDA_NVCC_FLAGS}" MATCHES "-arch=sm_([0-9]*)")
+        SET(CUDA_COMPUTE_CAPABILITY "${CMAKE_MATCH_1}")
+      ELSE()
+        MESSAGE( FATAL_ERROR "Missformed Compute Capability specified")
+      ENDIF()
+
+      IF("${CUDA_COMPUTE_CAPABILITY}" LESS "35")
+        MESSAGE( FATAL_ERROR "Too low CUDA Compute Capability specified -- deal.II requires at least 3.5 ")
+      ENDIF()
+    ENDIF()
+
+    IF( NOT DEFINED CUDA_COMPUTE_CAPABILITY)
+      # Set to use compute capability 3.5 by default
+      SET(CUDA_COMPUTE_CAPABILITY "35")
+      SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -arch=sm_35)
+    ENDIF()
+
+    # Export further definitions
+    STRING(SUBSTRING "${CUDA_COMPUTE_CAPABILITY}" 0 1 CUDA_COMPUTE_CAPABILITY_MAJOR)
+    STRING(SUBSTRING "${CUDA_COMPUTE_CAPABILITY}" 1 1 CUDA_COMPUTE_CAPABILITY_MINOR)
+
     SET(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE FALSE)
 
     SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++11)
index c87aa076c2240ed8ceb9ea13926751570d743c98..96801beae21cf9918cfebfe9e7c05a19f6196764 100644 (file)
@@ -201,6 +201,10 @@ FOREACH(_feature ${_deal_ii_features_sorted})
     IF(_feature MATCHES "MPI" AND DEFINED OMPI_VERSION)
       _detailed("#            OMPI_VERSION = ${OMPI_VERSION}\n")
     ENDIF()
+    IF(_feature MATCHES "CUDA" AND DEFINED CUDA_COMPUTE_CAPABILITY)
+      _detailed("#            CUDA_COMPUTE_CAPABILITY = ${CUDA_COMPUTE_CAPABILITY_MAJOR}.${CUDA_COMPUTE_CAPABILITY_MINOR}\n")
+    ENDIF()
+
 
     #
     # Print out ${_feature}_DIR:

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.