1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-09-05 12:27:59 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into fix_fpga_post_proc_mode_progr_termination

This commit is contained in:
Marc Majoral
2020-07-01 17:44:42 +02:00
11 changed files with 46 additions and 35 deletions

View File

@@ -460,17 +460,6 @@ else()
endif() endif()
endif() endif()
# Availability of std::plus without class specifier
if(CMAKE_CXX_STANDARD VERSION_GREATER 11)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.4.0)
set(HAVE_STD_PLUS ON)
endif()
else()
set(HAVE_STD_PLUS ON)
endif()
endif()
################################################################################ ################################################################################
@@ -901,6 +890,22 @@ check_cxx_source_compiles("
################################################################################
# Detect availability of std::plus without class specifier
################################################################################
unset(has_std_plus_void CACHE)
if(CMAKE_CXX_STANDARD VERSION_GREATER 11)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <functional>
int main()
{ [](float a=1, float b=0){return std::plus<>();}; };"
has_std_plus_void
)
endif()
################################################################################ ################################################################################
# VOLK - Vector-Optimized Library of Kernels # VOLK - Vector-Optimized Library of Kernels
################################################################################ ################################################################################

View File

@@ -53,6 +53,7 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
`None`. This allows packaging in some distributions that pass an arbitrary `None`. This allows packaging in some distributions that pass an arbitrary
name as the build type (e.g., Gentoo) to avoid unexpected compiler flags. The name as the build type (e.g., Gentoo) to avoid unexpected compiler flags. The
building option `ENABLE_PACKAGING` must set to `ON` when packaging. building option `ENABLE_PACKAGING` must set to `ON` when packaging.
- Do not stop the receiver if SysV message queues cannot be created.
### Improvements in Reliability: ### Improvements in Reliability:

View File

@@ -31,6 +31,7 @@ FirFilter::FirFilter(const ConfigurationInterface* configuration, std::string ro
{ {
config_ = configuration; config_ = configuration;
(*this).init(); (*this).init();
item_size_ = 0;
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex")) if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
{ {
item_size_ = sizeof(gr_complex); item_size_ = sizeof(gr_complex);

View File

@@ -77,7 +77,7 @@ public:
inline size_t item_size() override inline size_t item_size() override
{ {
return 0; return item_size_;
} }
void connect(gr::top_block_sptr top_block) override; void connect(gr::top_block_sptr top_block) override;

View File

@@ -60,6 +60,8 @@ get_filename_component(PROTO_INCLUDE_HEADERS ${PROTO_HDRS} DIRECTORY)
target_include_directories(core_monitor target_include_directories(core_monitor
PUBLIC PUBLIC
SYSTEM ${PROTO_INCLUDE_HEADERS} SYSTEM ${PROTO_INCLUDE_HEADERS}
PRIVATE
${CMAKE_SOURCE_DIR}/src/algorithms/libs # for gnss_sdr_make_unique
) )
if(GNURADIO_USES_STD_POINTERS) if(GNURADIO_USES_STD_POINTERS)

View File

@@ -21,6 +21,7 @@
*/ */
#include "gnss_synchro_monitor.h" #include "gnss_synchro_monitor.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
@@ -52,7 +53,7 @@ gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels,
d_decimation_factor = decimation_factor; d_decimation_factor = decimation_factor;
d_nchannels = n_channels; d_nchannels = n_channels;
udp_sink_ptr = std::unique_ptr<Gnss_Synchro_Udp_Sink>(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port, enable_protobuf)); udp_sink_ptr = std::make_unique<Gnss_Synchro_Udp_Sink>(udp_addresses, udp_port, enable_protobuf);
count = 0; count = 0;
} }

View File

@@ -1106,8 +1106,8 @@ void ControlThread::sysv_queue_listener()
if ((msqid_ = msgget(key, 0644 | IPC_CREAT)) == -1) if ((msqid_ = msgget(key, 0644 | IPC_CREAT)) == -1)
{ {
perror("GNSS-SDR cannot create SysV message queues"); std::cerr << "GNSS-SDR cannot create SysV message queues" << std::endl;
exit(1); read_queue = false;
} }
while (read_queue && !stop_) while (read_queue && !stop_)

View File

@@ -238,8 +238,8 @@ if(ARMADILLO_VERSION_STRING VERSION_GREATER 8.400)
add_definitions(-DARMADILLO_HAVE_MVNRND=1) add_definitions(-DARMADILLO_HAVE_MVNRND=1)
endif() endif()
if(HAVE_STD_PLUS) if(has_std_plus_void)
add_definitions(-DCOMPILER_HAS_STD_PLUS=1) add_definitions(-DCOMPILER_HAS_STD_PLUS_VOID=1)
endif() endif()
find_package(Gnuplot) find_package(Gnuplot)

View File

@@ -107,6 +107,6 @@ add_benchmark(benchmark_preamble core_system_parameters)
add_benchmark(benchmark_detector core_system_parameters) add_benchmark(benchmark_detector core_system_parameters)
if(HAVE_STD_PLUS) if(has_std_plus_void)
target_compile_definitions(benchmark_detector PRIVATE -DCOMPILER_HAS_STD_PLUS=1) target_compile_definitions(benchmark_detector PRIVATE -DCOMPILER_HAS_STD_PLUS_VOID=1)
endif() endif()

View File

@@ -83,7 +83,7 @@ void bm_accumulate(benchmark::State& state)
} }
} }
#if COMPILER_HAS_STD_PLUS
void bm_inner_product(benchmark::State& state) void bm_inner_product(benchmark::State& state)
{ {
std::vector<float> d_symbol_history(GPS_CA_PREAMBLE_LENGTH_SYMBOLS, 0.0); std::vector<float> d_symbol_history(GPS_CA_PREAMBLE_LENGTH_SYMBOLS, 0.0);
@@ -104,15 +104,16 @@ void bm_inner_product(benchmark::State& state)
d_symbol_history.end(), d_symbol_history.end(),
d_preamble_samples.begin(), d_preamble_samples.begin(),
0, 0,
#if COMPILER_HAS_STD_PLUS_VOID
std::plus<>(), std::plus<>(),
[&](float a, float b) { return (std::signbit(a) ? -b : b); }); #else
} std::plus<int32_t>(),
}
#endif #endif
[](float a, int32_t b) { return (std::signbit(a) ? -b : b); });
}
}
BENCHMARK(bm_forloop); BENCHMARK(bm_forloop);
BENCHMARK(bm_accumulate); BENCHMARK(bm_accumulate);
#if COMPILER_HAS_STD_PLUS
BENCHMARK(bm_inner_product); BENCHMARK(bm_inner_product);
#endif
BENCHMARK_MAIN(); BENCHMARK_MAIN();

View File

@@ -84,7 +84,6 @@ TEST(PreambleCorrelationTest, TestMethods)
} }
end2 = std::chrono::system_clock::now(); end2 = std::chrono::system_clock::now();
#if COMPILER_HAS_STD_PLUS
// Compute correlation, method 3 // Compute correlation, method 3
start3 = std::chrono::system_clock::now(); start3 = std::chrono::system_clock::now();
for (int64_t iter = 0; iter < n_iter; iter++) for (int64_t iter = 0; iter < n_iter; iter++)
@@ -93,25 +92,26 @@ TEST(PreambleCorrelationTest, TestMethods)
d_symbol_history.begin() + GPS_CA_PREAMBLE_LENGTH_BITS, d_symbol_history.begin() + GPS_CA_PREAMBLE_LENGTH_BITS,
d_preamble_samples.begin(), d_preamble_samples.begin(),
0, 0,
#if COMPILER_HAS_STD_PLUS_VOID
std::plus<>(), std::plus<>(),
[&](float a, float b) { return (std::signbit(a) ? -b : b); }); #else
std::plus<int32_t>(),
#endif
[](float a, int32_t b) { return (std::signbit(a) ? -b : b); });
sum_corr3 += corr_value3; sum_corr3 += corr_value3;
} }
end3 = std::chrono::system_clock::now(); end3 = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds3 = end3 - start3;
EXPECT_EQ(corr_value, corr_value3);
EXPECT_EQ(sum_corr1, sum_corr3);
#endif
EXPECT_EQ(corr_value, corr_value2);
EXPECT_EQ(sum_corr1, sum_corr2);
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;
std::chrono::duration<double> elapsed_seconds2 = end2 - start2; std::chrono::duration<double> elapsed_seconds2 = end2 - start2;
std::chrono::duration<double> elapsed_seconds3 = end3 - start3;
EXPECT_EQ(corr_value, corr_value2);
EXPECT_EQ(sum_corr1, sum_corr2);
EXPECT_EQ(corr_value, corr_value3);
EXPECT_EQ(sum_corr1, sum_corr3);
std::cout << "Correlation computed with 'C for' : done in " << elapsed_seconds.count() * 1.0e9 / n_iter << " nanoseconds" << std::endl; std::cout << "Correlation computed with 'C for' : done in " << elapsed_seconds.count() * 1.0e9 / n_iter << " nanoseconds" << std::endl;
std::cout << "Correlation computed with accumulate : done in " << elapsed_seconds2.count() * 1.0e9 / n_iter << " nanoseconds" << std::endl; std::cout << "Correlation computed with accumulate : done in " << elapsed_seconds2.count() * 1.0e9 / n_iter << " nanoseconds" << std::endl;
#if COMPILER_HAS_STD_PLUS
std::cout << "Correlation computed with inner_product : done in " << elapsed_seconds3.count() * 1.0e9 / n_iter << " nanoseconds" << std::endl; std::cout << "Correlation computed with inner_product : done in " << elapsed_seconds3.count() * 1.0e9 / n_iter << " nanoseconds" << std::endl;
#endif
} }