mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Fix CUDA building
This commit is contained in:
parent
a9472dea30
commit
dff95c19c3
@ -2679,7 +2679,7 @@ if(ENABLE_CUDA)
|
||||
enable_language(CUDA)
|
||||
set(CUDA_FOUND TRUE)
|
||||
if(NOT DEFINED CMAKE_CUDA_STANDARD)
|
||||
set(CMAKE_CUDA_STANDARD 11)
|
||||
set(CMAKE_CUDA_STANDARD 14)
|
||||
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
else()
|
||||
@ -2693,6 +2693,7 @@ if(ENABLE_CUDA)
|
||||
PURPOSE "Used in some processing block implementations."
|
||||
TYPE REQUIRED
|
||||
)
|
||||
set(CMAKE_CUDA_STANDARD 14)
|
||||
if(NOT CUDA_FOUND)
|
||||
set(ENABLE_CUDA OFF)
|
||||
endif()
|
||||
|
@ -107,14 +107,22 @@ target_include_directories(tracking_adapters
|
||||
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
||||
)
|
||||
|
||||
if(ENABLE_CUDA AND NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_link_libraries(tracking_adapters
|
||||
PUBLIC
|
||||
${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(tracking_adapters
|
||||
PUBLIC
|
||||
${CUDA_INCLUDE_DIRS}
|
||||
if(ENABLE_CUDA)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_include_directories(tracking_adapters
|
||||
PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(tracking_adapters
|
||||
PUBLIC ${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(tracking_adapters
|
||||
PUBLIC ${CUDA_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
set_target_properties(tracking_adapters PROPERTIES
|
||||
CUDA_SEPARABLE_COMPILATION ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -103,14 +103,22 @@ if(GNURADIO_USES_STD_POINTERS)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUDA AND NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_link_libraries(tracking_gr_blocks
|
||||
PUBLIC
|
||||
${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(tracking_gr_blocks
|
||||
PUBLIC
|
||||
${CUDA_INCLUDE_DIRS}
|
||||
if(ENABLE_CUDA)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_include_directories(tracking_gr_blocks
|
||||
PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(tracking_gr_blocks
|
||||
PUBLIC ${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(tracking_gr_blocks
|
||||
PUBLIC ${CUDA_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
set_target_properties(tracking_gr_blocks PROPERTIES
|
||||
CUDA_SEPARABLE_COMPILATION ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -177,7 +177,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
|
||||
d_code_phase_step_chips = static_cast<double>(d_code_freq_chips) / static_cast<double>(d_fs_in);
|
||||
const double T_chip_mod_seconds = 1 / d_code_freq_chips;
|
||||
const double T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
|
||||
T_prn_mod_samples T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
const double T_prn_mod_samples = T_prn_mod_seconds * static_cast<double>(d_fs_in);
|
||||
|
||||
d_correlation_length_samples = round(T_prn_mod_samples);
|
||||
|
||||
|
@ -48,7 +48,7 @@ typedef std::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc>
|
||||
#else
|
||||
typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc>
|
||||
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr;
|
||||
#end
|
||||
#endif
|
||||
|
||||
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
|
||||
gps_l1_ca_dll_pll_make_tracking_gpu_cc(
|
||||
|
@ -42,20 +42,16 @@ set(TRACKING_LIB_HEADERS
|
||||
exponential_smoother.h
|
||||
)
|
||||
|
||||
set(OPT_TRACKING_LIBRARIES "")
|
||||
set(OPT_TRACKING_INCLUDES "")
|
||||
if(ENABLE_CUDA)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
set(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} cuda_multicorrelator.cu)
|
||||
set(TRACKING_LIB_HEADERS ${TRACKING_LIB_HEADERS} cuda_multicorrelator.h)
|
||||
else()
|
||||
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++11;-O3; -use_fast_math -default-stream per-thread")
|
||||
list(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_30,code=sm_30; -std=c++14;-O3; -use_fast_math -default-stream per-thread")
|
||||
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
|
||||
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LIB_TYPE STATIC) #set the lib type
|
||||
cuda_add_library(CUDA_CORRELATOR_LIB ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu)
|
||||
set(OPT_TRACKING_LIBRARIES ${OPT_TRACKING_LIBRARIES} CUDA_CORRELATOR_LIB)
|
||||
set(OPT_TRACKING_INCLUDES ${OPT_TRACKING_INCLUDES} ${CUDA_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -94,20 +90,27 @@ target_link_libraries(tracking_libs
|
||||
Volkgnsssdr::volkgnsssdr
|
||||
core_system_parameters
|
||||
algorithms_libs
|
||||
${OPT_TRACKING_LIBRARIES}
|
||||
PRIVATE
|
||||
gnss_sdr_flags
|
||||
Glog::glog
|
||||
)
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_link_libraries(tracking_libs
|
||||
PUBLIC
|
||||
${OPT_TRACKING_LIBRARIES}
|
||||
)
|
||||
target_include_directories(tracking_libs
|
||||
PUBLIC
|
||||
${OPT_TRACKING_INCLUDES}
|
||||
if(ENABLE_CUDA)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_include_directories(tracking_libs
|
||||
PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(tracking_libs
|
||||
PUBLIC ${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(tracking_libs
|
||||
PUBLIC ${CUDA_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
set_target_properties(tracking_libs PROPERTIES
|
||||
CUDA_SEPARABLE_COMPILATION ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -120,9 +120,22 @@ else()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUDA)
|
||||
if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_include_directories(core_receiver PUBLIC ${CUDA_INCLUDE_DIRS})
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_include_directories(core_receiver
|
||||
PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(core_receiver
|
||||
PUBLIC ${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(core_receiver
|
||||
PUBLIC ${CUDA_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
set_target_properties(core_receiver PROPERTIES
|
||||
CUDA_SEPARABLE_COMPILATION ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
target_compile_definitions(core_receiver PRIVATE -DCUDA_GPU_ACCEL=1)
|
||||
endif()
|
||||
|
||||
|
@ -39,16 +39,22 @@ target_link_libraries(gnss-sdr
|
||||
target_compile_definitions(gnss-sdr PRIVATE -DGNSS_SDR_VERSION="${VERSION}")
|
||||
|
||||
if(ENABLE_CUDA)
|
||||
if(NOT CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
if(CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
target_include_directories(gnss-sdr
|
||||
PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
else()
|
||||
target_link_libraries(gnss-sdr
|
||||
PRIVATE
|
||||
${CUDA_LIBRARIES}
|
||||
PUBLIC ${CUDA_LIBRARIES}
|
||||
)
|
||||
target_include_directories(gnss-sdr
|
||||
PRIVATE
|
||||
${CUDA_INCLUDE_DIRS}
|
||||
PUBLIC ${CUDA_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
set_target_properties(gnss-sdr PROPERTIES
|
||||
CUDA_SEPARABLE_COMPILATION ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
target_compile_definitions(gnss-sdr PRIVATE -DCUDA_GPU_ACCEL=1)
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user