Closed CarlosHdezUAH closed 4 months ago
@CarlosHdezUAH there are some common design patterns:
In a nutshell, what you can do is have a receiver thread which fills one of your buffers and then writes a descriptor of that buffer into a FIFO.
When the buffer is full, you pull the next buffer out of another FIFO and start filling that. If there are no more buffers in your pool, then you'll still overflow but then there's the other thread: It will pull filled buffers out of the first FIFO and write them to disk. When they've been written, you put the empty buffer back into the second FIFO (which goes back to the receiver thread).
If your write-to-disk-thread can sustain the same average rate as your receiver, then you're golden, and you won't be interrupting your receiver thread.
For this case, you can probably use either multiprocessing or multithreading, because both threads are IO bound. But I would default to multiprocessing anyway to get better concurrency.
All of that said -- this is a more of a support request, and not a bug, so I'm going to close this. Best of luck!
Hello! I am interested in acquiring multiple channels with my rig using the Python API. This is my setup: two x310 with two TwinRX each with one Octoclock. I have UHD v4.6.0.0.0 installed. I have Ubuntu 22.04 with Python 3.10.12.
And I am using the following code:
I want to start by simply acquiring 2 channels of the same TwinRX (leaving synchronization aside although I should implement timestamps to handle overflows, although the goal is no overflows).
When I capture the two channels with a sampling rate of 50 MHz the ram starts to fill up until about a minute and a half later it fills up and starts giving overflows. To avoid the overflows I have the following idea: acquire samples continuously and every so often write a file with the samples, clear the ram and the cache to avoid it filling up. The problem is that deleting the ram would interrupt the acquisition process and could delete unwritten samples. The solution to this could be multithreading with the threading library? Honestly I still don't understand very well the difference between mutithreading and multiproccesing in python.
My question is: has anyone already faced this problem and can you tell me how I have to proceed to solve it?
I have read that with multiprocessing I could generate 1 process for each channel and within each process a subprocess to acquire and another to write the file. Something like that
Note: MTUs are at 9000 and I run the following lines of code before launching the acquisition: