mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-31 11:19:18 +00:00
Improve CUDA handling
Set CMAKE_CUDA_STANDARD to 14, allowing decay to 11 for CUDA 8 CUDA version reported in CMake summary Add target property CUDA_RESOLVE_DEVICE_SYMBOLS to ON
This commit is contained in:
parent
7fa7c03fd0
commit
df2f84dfb0
@ -2672,16 +2672,14 @@ if(DEFINED ENV{CUDA_GPU_ACCEL})
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA)
|
||||||
|
set(CMAKE_CUDA_STANDARD 14)
|
||||||
|
set(CMAKE_CUDA_EXTENSIONS ON)
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
include(CheckLanguage)
|
include(CheckLanguage)
|
||||||
check_language(CUDA)
|
check_language(CUDA)
|
||||||
if(CMAKE_CUDA_COMPILER)
|
if(CMAKE_CUDA_COMPILER)
|
||||||
enable_language(CUDA)
|
enable_language(CUDA)
|
||||||
set(CUDA_FOUND TRUE)
|
set(CUDA_FOUND TRUE)
|
||||||
if(NOT DEFINED CMAKE_CUDA_STANDARD)
|
|
||||||
set(CMAKE_CUDA_STANDARD 11)
|
|
||||||
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
set(ENABLE_CUDA OFF)
|
set(ENABLE_CUDA OFF)
|
||||||
endif()
|
endif()
|
||||||
@ -2689,12 +2687,19 @@ if(ENABLE_CUDA)
|
|||||||
find_package(CUDA REQUIRED)
|
find_package(CUDA REQUIRED)
|
||||||
set_package_properties(CUDA PROPERTIES
|
set_package_properties(CUDA PROPERTIES
|
||||||
URL "https://developer.nvidia.com/cuda-downloads"
|
URL "https://developer.nvidia.com/cuda-downloads"
|
||||||
DESCRIPTION "Library for parallel programming in Nvidia GPUs"
|
|
||||||
PURPOSE "Used in some processing block implementations."
|
PURPOSE "Used in some processing block implementations."
|
||||||
TYPE REQUIRED
|
TYPE REQUIRED
|
||||||
)
|
)
|
||||||
set(CMAKE_CUDA_STANDARD 14)
|
if(CUDA_FOUND)
|
||||||
if(NOT CUDA_FOUND)
|
set_package_properties(CUDA PROPERTIES
|
||||||
|
DESCRIPTION "Library for parallel programming in Nvidia GPUs (found: v${CUDA_VERSION_STRING})"
|
||||||
|
)
|
||||||
|
set(CMAKE_CUDA_COMPILER_ID "NVIDIA") # only for reporting purposes
|
||||||
|
set(CMAKE_CUDA_COMPILER_VERSION ${CUDA_VERSION_STRING}) # only for reporting purposes
|
||||||
|
else()
|
||||||
|
set_package_properties(CUDA PROPERTIES
|
||||||
|
DESCRIPTION "Library for parallel programming in Nvidia GPUs"
|
||||||
|
)
|
||||||
set(ENABLE_CUDA OFF)
|
set(ENABLE_CUDA OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -2704,7 +2709,6 @@ if(ENABLE_CUDA)
|
|||||||
message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'")
|
message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'")
|
||||||
else()
|
else()
|
||||||
message(STATUS "NVIDIA CUDA GPU Acceleration will be not enabled.")
|
message(STATUS "NVIDIA CUDA GPU Acceleration will be not enabled.")
|
||||||
message(STATUS " Enable it with 'cmake -DENABLE_CUDA=ON ..' to add support for GPU-based acceleration using CUDA.")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@ -3156,6 +3160,9 @@ endif()
|
|||||||
message(STATUS "CMake version: ${CMAKE_VERSION}")
|
message(STATUS "CMake version: ${CMAKE_VERSION}")
|
||||||
message(STATUS "The CXX compiler identification is ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}. Standard: C++${CMAKE_CXX_STANDARD}.")
|
message(STATUS "The CXX compiler identification is ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}. Standard: C++${CMAKE_CXX_STANDARD}.")
|
||||||
message(STATUS "The C compiler identification is ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}. Standard: C${CMAKE_C_STANDARD}.")
|
message(STATUS "The C compiler identification is ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}. Standard: C${CMAKE_C_STANDARD}.")
|
||||||
|
if(CUDA_FOUND)
|
||||||
|
message(STATUS "The CUDA compiler identification is ${CMAKE_CUDA_COMPILER_ID} ${CMAKE_CUDA_COMPILER_VERSION}. Standard: C++${CMAKE_CUDA_STANDARD}.")
|
||||||
|
endif()
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
file(REMOVE ${CMAKE_BINARY_DIR}/features.log)
|
file(REMOVE ${CMAKE_BINARY_DIR}/features.log)
|
||||||
file(WRITE ${CMAKE_BINARY_DIR}/features.log "**********************************\n")
|
file(WRITE ${CMAKE_BINARY_DIR}/features.log "**********************************\n")
|
||||||
|
@ -43,15 +43,13 @@ set(TRACKING_LIB_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_CUDA)
|
if(ENABLE_CUDA)
|
||||||
|
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -O3; -use_fast_math -default-stream per-thread")
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||||
set(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} cuda_multicorrelator.cu)
|
set(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} cuda_multicorrelator.cu)
|
||||||
set(TRACKING_LIB_HEADERS ${TRACKING_LIB_HEADERS} cuda_multicorrelator.h)
|
set(TRACKING_LIB_HEADERS ${TRACKING_LIB_HEADERS} cuda_multicorrelator.h)
|
||||||
else()
|
else()
|
||||||
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++11;-O3; -use_fast_math -default-stream per-thread")
|
|
||||||
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
|
||||||
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set(LIB_TYPE STATIC) #set the lib type
|
cuda_add_library(cuda_correlator_lib STATIC cuda_multicorrelator.h cuda_multicorrelator.cu)
|
||||||
cuda_add_library(cuda_correlator_lib ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -111,6 +109,7 @@ if(ENABLE_CUDA)
|
|||||||
set_target_properties(tracking_libs PROPERTIES
|
set_target_properties(tracking_libs PROPERTIES
|
||||||
CUDA_SEPARABLE_COMPILATION ON
|
CUDA_SEPARABLE_COMPILATION ON
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
|
CUDA_RESOLVE_DEVICE_SYMBOLS ON
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user