summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib
Commit message (Collapse)AuthorAgeFilesLines
* C++14: Use std::make_unique instead of boost::make_uniqueMarcus Müller2021-01-045-9/+8
| | | | | | Also, clean up includes Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
* pmt: use to_string for char string_refsmormj2020-12-191-2/+2
|
* runtime: Add terminate handlingPaul Wicks2020-12-194-3/+180
| | | | | | | | | | | | | | | | | | | | | | | | This consists of the following changes: 1. Add a top_block parameter to control exception handling This restores past behavior where the scheduler catches exceptions raised in block threads, allowing flowgraphs to continue running after the failure of an individual block. It also adds optional new behavior, selected by setting catch_exceptions=False to the top block, which causes exceptions to not be caught. In this mode of operation, a std::terminate handler can be installed to print a stack trace before the flowgraph exits. 2. Add terminate_handler to top_block_impl This adds a terminate_handler function that prints information about any uncaught exceptions and also attempts to print a backtrace for said exception after which it calls std::abort. The backtrace is printed via libunwind, which is a new optional dependency. If libunwind is not found/installed, then the terminate handler will still print information about the exception and then exit. Co-Authored-By: Scott Torborg <storborg@gmail.com>
* RPC fixes to allow using Thrift-0.13A. Maitland Bottoms2020-12-191-2/+6
| | | | | | | Adds ability for master to build with newer Thrift versions by checking availability of thrift include files. (Also spelling fix: Thift -> Thrift) And fix up logging for rpcserver_thrift class.
* gnuradio-runtime: Fix qa_fast_atan2f test code.Ron Economos2020-11-141-3/+3
|
* modernization: `override` instead of virtual in all compilation unitsMarcus Müller2020-11-0311-122/+125
|
* Add `override` for common virtual function overridesThomas Habets2020-11-031-2/+2
| | | | | | | | | | Mostly done with: ``` find -name "*_impl.h" | xargs sed -i -r '/(void forecast|int work|int general_work|bool check_topology)\(/{:back /\)/b nxt;N;b back;:nxt s/\)$|\)(;)/) override\1/g}' ``` Then I removed an incorrect `work` that this found.
* Fix typos throughout the codeluzpaz2020-10-291-1/+1
| | | | | | | * Fix various typos Found via `codespell v2.0.dev` `codespell -q 3 -L ans,fo,hist,inout,ist,ith,nd,sinc,uint -S ./volk`
* Make hash table a little larger to reduce expensive iteration. The memory ↵Jacob Gilbert2020-10-281-1/+1
| | | | impact is very small, on the order of 10's of kB.
* Replace custom undocumented string hashing algorithm with std::hash. The std ↵Jacob Gilbert2020-10-281-17/+2
| | | | implmentation is slightly faster and has been tested to have similar distribution with arbitrary input data
* runtime: fix Windows loggingjapm482020-10-201-1/+1
| | | | | This removes a few compilation errors in Windows related to logging functions (see PR #3339).
* runtime: remove snprintfClayton Smith2020-10-202-6/+13
|
* gnuradio-runtime, pmt: dont use CMAKE_INSTALL_PREFIX for target ↵Gwenhael Goavec-Merou2020-10-162-2/+2
| | | | INSTALL_INTERFACE
* lib, include: Include missing headers.Ryan Volz2020-10-021-0/+1
| | | | | This fixes compilation with MSVC on conda-forge, although why this wasn't needed earlier is a mystery.
* runtime: fix latency issue caused by setting block alias on message blockJacob Gilbert2020-09-303-5/+9
| | | | This changes how the blocks are identified when they need to be notified that they have messages waiting. It also clarifies the name the block is registered with explicitly, and adds exceptions for looking up blocks that do not exist.
* python: Remove unnecessary 'from __future__ import'Oleksandr Kravchuk2020-08-031-1/+0
| | | | | | | | | | | | | | | | All of the removed `from __future__ import` were needed in older versions of Python (mostly 2.5.x and below) but later became mandatory in most versions of Python 3 hence are not necessary anymore. More specifically, according to __future__.py[1]: - unicode_literals is part of Python since versions 2.6.0 and 3.0.0; - print_function is part of Python since versions 2.6.0 and 3.0.0; - absolute_import is part of Python since versions 2.5.0 and 3.0.0; - division is part of Python since versions 2.2.0 and 3.0.0; Get rid of those unnecessary imports to slightly clean up the codebase. [1] https://github.com/python/cpython/blob/master/Lib/__future__.py
* Replace all calls to `get_initial_sptr` with `make_block_sptr`Thomas Habets2020-07-304-29/+18
| | | | | | | | | | | | | | First batch of changes: ``` find […] -print0 | xargs -0 sed -i -r '/get_initial_sptr/{:nxt N;/;/!b nxt;s/get_initial_sptr\(\s*new ([^(]+)(.*)\)\)/make_block_sptr<\1>\2)/}' ``` Then: * Back out `sptr_magic.h` edits * Change some `friend` clauses * clang-format the whole thing * Update checksums in the pybind11 bindings files
* controlport: include <algorithm> when using std::for_each()Daniel Estévez2020-07-301-0/+1
| | | | | std::for_each() is defined in <algorithm>, so that if it is not included, it doesn't build in some platforms
* msg_handler: Use lambdas to set msg handlersJohannes Demel2020-06-041-2/+1
| | | | | With this commit, all calls to `set_msg_handler` in `gr-blocks` use lambdas. This helps to use `std::function` instead of `boost::function`.
* msg_handler: Switch from boost::function to std::functionJohannes Demel2020-06-041-1/+2
| | | | | | | This commit is a first stab at moving from `boost::function` to `std::function`. For now, it does only update gr-blocks. Also, this requires more testing. If others can confirm that this change works, I'll continue to update all modules.
* pybind: run clang-formatJosh Morman2020-06-043-12/+13
|
* runtime: replace py gateway with pybind11 support, remove fevalJosh Morman2020-06-044-202/+70
|
* pmt: add missing implementation of pmt_from_complexJosh Morman2020-06-041-0/+5
|
* pmt: stop treating all pairs like they are dictsJacob Gilbert2020-05-054-16/+76
| | | | create a new derived class for pmt dicts so they can be distinguished without complicated try/catch logic, updated QA with a few additional checks. also added an is_pdu() method which returns true if the pmt is a pair of a dict-type PMT and a uniform-vector type, otherwise false
* pmt: serialization change from endian.h to boost::endian conversionJacob Gilbert2020-04-231-15/+15
| | | | this is more portable since endian.h is not available on all platforms, and may have some implementation inconsistencies
* runtime: move loggers from gr::block to gr::basic_blockMarcus Müller2020-04-132-3/+4
| | | | | | | No reason to assume only `general_work`-containing blocks would want to log. This enables us especially to log in `basic_block` itself.
* runtime: replace stderr logging by calls to GR's logging faciltiesMarcus Müller2020-04-1321-196/+295
|
* Remove VOLK as a submoduleMartin Braun2020-04-111-1/+1
| | | | | | | | | | | | | | This removes the volk/ submodule pointer and updates the CMake to detect VOLK like any other dependency. The VOLK_MIN_VERSION CMake variable is added (and set to 2.1.0). The GR_VOLK_LIB variable is replaced with Volk::volk everywhere. The VOLK_INSTALL_LIBRARY_DIR and VOLK_INSTALL_INCLUDE_DIR variables weren't used and were removed. CMake will now fail if VOLK cannot be detected. Therefore, ENABLE_VOLK was also removed as a variable; all in-tree components may assume the existence of VOLK.
* realtime_impl: rint/rintf: use appropriate math function for floatMarcus Müller2020-04-111-1/+1
|
* boost: remove deprecated math/common_factor.hppjapm482020-04-111-16/+3
| | | | | Remove deprecation warning and prefer using std::{lcm,gcd} to Boost. Fixes #2712.
* qtgui: Remove boost::lexical_cast for parsingThomas Habets2020-04-111-2/+4
| | | | This is the last boost::lexical_cast in gnuradio.
* qtgui: Remove boost::lexical_cast for printingThomas Habets2020-04-111-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | boost::lexical_cast seems not not be consistent given different inputs. E.g. std::complex is stringified like iostream, but float and double avoid scientific notation… mostly. See below for comparisons between before and after (`printf` is what this commit switches to). I don't think the differences matter. ``` int main() { constexpr float low_float = 200000000.2; constexpr float high_float = 20000000000.2; constexpr float low_double = 200000000.2; constexpr float mid_double = 20000000000.2; constexpr float high_double = 200000000000000000.2; const std::complex<float> c(1.3,low_float); const std::complex<double> d(1.3,low_double); const std::complex<double> d2(1.3,high_double); const std::vector<float> fs = {low_float, high_float}; const std::vector<double> ds = {low_double, mid_double, high_double}; std::cout << "# complex\n"; std::cout << "iostream: " << c << std::endl; std::cout << "lexical_cast: " << boost::lexical_cast<std::string>(c) << std::endl; std::cout << std::endl; for (int i = 0; i < fs.size(); i++) { std::cout << "# float " << i << std::endl; std::cout << "iostream: " << fs[i] << std::endl; std::cout << "to_string: " << std::to_string(fs[i]) << std::endl; printf("printf %.f\n", std::numeric_limits<float>::digits10, fs[i]); std::cout << "lexical: " << boost::lexical_cast<std::string, float>(fs[i]) << std::endl; std::cout << std::endl; } for (int i = 0; i < ds.size(); i++) { std::cout << "# double " << i << std::endl; std::cout << "iostream: " << ds[i] << std::endl; std::cout << "to_string: " << std::to_string(ds[i]) << std::endl; printf("printf %.*g\n", std::numeric_limits<double>::digits10, ds[i]); std::cout << "lexical: " << boost::lexical_cast<std::string, double>(ds[i]) << std::endl; std::cout << std::endl; } } ``` Output (Debian amd64): ``` iostream: (1.3,2e+08) lexical_cast: (1.3,2e+08) iostream: 2e+08 to_string: 200000000.000000 printf 200000000 lexical: 200000000 iostream: 2e+10 to_string: 20000000000.000000 printf 20000000000 lexical: 2e+10 iostream: 2e+08 to_string: 200000000.000000 printf 200000000 lexical: 200000000 iostream: 2e+10 to_string: 20000000000.000000 printf 20000000000 lexical: 20000000000 iostream: 2e+17 to_string: 199999996861349888.000000 printf 1.9999999686135e+17 lexical: 1.9999999686134989e+17 ```
* pmt: speed up serializationJacob Gilbert2020-04-111-199/+178
|
* runtime: Remove most manual memory managementThomas Habets2020-04-1111-94/+66
| | | | | | The remaining ones: * `pmt_pool.cc`, which is a memory allocator so that makes sense * the tricky and aptly named `sptr_magic.cc`.
* runtime: Use nanosecond resolution for default random seedThomas Habets2020-04-101-1/+4
| | | | | This exposed some missing forwarding of RNG seed from one object to another, also fixed in this commit.
* runtime: Make random seed default to current time, as documentedThomas Habets2020-04-101-1/+1
| | | | | | | | | | | This is what gnuradio currently documents seeding will do, but it's not what C++ defaults to. See C++11 26.5.3.2, paragraph 3. Default for mersenne twister is constexpr 5489. Or easier, the bottom of https://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine
* Switch from boost pointers to std C++11 pointersThomas Habets2020-04-019-19/+20
| | | | | | | | | | | | | | | | | | | Most of this code is automated code changes: ``` set -e SUB="s/dummy/dummy/" for i in shared_ptr make_shared dynamic_pointer_cast weak_ptr enable_shared_from_this get_deleter; do SUB="$SUB;s/boost::$i/std::$i/g" done SUB="$SUB;s^#include <boost/shared_ptr.hpp>^#include <memory>^g" SUB="$SUB;s^namespace boost^namespace std^g" find . \( -name "*.cc" -o -name "*.h" -o -name "*.i" -o -name "*.cxx" -o -name "*.py" \) -print0 | xargs -0 sed -i "$SUB" ``` Only one manual change. In `./gr-fec/lib/fec_mtrx_impl.cc`, add `#include <algorithm>`.
* Replace BOOST_FOREACH with C++11 range forThomas Habets2020-03-272-5/+3
|
* gr-digital: Improve Performance of Costas Loopghostop142020-02-142-63/+0
| | | | | | | | | | | | | This update is focused on improving the throughput of the Costas loop, however some changes are more global performance enhancements as this PR has evolved. Updates include an ENABLE_NATIVE added to CMake, which is off by default but enables native compiling (including FMA support) if desired; sincos was inlined in sincos.h and sincos.cc was removed from the appropriate CMake to improve sincos speed, some constants were added to math.h, inlined functions in costas loop and nco.h, used switch instead of function pointer (much faster), and used fast complex multiply to get around all the range checking in the standard complex.h complex multiply function on all builds.
* pmt: Fix RuntimeError in pmt_to_pythonMichael Byers2020-02-091-1/+1
| | | | | | | Python has a RuntimeError that's thrown during the pmt to_python function. Instead of throwing this error, SWIG has been updated to throw a TypeError. This allows us to keep the same behavior whereby we iterate over PMT types until the proper conversion is found
* runtime: release the flattened flowgraph after stoppingClayton Smith2020-02-081-0/+2
|
* Update license header to SPDX formatdevnulling2020-01-27107-1376/+107
|
* Fix all formatting issuesMartin Braun2020-01-107-21/+14
| | | | | This fixes every leftover file in the GNU Radio source tree to match our clang-format definition.
* runtime: Fix premature tag pruning from buffer with sample delay.Ryan Volz2020-01-071-2/+0
| | | | | | | | | | | The buffer object keeps track of the max reader delay (d_max_reader_delay) so that it won't prune tags until after the delay has passed. However, the d_max_reader_delay value was being set to 0 with every buffer_reader instantiation for a given buffer, essentially ignoring delays that are set for prior readers. This patch removes the spurious setting of d_max_reader_delay to 0 whenever a new buffer_reader is instantiated.
* runtime: Fix get_tags_in_range for (end - start) > delay.Ryan Volz2020-01-071-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, stream tags would be lost (not propagated downstream) when a block has a tag delay set and it is called with a number of input samples that is less than the delay. Since this happens depending on the scheduler and the number of samples provided, tags might mostly work or seemingly randomly disappear. The problem occurs because a wrong correction is included for underflows in unsigned arithmetic that limits the tags propagated to a smaller sample window than desired. Correctly detecting the underflow and setting the value to 0 rather than abs_start or abs_end fixes the problem. For a real example, let the d_attr_delay=209, abs_start=0, and abs_end=200 with a tag at input sample 0. Then tags from min(abs_start, abs_start - d_attr_delay) == 0 to min(abs_end, abs_end - d_attr_delay) == 200 are iterated through, including the tag at 0 (item_time == 209), but it is not propagated to the output yet since item_time >= abs_end (209 >= 200). On the next call to the block, with abs_start=200 and abs_end=400, the tag at input sample 0 is ignored because min(abs_start, abs_start - d_attr_delay) == 200 and the iterator skips it. The correct calculation for the lower bound of the tag iterator would result in 0 and find the tag since (abs_start - d_attr_delay) == -9 -> 0 when constrained to unsigned values. With the proper lower bound (and upper bound corrected as well), the tag at 0 is found with an item_time == 209 which falls between abs_start and abs_end and is propagated to output sample 209.
* runtime: add GR_PREFS_PATH env variable searchJosh Morman2020-01-062-4/+14
| | | | | | | When looking for the config file, allow the env variable GR_PREFS_PATH to be searched so that multiple installations of GR each with its own prefs can be used, similar to what is currently done in GRC
* Add a top_block parameter to control exception handlingScott Torborg2020-01-057-21/+41
| | | | | | | | | This restores past behavior where the scheduler catches exceptions raised in block threads, allowing flowgraphs to continue running after the failure of an individual block. It also adds optional new behavior, selected by setting catch_exceptions=False to the top block, which causes exceptions to not be caught. In this mode of operation, a std::terminate handler can be installed to print a stack trace before the flowgraph exits.
* runtime: random facilities use C++11 (minus boost)Marcus Müller2020-01-021-33/+7
| | | | | | This also includes removing the new/delete for the local objects. C++ doesn't need you to manually new/delete objects with definite lifetime...
* gr: enable truncation option with add_file_appenderGrant Cox2020-01-021-1/+4
| | | | | | | gr.logger.add_file_appender offered use of the truncation flag but did not use it in the creation of log4cpp::FileAppender. Added the bool append as an argument.
* runtime: fix python math script generating wrong sine tableArtem Pisarenko2020-01-021-3/+2
| | | | Fixes commit 48d535e9d9d95524b2c8ed35b44c7eda541aea68