From cd91722d2fc008973dc9267477f2df72e076c904 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 12:14:00 +0200 Subject: [PATCH 01/24] Parameter renaming to throttle_frequency_sps --- docs/changelog.md | 4 ++++ .../signal_source/adapters/labsat_signal_source.cc | 6 ++++-- .../signal_source/adapters/labsat_signal_source.h | 10 +++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index ce8bcd36d..f2a2492ca 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -42,6 +42,10 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - sampling_frequency_ = configuration->property(role + ".sampling_frequency", static_cast(0)); enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); + const int64_t sampling_frequency_deprecated = configuration->property(role + ".sampling_frequency", static_cast(16368000)); + const int64_t throttle_frequency_sps = configuration->property(role + ".throttle_frequency_sps", static_cast(sampling_frequency_deprecated)); + const int channel_selector = configuration->property(role + ".selected_channel", 1); const std::string default_filename("./example_capture.LS3"); @@ -63,7 +65,7 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati if (enable_throttle_control_) { - throttle_ = gr::blocks::throttle::make(item_size_, sampling_frequency_); + throttle_ = gr::blocks::throttle::make(item_size_, throttle_frequency_sps); } if (in_stream_ > 0) diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.h b/src/algorithms/signal_source/adapters/labsat_signal_source.h index 83b331e94..e66fb62bf 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.h +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.h @@ -70,19 +70,19 @@ public: private: gr::block_sptr labsat23_source_; gr::blocks::file_sink::sptr file_sink_; + gr::blocks::throttle::sptr throttle_; + std::string role_; std::string item_type_; std::string filename_; std::string dump_filename_; - - int64_t sampling_frequency_; - bool enable_throttle_control_; - gr::blocks::throttle::sptr throttle_; + size_t item_size_; unsigned int in_stream_; unsigned int out_stream_; - size_t item_size_; + + bool enable_throttle_control_; bool dump_; }; From a9472dea305a8cd256fd13be755e94ed690ac5df Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 12:48:20 +0200 Subject: [PATCH 02/24] Remove redundant void (clang-tidy modernize-redundant-void-arg) --- .../signal_source/adapters/ad9361_fpga_signal_source.cc | 2 +- .../signal_source/adapters/ad9361_fpga_signal_source.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 70db31740..c3088861b 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -604,7 +604,7 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &FreqBand, const } -void Ad9361FpgaSignalSource::run_dynamic_bit_selection_process(void) +void Ad9361FpgaSignalSource::run_dynamic_bit_selection_process() { bool dynamic_bit_selection_active = true; diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index a5f12bafe..1788980df 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -74,7 +74,7 @@ private: const std::string &Filename1, const std::string &Filename2); - void run_dynamic_bit_selection_process(void); + void run_dynamic_bit_selection_process(); std::thread thread_file_to_dma; std::thread thread_dynamic_bit_selection; @@ -95,6 +95,9 @@ private: std::string filename_rx2; std::string freq_band; + std::mutex dma_mutex; + std::mutex dynamic_bit_selection_mutex; + double rf_gain_rx1_; double rf_gain_rx2_; uint64_t freq_; // frequency of local oscillator @@ -125,9 +128,6 @@ private: bool enable_DMA_; bool enable_dynamic_bit_selection_; bool rf_shutdown_; - - std::mutex dma_mutex; - std::mutex dynamic_bit_selection_mutex; }; #endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H From dff95c19c3bee574370c0b298559f4958a871e17 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:08:56 +0200 Subject: [PATCH 03/24] Fix CUDA building --- CMakeLists.txt | 3 +- .../tracking/adapters/CMakeLists.txt | 24 +++++++++----- .../tracking/gnuradio_blocks/CMakeLists.txt | 24 +++++++++----- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 2 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.h | 2 +- src/algorithms/tracking/libs/CMakeLists.txt | 31 ++++++++++--------- src/core/receiver/CMakeLists.txt | 17 ++++++++-- src/main/CMakeLists.txt | 16 +++++++--- 8 files changed, 79 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a7621b8f..f36b2d463 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index 8872fe2d9..67a1ff042 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -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() diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 45e24a6f2..47d01de7b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -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() diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 05f319557..cbfa00fa6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -177,7 +177,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking() d_code_phase_step_chips = static_cast(d_code_freq_chips) / static_cast(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(d_fs_in); + const double T_prn_mod_samples = T_prn_mod_seconds * static_cast(d_fs_in); d_correlation_length_samples = round(T_prn_mod_samples); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h index 840af4e42..bdb9b2925 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h @@ -48,7 +48,7 @@ typedef std::shared_ptr #else typedef boost::shared_ptr 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( diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 246ce4d42..c928c60e0 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -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() diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 35384ff95..8cadf9c12 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -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() diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index cbbbf1466..d9d3d835b 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -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() From 7fa61e92ff3e93906e0633397f24d0a1717c6b78 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:14:56 +0200 Subject: [PATCH 04/24] Fix nvcc option --- src/algorithms/tracking/libs/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index c928c60e0..01c2d6540 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -47,7 +47,7 @@ if(ENABLE_CUDA) 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++14;-O3; -use_fast_math -default-stream per-thread") + 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}) set(LIB_TYPE STATIC) #set the lib type From 171214c9fa029e8df799303bdbcfc412572bab8c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:32:28 +0200 Subject: [PATCH 05/24] Fix for old CMake --- src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt | 2 +- src/algorithms/tracking/libs/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 47d01de7b..e05ead426 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -110,7 +110,7 @@ if(ENABLE_CUDA) ) else() target_link_libraries(tracking_gr_blocks - PUBLIC ${CUDA_LIBRARIES} + PUBLIC cuda_correlator_lib ) target_include_directories(tracking_gr_blocks PUBLIC ${CUDA_INCLUDE_DIRS} diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 01c2d6540..c6b90244e 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -51,7 +51,7 @@ if(ENABLE_CUDA) 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) + cuda_add_library(cuda_correlator_lib ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu) endif() endif() From 42bbdb2a729f0b6dc9bf24cb293777a37a54c647 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:44:48 +0200 Subject: [PATCH 06/24] Fix for CMake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f36b2d463..351fa048b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2679,7 +2679,7 @@ if(ENABLE_CUDA) enable_language(CUDA) set(CUDA_FOUND TRUE) if(NOT DEFINED CMAKE_CUDA_STANDARD) - set(CMAKE_CUDA_STANDARD 14) + set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CUDA_STANDARD_REQUIRED ON) endif() else() From 2e74205cb11e06d49ce4e6fc13af80ec00640381 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:48:32 +0200 Subject: [PATCH 07/24] Fix for CUDA compiler --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 351fa048b..9d6d49f2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2992,7 +2992,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) add_compile_options(-Wno-missing-field-initializers) endif() if(CMAKE_CROSSCOMPILING OR NOT ENABLE_PACKAGING) - add_compile_options(-Wno-psabi) + if(NOT ENABLE_CUDA) + add_compile_options(-Wno-psabi) + endif() endif() if(IS_ARM) if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.1.0") AND (CMAKE_VERSION VERSION_GREATER "3.1")) From 511f24693be2356f4d2bff4811db2bfbb20c8438 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:51:02 +0200 Subject: [PATCH 08/24] Fix for CUDA compiler --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d6d49f2a..f67327280 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3028,7 +3028,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) add_compile_options(-mtune=native) endif() else() - add_compile_options(-march=native) + if(NOT ENABLE_CUDA) + add_compile_options(-march=native) + endif() endif() endif() endif() From 15428a47ccea8f4b0de76213a1d4e2f910ac9270 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 27 Aug 2020 14:57:44 +0200 Subject: [PATCH 09/24] Fix building with -DENABLE_CUDA=ON --- CMakeLists.txt | 9 ++++-- docs/changelog.md | 1 + .../tracking/adapters/CMakeLists.txt | 24 +++++++++----- .../tracking/gnuradio_blocks/CMakeLists.txt | 24 +++++++++----- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 2 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.h | 2 +- src/algorithms/tracking/libs/CMakeLists.txt | 31 ++++++++++--------- src/core/receiver/CMakeLists.txt | 17 ++++++++-- src/main/CMakeLists.txt | 16 +++++++--- 9 files changed, 85 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a7621b8f..f67327280 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() @@ -2991,7 +2992,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) add_compile_options(-Wno-missing-field-initializers) endif() if(CMAKE_CROSSCOMPILING OR NOT ENABLE_PACKAGING) - add_compile_options(-Wno-psabi) + if(NOT ENABLE_CUDA) + add_compile_options(-Wno-psabi) + endif() endif() if(IS_ARM) if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.1.0") AND (CMAKE_VERSION VERSION_GREATER "3.1")) @@ -3025,7 +3028,9 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) add_compile_options(-mtune=native) endif() else() - add_compile_options(-march=native) + if(NOT ENABLE_CUDA) + add_compile_options(-march=native) + endif() endif() endif() endif() diff --git a/docs/changelog.md b/docs/changelog.md index f2a2492ca..5a962c839 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -31,6 +31,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades (d_code_freq_chips) / static_cast(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(d_fs_in); + const double T_prn_mod_samples = T_prn_mod_seconds * static_cast(d_fs_in); d_correlation_length_samples = round(T_prn_mod_samples); diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h index 840af4e42..bdb9b2925 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h @@ -48,7 +48,7 @@ typedef std::shared_ptr #else typedef boost::shared_ptr 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( diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 246ce4d42..c6b90244e 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -42,8 +42,6 @@ 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) @@ -53,9 +51,7 @@ if(ENABLE_CUDA) 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}) + cuda_add_library(cuda_correlator_lib ${LIB_TYPE} cuda_multicorrelator.h cuda_multicorrelator.cu) 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() diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 35384ff95..8cadf9c12 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -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() diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index cbbbf1466..d9d3d835b 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -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() From df2f84dfb0ae3d01dc170802524d3894237c4718 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 28 Aug 2020 12:02:01 +0200 Subject: [PATCH 10/24] 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 --- CMakeLists.txt | 23 ++++++++++++++------- src/algorithms/tracking/libs/CMakeLists.txt | 7 +++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f67327280..a7b4aa4ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2672,16 +2672,14 @@ if(DEFINED ENV{CUDA_GPU_ACCEL}) endif() if(ENABLE_CUDA) + set(CMAKE_CUDA_STANDARD 14) + set(CMAKE_CUDA_EXTENSIONS ON) if(CMAKE_VERSION VERSION_GREATER 3.11) include(CheckLanguage) check_language(CUDA) if(CMAKE_CUDA_COMPILER) enable_language(CUDA) set(CUDA_FOUND TRUE) - if(NOT DEFINED CMAKE_CUDA_STANDARD) - set(CMAKE_CUDA_STANDARD 11) - set(CMAKE_CUDA_STANDARD_REQUIRED ON) - endif() else() set(ENABLE_CUDA OFF) endif() @@ -2689,12 +2687,19 @@ if(ENABLE_CUDA) find_package(CUDA REQUIRED) set_package_properties(CUDA PROPERTIES URL "https://developer.nvidia.com/cuda-downloads" - DESCRIPTION "Library for parallel programming in Nvidia GPUs" PURPOSE "Used in some processing block implementations." TYPE REQUIRED ) - set(CMAKE_CUDA_STANDARD 14) - if(NOT CUDA_FOUND) + if(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) endif() endif() @@ -2704,7 +2709,6 @@ if(ENABLE_CUDA) message(STATUS " You can disable it with 'cmake -DENABLE_CUDA=OFF ..'") else() 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() @@ -3156,6 +3160,9 @@ endif() 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 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 "") file(REMOVE ${CMAKE_BINARY_DIR}/features.log) file(WRITE ${CMAKE_BINARY_DIR}/features.log "**********************************\n") diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index c6b90244e..954b0afc9 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -43,15 +43,13 @@ set(TRACKING_LIB_HEADERS ) 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) 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") - 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) + cuda_add_library(cuda_correlator_lib STATIC cuda_multicorrelator.h cuda_multicorrelator.cu) endif() endif() @@ -111,6 +109,7 @@ if(ENABLE_CUDA) set_target_properties(tracking_libs PROPERTIES CUDA_SEPARABLE_COMPILATION ON POSITION_INDEPENDENT_CODE ON + CUDA_RESOLVE_DEVICE_SYMBOLS ON ) endif() From 70ceb4d11f8f008f89f55f32d48a77e4f3fcf600 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 1 Sep 2020 16:00:00 +0200 Subject: [PATCH 11/24] fixed doppler variable type --- .../acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index 7d9f58591..e009b9c59 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -180,7 +180,7 @@ void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t &d_doppler_index, &total_block_exp); - const auto doppler = static_cast(doppler_min) + doppler_step * (d_doppler_index - 1); + const int32_t doppler = static_cast(doppler_min) + doppler_step * (d_doppler_index - 1); if (total_block_exp > d_total_block_exp) { From 933873c265c3ff9fb5cc817b56f7cd9e9837526e Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 9 Sep 2020 10:34:23 +0200 Subject: [PATCH 12/24] When using the FPGA in post-processing mode, start the DMA after instantiating the complete flowgraph, not before. --- .../signal_source/adapters/ad9361_fpga_signal_source.cc | 7 +++++-- .../signal_source/adapters/ad9361_fpga_signal_source.h | 2 ++ src/core/interfaces/gnss_block_interface.h | 5 +++++ src/core/receiver/gnss_flowgraph.cc | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index c3088861b..b0f06a5a4 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -148,8 +148,6 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con { freq_band = "L1L2"; } - - thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2); }); } if (switch_position == 2) // Real-time via AD9361 { @@ -368,6 +366,11 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() } } +void Ad9361FpgaSignalSource::start() +{ + thread_file_to_dma = std::thread([&] { run_DMA_process(freq_band, filename_rx1, filename_rx2); }); +} + void Ad9361FpgaSignalSource::run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2) { diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 1788980df..dbd556b23 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -43,6 +43,8 @@ public: ~Ad9361FpgaSignalSource(); + void start(); + inline std::string role() override { return role_; diff --git a/src/core/interfaces/gnss_block_interface.h b/src/core/interfaces/gnss_block_interface.h index d20b2013c..c8585f65e 100644 --- a/src/core/interfaces/gnss_block_interface.h +++ b/src/core/interfaces/gnss_block_interface.h @@ -68,6 +68,11 @@ public: }; // avoid unused param warning return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0; } + + /*! + * \brief Start the flow of samples if needed. + */ + virtual void start(){}; }; #endif // GNSS_SDR_GNSS_BLOCK_INTERFACE_H diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index f0f8e341d..d4e90cc9e 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -110,6 +110,10 @@ void GNSSFlowgraph::start() return; } +#ifdef ENABLE_FPGA + sig_source_.at(0)->start(); +#endif + running_ = true; } From 6fcae1a917c0ac96010f3a5ac85afd0b6ab31e44 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 10 Sep 2020 11:57:50 +0200 Subject: [PATCH 13/24] start the DMA only when then the receiver is in post-processing mode --- src/core/receiver/gnss_flowgraph.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index d4e90cc9e..bbf879cd4 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -111,7 +111,11 @@ void GNSSFlowgraph::start() } #ifdef ENABLE_FPGA - sig_source_.at(0)->start(); + // start the DMA if the receiver is in post-processing mode + if (configuration_->property(sig_source_.at(0)->role() + ".switch_position", 0) == 0) + { + sig_source_.at(0)->start(); + } #endif running_ = true; From 3daa9259e835a170406507a36eb96dce3ff0cbec Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 17 Sep 2020 09:39:44 +0200 Subject: [PATCH 14/24] fixed the second step acquisition input parameters --- .../acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index e009b9c59..a60dd0827 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -268,7 +268,7 @@ void pcps_acquisition_fpga::set_active(bool active) while (num_second_acq < d_max_num_acqs) { - acquisition_core(d_num_doppler_bins_step2, d_doppler_step2, d_doppler_center_step_two - static_cast(floor(d_num_doppler_bins_step2 / 2.0)) * d_doppler_step2 + d_doppler_center); + acquisition_core(d_num_doppler_bins_step2, d_doppler_step2, d_doppler_center_step_two - static_cast(floor(d_num_doppler_bins_step2 / 2.0)) * d_doppler_step2); if (d_test_statistics > d_threshold) { d_active = false; From 47c23b2738a2dcab0ea7eebfe27d5c107b058d1e Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 23 Sep 2020 10:59:10 +0200 Subject: [PATCH 15/24] fix dynamic bit selection threshold --- .../signal_source/libs/fpga_dynamic_bit_selection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h index 854055eaf..eeb1b7704 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h @@ -62,8 +62,8 @@ private: static const uint32_t shift_out_bit_max = Num_bits_ADC - Num_bits_FPGA; // maximum possible value for the bit selection // received signal power thresholds for the bit selection // the received signal power is estimated as the averaged squared absolute value of the received signal samples - static const uint32_t Power_Threshold_High = 15000; - static const uint32_t Power_Threshold_Low = 6000; + static const uint32_t Power_Threshold_High = 9000; + static const uint32_t Power_Threshold_Low = 3000; void close_devices(void); From 1ce0b893e19943b16af1c9f6b4e413bfdd9e6e0d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 23 Sep 2020 17:14:34 +0200 Subject: [PATCH 16/24] Update local matio version to 1.5.18 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7b4aa4ea..321529d52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,7 +326,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "9.900.x") set(GNSSSDR_GTEST_LOCAL_VERSION "1.10.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GPSTK_LOCAL_VERSION "3.0.0") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.18") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.13.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.5.1") @@ -2091,7 +2091,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS ExternalProject_Add(matio-${GNSSSDR_MATIO_LOCAL_VERSION} PREFIX ${CMAKE_BINARY_DIR}/matio GIT_REPOSITORY https://github.com/tbeu/matio - GIT_TAG 596cb3ce71038958812bd6cf9b141f12ce155ac6 # Workaround until Matio 1.5.18 v${GNSSSDR_MATIO_LOCAL_VERSION} + GIT_TAG v${GNSSSDR_MATIO_LOCAL_VERSION} SOURCE_DIR ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION} UPDATE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/autogen.sh CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/thirdparty/matio/matio-${GNSSSDR_MATIO_LOCAL_VERSION}/configure --with-hdf5=${HDF5_BASE_DIR} --with-zlib=${ZLIB_BASE_DIR} --with-default-file-ver=7.3 --enable-mat73=yes --prefix= From 202f032e889745f98104a28eae5dabaabe8fec40 Mon Sep 17 00:00:00 2001 From: Josh Schindehette Date: Wed, 30 Sep 2020 14:00:35 -0400 Subject: [PATCH 17/24] Added cfloat type, data is assumed to be little endian The sample_type property of gr_complex_ip_packet_source was augmented to support the "cfloat" enumeration. It packs 8 bytes of data from the UDP payload into a single complex float sample. The float data in the UDP payload is assumed to be little endian. --- .../gr_complex_ip_packet_source.cc | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index f3018b359..b2db888c5 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -118,6 +118,11 @@ Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device, d_wire_sample_type = 2; d_bytes_per_sample = d_n_baseband_channels; } + else if (wire_sample_type == "cfloat") + { + d_wire_sample_type = 3; + d_bytes_per_sample = d_n_baseband_channels * 8; + } else { std::cout << "Unknown wire sample type\n"; @@ -319,9 +324,6 @@ void Gr_Complex_Ip_Packet_Source::my_pcap_loop_thread(pcap_t *pcap_handle) void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &output_items, int num_samples_readed) { - int8_t real; - int8_t imag; - uint8_t tmp_char2; for (int n = 0; n < num_samples_readed; n++) { switch (d_wire_sample_type) @@ -329,6 +331,7 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu case 1: // interleaved byte samples for (auto &output_item : output_items) { + int8_t real, imag; real = fifo_buff[fifo_read_ptr++]; imag = fifo_buff[fifo_read_ptr++]; if (d_IQ_swap) @@ -344,6 +347,8 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu case 2: // 4-bit samples for (auto &output_item : output_items) { + int8_t real, imag; + uint8_t tmp_char2; tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F; if (tmp_char2 >= 8) { @@ -373,6 +378,24 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu } } break; + case 3: // interleaved float samples + for (auto &output_item : output_items) + { + float real, imag; + memcpy(&real, &fifo_buff[fifo_read_ptr], sizeof(real)); + fifo_read_ptr += 4; // Four bytes in float + memcpy(&imag, &fifo_buff[fifo_read_ptr], sizeof(imag)); + fifo_read_ptr += 4; // Four bytes in float + if (d_IQ_swap) + { + static_cast(output_item)[n] = gr_complex(real, imag); + } + else + { + static_cast(output_item)[n] = gr_complex(imag, real); + } + } + break; default: std::cout << "Unknown wire sample type\n"; exit(0); @@ -407,6 +430,7 @@ int Gr_Complex_Ip_Packet_Source::work(int noutput_items, { case 1: // complex byte samples case 2: // complex 4 bits samples + case 3: // complex float samples bytes_requested = noutput_items * d_bytes_per_sample; if (bytes_requested < fifo_items) { From 8189b37ebadda10ed2b39575b50fdc45327123bb Mon Sep 17 00:00:00 2001 From: Josh Schindehette Date: Wed, 30 Sep 2020 14:15:12 -0400 Subject: [PATCH 18/24] Fixed code/comment spacing issue for cpplint --- .../gnuradio_blocks/gr_complex_ip_packet_source.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index b2db888c5..c151c915b 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -383,9 +383,9 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu { float real, imag; memcpy(&real, &fifo_buff[fifo_read_ptr], sizeof(real)); - fifo_read_ptr += 4; // Four bytes in float + fifo_read_ptr += 4; // Four bytes in float memcpy(&imag, &fifo_buff[fifo_read_ptr], sizeof(imag)); - fifo_read_ptr += 4; // Four bytes in float + fifo_read_ptr += 4; // Four bytes in float if (d_IQ_swap) { static_cast(output_item)[n] = gr_complex(real, imag); From 5648579a267972b958530570a0e0436caa2be776 Mon Sep 17 00:00:00 2001 From: Josh Schindehette Date: Wed, 30 Sep 2020 15:24:07 -0400 Subject: [PATCH 19/24] Fixed variable declaration syntax for clang-tidy --- .../gnuradio_blocks/gr_complex_ip_packet_source.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index c151c915b..a72ee564e 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -331,7 +331,8 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu case 1: // interleaved byte samples for (auto &output_item : output_items) { - int8_t real, imag; + int8_t real; + int8_t imag; real = fifo_buff[fifo_read_ptr++]; imag = fifo_buff[fifo_read_ptr++]; if (d_IQ_swap) @@ -347,7 +348,8 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu case 2: // 4-bit samples for (auto &output_item : output_items) { - int8_t real, imag; + int8_t real; + int8_t imag; uint8_t tmp_char2; tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F; if (tmp_char2 >= 8) @@ -381,7 +383,8 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu case 3: // interleaved float samples for (auto &output_item : output_items) { - float real, imag; + float real; + float imag; memcpy(&real, &fifo_buff[fifo_read_ptr], sizeof(real)); fifo_read_ptr += 4; // Four bytes in float memcpy(&imag, &fifo_buff[fifo_read_ptr], sizeof(imag)); From d8cc2efeee7cb7de557dadfe3e5c3ee4cd5b5f94 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 1 Oct 2020 10:45:59 +0200 Subject: [PATCH 20/24] Update changelog --- docs/changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 5a962c839..bcd5dfb30 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -48,6 +48,9 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades Date: Thu, 1 Oct 2020 10:47:38 +0200 Subject: [PATCH 21/24] Fix typo --- docs/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index bcd5dfb30..9094120ed 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -49,7 +49,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades Date: Thu, 15 Oct 2020 23:55:36 +0200 Subject: [PATCH 22/24] close the DMA descriptor properly. --- .../signal_source/adapters/ad9361_fpga_signal_source.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index b0f06a5a4..600176067 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -592,6 +592,11 @@ void Ad9361FpgaSignalSource::run_DMA_process(const std::string &FreqBand, const lock.unlock(); } + if (close(tx_fd) < 0) + { + std::cerr << "Error closing loop device " << '\n'; + } + try { infile1.close(); From 76f0eb7acdd347038547ba7462c763c991bb6804 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 16 Oct 2020 19:46:44 +0200 Subject: [PATCH 23/24] Fix python detection when cross-compiling --- cmake/Modules/SetupPython.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/SetupPython.cmake b/cmake/Modules/SetupPython.cmake index 1f8c22e01..ff7e7d62c 100644 --- a/cmake/Modules/SetupPython.cmake +++ b/cmake/Modules/SetupPython.cmake @@ -49,7 +49,7 @@ endmacro() # or finds the interpreter via the built-in cmake module. ######################################################################## -if(CMAKE_VERSION VERSION_LESS 3.12) +if(CMAKE_VERSION VERSION_LESS 3.12 OR CMAKE_CROSSCOMPILING) if(PYTHON_EXECUTABLE) message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") string(FIND "${PYTHON_EXECUTABLE}" "python3" IS_PYTHON3) From c1ecd1d1be4b6ac10d80454fc885f0c6258b4f85 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 16 Oct 2020 20:06:11 +0200 Subject: [PATCH 24/24] Fix python detection when cross-compiling --- .../volk_gnsssdr/cmake/Modules/VolkPython.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake index 6484863cf..4f08bc151 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkPython.cmake @@ -55,7 +55,7 @@ endmacro() set(VOLK_PYTHON_MIN_VERSION "2.7") set(VOLK_PYTHON3_MIN_VERSION "3.4") -if(CMAKE_VERSION VERSION_LESS 3.12) +if(CMAKE_VERSION VERSION_LESS 3.12 OR CMAKE_CROSSCOMPILING) if(PYTHON_EXECUTABLE) message(STATUS "User set python executable ${PYTHON_EXECUTABLE}") find_package(PythonInterp ${VOLK_PYTHON_MIN_VERSION} REQUIRED)