|
自适应滤波是处理非平稳信号的一种有效手段
就是梯度下降算法 sgd bgd mbgd mini_batch
基于gnu radio的自适应滤波算法仿真
https://github.com/karel/gr-adapt
Ubuntu18.04上安装gnu radio开发信号处理模块:
http://www.ai111.vip/thread-1149-1-1.html
volk的全名是vector optimized library of kernel,也就是矢量优化库,由它可以提高在不同计算平台矢量计算的效率。
https://github.com/gnuradio
这个项目也是GNURADIO的一个子项目,GNURADIO是依赖这个项目的
https://github.com/gnuradio/volk
# volk_profile will profile your system so that the best kernel is used
$ volk_profile
执行后输出:
jiang@jiang-Ubuntu:~/GNU_Radio_works/gr-adapt-master$ volk_profile
RUN_VOLK_TESTS: volk_64u_popcntpuppet_64u(131071,1987)
generic completed in 160.214 ms
a_sse4_2 completed in 128.086 ms
Best aligned arch: a_sse4_2
Best unaligned arch: generic
RUN_VOLK_TESTS: volk_64u_popcntpuppet_64u(131071,1987)
Creating "/home/jiang/.volk"...
Writing /home/jiang/.volk/volk_config...
Ubuntu18.04 C/C++环境搭建 gcc+cmake:
http://www.ai111.vip/thread-977-1-1.html
jiang@jiang-Ubuntu:~/GNU_Radio_works/gr-adapt-master$ cmake --version
cmake version 3.19.4
Ubuntu18.04下pybind11的安装:
http://www.ai111.vip/thread-1155-1-1.html
当前基于QR分解的RLS过滤器需要Armadillo才能工作。如果gr-adapt是在没有Armadillo的情况下构建的,那么这些过滤器将不起作用
Ubuntu18.04下Armadillo的安装与测试:
http://www.ai111.vip/thread-1156-1-1.html
正式开始源码方式安装gr-adapt:
cd gr-adapt-master
mkdir build
cd build
cmake ..
报错了: 76行内容:find_package(Gnuradio "3.9" REQUIRED COMPONENTS blocks filter fft)
CMake Error at CMakeLists.txt:76 (find_package):
Could not find a configuration file for package "Gnuradio" that is
compatible with requested version "3.9".
The following configuration files were considered but not accepted:
/usr/lib/x86_64-linux-gnu/cmake/gnuradio/GnuradioConfig.cmake, version: 3.8.2.0
原因是:系统中安装的gnuradio是3.8.2.0版本的 而这里需要3.9的版本吗?是的
那就更新吧:http://www.ai111.vip/thread-1149-1-1.html
又报错了:
-- Checking for module 'sndfile'
-- No package 'sndfile' found
CMake Error at /usr/local/share/cmake/pybind11/pybind11Tools.cmake:166 (add_library):
Target "adapt_python" links to target "sndfile::sndfile" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/gnuradio/GrPybind.cmake:243 (pybind11_add_module)
python/bindings/CMakeLists.txt:31 (GR_PYBIND_MAKE_OOT)
安装sndfile:一个C库,用于读写包含采样音频数据的声音文件
sudo apt-get install libsndfile-dev
终于成功了,输出结果:
接下来开始make编译了:
make -j8
又报错了:
/home/jiang/GNU_Radio_works/gr-adapt-master/lib/lms_filter_ff_impl.cc:52:94: error: no matching function for call to ‘gr::filter::kernel::fir_filter<float, float, float>::fir_filter(std::vector<float, std::allocator<float> >)’
d_updated(false), d_skip(skip), d_i(0), d_adapt(adapt), d_bypass(bypass), d_reset(false)
原因:作者提供了一个分支 maint-3.9 我没有用
sudo make install
报错:
import adapt
ImportError: No module named adapt
官方答案:
most likely you used a different CMAKE_INSTALL_PREFIX for the module than for GNU Radio.
Uninstall the module, then run CMake in the build directory again with the correct CMAKE_INSTALL_PREFIX and then install the module
先删除:
sudo make uninstall
make clean
build目录下: rm -rf *
cmake .. 默认是:-- Using install prefix: /usr/local
-- User set python executable /usr/bin/python3
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.9")
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (found suitable exact version "3.6.9")
-- Installing: /usr/local/lib/python3/dist-packages/adapt/adapt_swig.py
-- Installing: /usr/local/lib/python3/dist-packages/adapt/adapt_swig.pyc
-- Installing: /usr/local/lib/python3/dist-packages/adapt/adapt_swig.pyo
-- Installing: /usr/local/include/adapt/adapt/swig/adapt_swig.i
-- Installing: /usr/local/include/adapt/adapt/swig/adapt_swig_doc.i
dfy888@Dfy888-Ubuntu:~/gnuRadio_works$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
我修改一下:
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
变了:
-- Set runtime path of "/usr/lib/python3/dist-packages/adapt/_adapt_swig.so" to ""
-- Installing: /usr/lib/python3/dist-packages/adapt/adapt_swig.py
-- Installing: /usr/lib/python3/dist-packages/adapt/adapt_swig.pyc
-- Installing: /usr/lib/python3/dist-packages/adapt/adapt_swig.pyo
-- Installing: /usr/include/adapt/adapt/swig/adapt_swig.i
-- Installing: /usr/include/adapt/adapt/swig/adapt_swig_doc.i
再次导入:import adapt 终于不报错了!
|
|