Skip to content

Commit

Permalink
Fix errors for high version GPU.
Browse files Browse the repository at this point in the history
ISSUE=4622423

git-svn-id: https://svn.baidu.com/idl/trunk/paddle@1503 1ad973e4-5ce8-4261-8a94-b56d1f490c56
  • Loading branch information
wangjiangb committed Sep 2, 2016
1 parent 6968191 commit 0b02a22
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(CheckCXXSymbolExists)
# is_c: is C flag or C++ flag, bool type.
# src_list: The list name which the flag name will be append to.
# flag_name: the flag name for compiler, such as '-Werror' '-Wall' etc
# rest arguments: not used.
# rest arguments: not used.
function(safe_set_flag is_c src_list flag_name)
string(REPLACE "-" "_" safe_name ${flag_name})
string(REPLACE "=" "_" safe_name ${safe_name})
Expand Down Expand Up @@ -44,7 +44,7 @@ CHECK_CXX_SYMBOL_EXISTS(UINT64_MAX "stdint.h" UINT64_MAX_EXISTS)
if(NOT UINT64_MAX_EXISTS)
set(CMAKE_REQUIRED_DEFINITIONS -D__STDC_LIMIT_MACROS)
CHECK_CXX_SYMBOL_EXISTS(UINT64_MAX "stdint.h" UINT64_MAX_EXISTS_HERE)
if(UINT64_MAX_EXISTS_HERE)
if(UINT64_MAX_EXISTS_HERE)
set(CMAKE_REQUIRED_DEFINITIONS)
add_definitions(-D__STDC_LIMIT_MACROS)
else()
Expand Down Expand Up @@ -75,12 +75,13 @@ endforeach()
# So, don't set these flags here.

foreach(capability 30 35 50)
list(APPEND __arch_flags "-gencode arch=compute_${capability},code=sm_${capability}")
list(APPEND __arch_flags " -gencode arch=compute_${capability},code=sm_${capability}")
endforeach()

message(${__arch_flags})
if (CUDA_VERSION VERSION_GREATER "7.0")
list(APPEND __arch_flags "-gencode arch=compute_52,code=sm_52")
list(APPEND __arch_flags " -gencode arch=compute_52,code=sm_52")
endif()

set(CUDA_NVCC_FLAGS ${__arch_flags} ${CUDA_NVCC_FLAGS})

set(CUDA_NVCC_FLAGS ${__arch_flags} ${CUDA_NVCC_FLAGS})

0 comments on commit 0b02a22

Please sign in to comment.