Minor correction concerning compilation compatibility with CUDA 9.0
authorSeyyed Hossein Hasanpour <coderx7@gmail.com>
Mon, 9 Apr 2018 05:36:49 +0000 (10:06 +0430)
committerWook Song <wook16.song@samsung.com>
Thu, 23 Jan 2020 13:50:39 +0000 (22:50 +0900)
Since CUDA 9.0 doesn't support sm_20 and sm_21 anymore. This PR allows Caffe to compile with CUDA 9.0 and newer versions successfully.
This addresses the discussion concerning [#6237](https://github.com/BVLC/caffe/pull/6237) in [master (#6237)](https://github.com/BVLC/caffe/commit/cb150eca6d593ddb85e53acd05b8dcf709ea8337#diff-2004a3d3e6b4ed2e2812bb0b4b998f18)

cmake/Cuda.cmake

index 9325674..9ced9f9 100644 (file)
@@ -109,8 +109,8 @@ function(caffe_select_nvcc_arch_flags out_variable)
   set(__nvcc_flags "")
   set(__nvcc_archs_readable "")
 
-  string(COMPARE GREATER_EQUAL "${CUDA_VERSION}" "9.1" iscudanewerthan91)
-  if(iscudanewerthan91)
+  string(COMPARE GREATER_EQUAL "${CUDA_VERSION}" "9.0" iscudanewerthan90)
+  if(iscudanewerthan90)
     string(REPLACE "21(20)" "" __cuda_arch_bin "${__cuda_arch_bin}")
     string(REPLACE "20" "" __cuda_arch_bin "${__cuda_arch_bin}")
   endif()