pothosware / pothosblocks Goto Github PK
View Code? Open in Web Editor NEWA collection of core processing blocks
Home Page: https://github.com/pothosware/PothosBlocks/wiki
License: Boost Software License 1.0
A collection of core processing blocks
Home Page: https://github.com/pothosware/PothosBlocks/wiki
License: Boost Software License 1.0
We got a little carried away with the first implementation. It can be done stateless without any memory copies, and passive buffer forwarding:
Also, we should install the circular buffer to avoid any memory copies within the scheduler. After all, we are sliding through the input stream looking for size-N contiguous buffers. So it fits to use a circular buffer here:
Pothos::BufferManager::Sptr getInputBufferManager(const std::string &, const std::string &)
{
return Pothos::BufferManager::make("circular");
}
I'm on a system with an old release of rhel 7.7, using gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
and it seems there is an ambiguity around std::isnan(double)
somehow.
[ 67%] Building CXX object blocks/testers/CMakeFiles/TesterBlocks.dir/SporadicSubnormal.cpp.o
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp: In function ‘Pothos::Block* makeSporadicNaN(const Pothos::DType&)’:
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:132:104: error: overloaded function with no contextual type information
return new SporadicSubnormal<T>(std::numeric_limits<T>::quiet_NaN(), CheckFcn<T>(std::isnan), "NaN");
^
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:135:5: note: in expansion of macro ‘ifTypeDeclareIsNaN’
ifTypeDeclareIsNaN(double)
^~~~~~~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp: In function ‘Pothos::Block* makeSporadicInf(const Pothos::DType&)’:
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:146:103: error: overloaded function with no contextual type information
return new SporadicSubnormal<T>(std::numeric_limits<T>::infinity(), CheckFcn<T>(std::isinf), "Inf");
^
/home/user/src/PothosCore/blocks/testers/SporadicSubnormal.cpp:149:5: note: in expansion of macro ‘ifTypeDeclareIsInf’
ifTypeDeclareIsInf(double)
^~~~~~~~~~~~~~~~~~
make[2]: *** [blocks/testers/CMakeFiles/TesterBlocks.dir/build.make:240: blocks/testers/CMakeFiles/TesterBlocks.dir/SporadicSubnormal.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3586: blocks/testers/CMakeFiles/TesterBlocks.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
a block with configurable failure options to test the recovery for the GUI
When there is backpressure, the converter block seems to lose samples:
Graph: https://kevinmehall.net/tmp/convert.pothos
This line looks suspicious. I tried replacing it with inputPort->consume(numElems);
just above outputPort->produce(numElems);
, but that made it stop after the first buffer.
Consider a bursty stream that uses start of frame labels (optional) and end of frame labels to designate the boundaries of a burst.
Immediate use case: The burst fragmenter will accept bursts from a level detector that is fed by an audio source. This will enable the transmission of useful audio data over a link. The burst reassembler will feed the bursts to an audio sink which will use the end of frame label to stop the audio device and avoid underflow: pothosware/PothosAudio#2
The inline buffer test with the adder shows failures. An extra reference count can be seen on the buffer, and the read before write buffer inlining fails to activate. Best I can tell this is a race condition since changing the registry path for the adder block can fix this on the laptop. Windows VM appears OK, but did notice a failure once...
A number of unit tests have boiler plate duplication for creating a memory buffer, filing it, and verifying it. In some cases we want a pseudorandom stream buffer, in others we want labels and messages as well to test other aspects. In quite a number of the cases, the blocks in the test harness just need to be tested against arbitrary input -- and handwritten test cases are suboptimal.
This issue appears newly introduced.
[ 50%] Building CXX object stream/CMakeFiles/StreamBlocks.dir/IsX.cpp.o [16/911]
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsFinite" and "<" does not give a valid preprocessing token
return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:140:1: note: in expansion of macro ‘registerBlock’
registerBlock(isfinite, IsFinite)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsFinite" and "<" does not give a valid preprocessing token
return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:140:1: note: in expansion of macro ‘registerBlock’
registerBlock(isfinite, IsFinite)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsInf" and "<" does not give a valid preprocessing token
return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:157:1: note: in expansion of macro ‘registerBlock’
registerBlock(isinf, IsInf)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsInf" and "<" does not give a valid preprocessing token
return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:157:1: note: in expansion of macro ‘registerBlock’
registerBlock(isinf, IsInf)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsNaN" and "<" does not give a valid preprocessing token
return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:174:1: note: in expansion of macro ‘registerBlock’
registerBlock(isnan, IsNaN)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsNaN" and "<" does not give a valid preprocessing token
return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:174:1: note: in expansion of macro ‘registerBlock’
registerBlock(isnan, IsNaN)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsNormal" and "<" does not give a valid preprocessing token
return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:192:1: note: in expansion of macro ‘registerBlock’
registerBlock(isnormal, IsNormal)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsNormal" and "<" does not give a valid preprocessing token
return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:192:1: note: in expansion of macro ‘registerBlock’
registerBlock(isnormal, IsNormal)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:111:54: error: pasting "getIsNegative" and "<" does not give a valid preprocessing token
return new IsX<float>(dtype.dimension(), get ## func ## <float>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:209:1: note: in expansion of macro ‘registerBlock’
registerBlock(isnegative, IsNegative)
^~~~~~~~~~~~~
/home/user/src/PothosCore/blocks/stream/IsX.cpp:113:55: error: pasting "getIsNegative" and "<" does not give a valid preprocessing token
return new IsX<double>(dtype.dimension(), get ## func ## <double>()); \
^
/home/user/src/PothosCore/blocks/stream/IsX.cpp:209:1: note: in expansion of macro ‘registerBlock’
registerBlock(isnegative, IsNegative)
^~~~~~~~~~~~~
make[2]: *** [stream/CMakeFiles/StreamBlocks.dir/build.make:380: stream/CMakeFiles/StreamBlocks.dir/IsX.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:350: stream/CMakeFiles/StreamBlocks.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
A quick debug shows that _step
becomes zero, so _index
is never increased in the work function.
Incorporate this into the filter designer
https://github.com/hooleyhoop/HooleyBits/blob/master/FFT%20Explore/remez-19980711/remez.c
The socket endpoint and network source/sink supported two reliable transports: TCP, and UDT (a reliable stream layer for UDP). We ended up removing the udt from the unit tests because it randomly failed... not so reliable. However, at this point, it seems to completely not work. The block handshakes fail immediately. I wanted to keep UDT around for benchmarks and experimentation.
Some compiler quick, inBuff.as<const void*>(),
needs to be inBuff.template as<const void*>(),
I have a poor CI setup, so it doesnt run unless I update the submodules manually, it should probably be a CI per project
https://travis-ci.org/github/pothosware/PothosCore/jobs/695417531
home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp: In member function ‘void SporadicSubnormal<T>::work()’:
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:84:24: error: expected primary-expression before ‘void’
outBuff.as<void*>(),
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:84:24: error: expected ‘)’ before ‘void’
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:85:23: error: expected primary-expression before ‘const’
inBuff.as<const void*>(),
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:85:23: error: expected ‘)’ before ‘const’
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:100:47: error: expected primary-expression before ‘*’ token
} while(_checkFcn(outBuff.as<T*>()[index]));
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:100:48: error: expected primary-expression before ‘>’ token
} while(_checkFcn(outBuff.as<T*>()[index]));
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:100:50: error: expected primary-expression before ‘)’ token
} while(_checkFcn(outBuff.as<T*>()[index]));
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:102:29: error: expected primary-expression before ‘*’ token
outBuff.as<T*>()[index] = _subVal;
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:102:30: error: expected primary-expression before ‘>’ token
outBuff.as<T*>()[index] = _subVal;
^
/home/travis/build/pothosware/PothosCore/blocks/testers/SporadicSubnormal.cpp:102:32: error: expected primary-expression before ‘)’ token
outBuff.as<T*>()[index] = _subVal;
^
make[2]: *** [blocks/testers/CMakeFiles/TesterBlocks.dir/SporadicSubnormal.cpp.o] Error 1
make[1]: *** [blocks/testers/CMakeFiles/TesterBlocks.dir/all] Error 2
Rather than copying incoming buffers into a single large buffer to contain the hold packet, we should be able to deal with fragments, specifically to just passively forward stream buffers.
As part of the the basic set of stock conversion blocks:
See
The VRL protocol is one possible way to store stream data and serialized messages, labels in a bounded protocol that can be sent over a wire or to/from a file -- and recover bounds in the face of errors. Create a:
Use a counter/tokens to limit the amount of bytes in the ether between send() and recv(),
without this, send can block, and blocking is bad, we want to guaruntee that there is always space in the ether to accept the data.
so far work is on: https://github.com/pothosware/pothos/tree/simple_mac/pothos-blocks/packet
just a design choice
Create a simple passthrough block with a "boundless" input buffer. The purpose is to be able to buffer vast amounts of data in memory when it cannot be read out fast enough -- at the expense of 1) backing up the flow and 2) consuming available PC memory resources.
This block will have custom input buffer manager that will 1) allocate more buffers on demand, and 2) never report empty (or report empty at some specified maximum).
(relabler can do this, but simpler with a dedicated block)
Just like the stream snooper, this is the backend block for the waveform plotter with special capabilities that one would need in a virtual oscilloscope. Because this is a separate block from the waveform plotter itself, this block may run on the remote host or scratch process so that only the display data is forwarded to the plotter.
I have noticed when running Waveform Source into StreamToPacket it stalls, when its is free running (with not start or end Labels).
I have noticed the block code is consuming the Packet length, I assume this is meant to be the elements().
I did try this change and the block no longer stalls but it produces garbled data after a while.
PothosBlocks/packet/StreamToPacket.cpp
Line 227 in 9d88b03
Also should inputPort->consume do some sanity check to see if there is that much data to consume?
A block that generates test messages for comms testing (for example). We have used the chat box often to stimulate messages. This should have options to generate stuff like random packet payloads incrementing counters, and current timestamps. The random payloads and counters should have a binary and ascii option. Ascii lets us see the messages received in a chat box for helpful debugging. The output is a Pothos::Packet where the payload contains the message bytes.
Rather than actually generating random floats, the randomly generated array of ints are being converted in their binary form. This isnt a big deal, but it seems to fail on arm32 bit
Oh no. The converter block is allocating a new buffer on every call. This can be disaster if it converts faster than a downstream block consumes. We should be using the output buffers provided by the ABI for proper back-pressure.
Create text-based file IO blocks that have configurable delineations.
implement zero copy mmap based reader and writer. We should be able to pass around mapped pages with the buffer management api. It could be advantageous -- needs benchmarking as well.
Hi Guys,
Just getting started with Pothos and I have been learning about LoRa and experimenting with it.
I wanted to see if I could modify one of the demo Pothos flows which simulates generating signals and then reading them back in and decoding them (https://github.com/myriadrf/LoRa-SDR/tree/master/examples/lora_simulation.pth)
I was trying to change it so the user could enter a word in and have it generate a signal and have it decode their word. Currently LoRa Test Gen just generates random numbers and then stores each of them in the payload so you essentially get a counter.
The demo I was looking at had LoRa Test Gen >> Pacer >> LoRa Encoder >> LoRa Mod etc
I tried plugging in a chat box instead of LoRa Test Gen like this :
Chat Box >> Pacer >> LoRa Encoder >> LoRa Mod
but I think that fails because it is not generating a packet correctly.
My question is, how do I create a packet and place a word in the payload which I believe is required for my planned above modification to work.
Or do I need to find the code for LoRa Test Gen and then try and learn C in order to compile my own version of LoRa Test Gen ?
Any help would be appreciated.
Dan
It would be nice to have debug blocks which log labels and messages as in gnuradio
The OS cant handle sends this large (winsock is 4096, linux may be larger?). But in any case, the reliability breaks down when larger items are unnecessarily lost. We should handle the fragmentation and recovery.
Need a blocking read with timeout implementation. May have to use the windows file APIs instead: ReadFile and SetCommTimeouts...
Goal: create a set of core blocks for dealing with bus manipulation in a programmatic way. This allows gui users and JSON markup users to manipulate buses without loops.
This thow is the sign of a handshake error. To replicate, just enable disable the topology in the GUI until fail. The thrower seems to not be getting an ack, and waiting until timeout in the last ack state.
Options:
Ports:
The bursty level detector (may need better name) searches an input stream for continuous regions energy > threshold. These regions are forwarded to the output with start and end labels to indicate the burst boundaries. We may employ a window to avoid false end of bursts and or to pad out the boundaries of the burst.
This block can be used with the stream fragmenter: #31
GIven the desired output type, this block can convert any input type (thats numeric) to that output type. The block will contain a NxN table of factories for template instantiations of said block.
The block should support automatic input type determination: pothosware/pothos-library#36
The FIR taps generation block takes in parameters about an filter, such as stopband, passband, cutoff, and generates an array of taps for an FIR filter.
Consider making this block widget-aware in the future. The widget will be a filter designer GUI to select parameters and preview the filter's profile.
N input port, M output ports, and a setting to map an input to any output
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.