diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a7621b8f..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= @@ -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,11 +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 ) - 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() @@ -2703,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() @@ -2991,7 +2996,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 +3032,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() @@ -3151,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/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) diff --git a/docs/changelog.md b/docs/changelog.md index ce8bcd36d..9094120ed 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -31,6 +31,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades (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) { @@ -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; 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) 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..600176067 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) { @@ -589,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(); @@ -604,7 +612,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..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_; @@ -74,7 +76,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 +97,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 +130,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 diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index c8f4af983..105569f06 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -34,9 +34,11 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati dump_ = configuration->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_; }; 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..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 @@ -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,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; + int8_t imag; real = fifo_buff[fifo_read_ptr++]; imag = fifo_buff[fifo_read_ptr++]; if (d_IQ_swap) @@ -344,6 +348,9 @@ 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; + int8_t imag; + uint8_t tmp_char2; tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F; if (tmp_char2 >= 8) { @@ -373,6 +380,25 @@ 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; + 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)); + 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 +433,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) { 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); diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index e62b9acb2..d2b79a909 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -109,14 +109,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 9cf50f04a..aa105f9a2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -105,14 +105,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_correlator_lib + ) + 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 aa8e1a11c..fd470a502 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -44,20 +44,14 @@ set(TRACKING_LIB_HEADERS exponential_smoother.h ) -set(OPT_TRACKING_LIBRARIES "") -set(OPT_TRACKING_INCLUDES "") 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) - 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 STATIC cuda_multicorrelator.h cuda_multicorrelator.cu) endif() endif() @@ -96,20 +90,28 @@ 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 + CUDA_RESOLVE_DEVICE_SYMBOLS ON ) endif() 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/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/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index e104e4e00..c2535fd05 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -110,6 +110,14 @@ void GNSSFlowgraph::start() return; } +#ifdef ENABLE_FPGA + // 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; } 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()