From 0060c734b49e2c8fc8775f048c43dbd8065ed7ea Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Wed, 18 Nov 2026 15:14:58 +0100 Subject: [PATCH] FPGAImagePuller: a slot goes back once its image is compressed; dummy modules for even cards - The compressed image is copied into a buffer of the output's own and the slot returned at once: slots are held while an image is assembled and compressed, not while it waits in the queue or in the receiver. The queue keeps its bound of max_slots images: not blocking, an image that finds it full is dropped and counted; blocking, it waits for room while the receiver takes images (until Cancel()). The end message waits the same way. Cancel() (the receiver stops taking images) is now apart from stopping the cards (CancelCards), which the puller does at its own end without giving up on the receiver. No slot deleter runs under a lock any more. - modules_per_card (FPGAImagePullerSettings): the cards run FPGAImagePuller::CardExperiment, each card with that many modules - its modules of the image first, then dummies the puller only returns to the card. The internal generator runs as fast as its card's modules allow, so a 9M on 4 cards (5, 5, 4, 4) ran at 2.04 and 2.55 kHz on the server and drifted ~500 images/s apart; padded to 5 each the cards send the same bytes. The expected packets, the efficiency and the image are of the image's modules. - jfjoch_fpga_stills_test pads by default where the modules do not divide evenly (-U: not), lists each card's modules and dummies, and loads the generator card by card with zeros for the dummies; the distinct images follow the padded count. Mock, 9M, 4 cards, blocking, 3000 images: padded and -U give the same images (indexing 0.760, 48.7 spots per image, 25 distinct). The mock cards' speed does not go with their modules (each is two CPU threads), so on the mock padding does not keep them in step: that is for the server to show (-v). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UqXYdHHZ4cogS1mrGUtfN7 --- docs/TOOLS.md | 12 ++-- receiver/FPGAImagePuller.cpp | 94 +++++++++++++++++++++--------- receiver/FPGAImagePuller.h | 13 ++++- receiver/JFJochReceiverService.cpp | 6 +- receiver/JFJochReceiverService.h | 8 ++- tools/jfjoch_fpga_stills_test.cpp | 51 +++++++++++----- 6 files changed, 131 insertions(+), 53 deletions(-) diff --git a/docs/TOOLS.md b/docs/TOOLS.md index 5517771d1..bfb11fd86 100644 --- a/docs/TOOLS.md +++ b/docs/TOOLS.md @@ -109,10 +109,14 @@ jfjoch_fpga_stills_test [-i ] [-s ] [-N ] [-B ] [-C host either way. One collection is run per rate of `-r` (default `0`, as fast as it goes). `-r` is refused with `-d`: holding a frame on the host makes the card wait, which is blocking again, and dropping the frames that come early would keep a different subset on each card, as their generators run apart. -- With `-d` the cards' generators run free, each at its own speed, so the cards drift apart - unlike the - modules of a detector, which a common trigger keeps together. The images started by the cards ahead hold - the puller's slots until the frames of the card behind arrive: give `-p` at least the frames the cards - drift apart (`-v` shows each card's frames), or images are dropped for want of a slot. +- The cards' generators run free, each as fast as its modules' bandwidth allows, so cards with different + numbers of modules (a 9M on 4 cards: 5, 5, 4, 4) drift apart - unlike the modules of a detector, which a + common trigger keeps together - and with `-d` the images started by the cards ahead hold the puller's slots + until the frames of the card behind arrive. Where the modules do not divide evenly, every card is therefore + given as many modules as the largest, the rest dummy modules (zeros) the generator sends and the puller does + not read (`FPGAImagePuller::CardExperiment`; not part of the image, nor of its efficiency); `-U` leaves them + out. The start lines give each card's modules and dummies; the distinct images follow the padded count. With + `-U` (or cards that still drift, `-v` shows each card's frames) give `-p` at least the frames they drift apart. - For each rate it reports the rate images were delivered (first to last image), the fraction of that time the source was blocked by the chain behind it (the time the puller's module threads waited for a free slot, mean over the modules), the sustained rate (images / wall time, start to the end of the analysis) diff --git a/receiver/FPGAImagePuller.cpp b/receiver/FPGAImagePuller.cpp index b23af6da5..c017651f1 100644 --- a/receiver/FPGAImagePuller.cpp +++ b/receiver/FPGAImagePuller.cpp @@ -10,9 +10,10 @@ FPGAImagePuller::FPGAImagePuller(const DiffractionExperiment &in_experiment, const PixelMask &mask, const JFCalibration *calibration, AcquisitionDeviceGroup &in_devices, Logger &in_logger, int64_t compression_threads, size_t in_max_slots, - bool in_blocking, double in_frame_rate_hz) - : ImagePuller(in_max_slots + 2), // every slot, the start and the end message: Put never finds it full + bool in_blocking, double in_frame_rate_hz, int64_t modules_per_card) + : ImagePuller(in_max_slots + 2), // as many images as slots, the start and the end message experiment(in_experiment), + card_experiment(CardExperiment(in_experiment, modules_per_card)), logger(in_logger), devices(in_devices), max_slots(in_max_slots), @@ -28,11 +29,14 @@ FPGAImagePuller::FPGAImagePuller(const DiffractionExperiment &in_experiment, con adu_histogram.emplace_back(std::make_unique()); for (int d = 0; d < ndatastreams; d++) { - devices[d].PrepareAction(experiment); - expected_packets_per_image += devices[d].Counters().GetExpectedPacketsPerImage(); + devices[d].PrepareAction(card_experiment); + // Of the modules of the image, not the dummies + expected_packets_per_image += devices[d].Counters().GetExpectedPacketsPerImage() + * experiment.GetModulesNum(d) / card_experiment.GetModulesNum(d); } - if (experiment.GetDetectorType() != DetectorType::JUNGFRAU) + // The calibration and the mask are of the modules of the image + if ((experiment.GetDetectorType() != DetectorType::JUNGFRAU) || (modules_per_card > 0)) calibration = nullptr; // Making a slot is slow and its buffers are written once here: none is made, nor first touched, during the run @@ -50,7 +54,7 @@ FPGAImagePuller::FPGAImagePuller(const DiffractionExperiment &in_experiment, con compress_futures.emplace_back(std::async(std::launch::async, &FPGAImagePuller::CompressThread, this)); for (int d = 0; d < ndatastreams; d++) - for (int m = 0; m < experiment.GetModulesNum(d); m++) + for (int m = 0; m < card_experiment.GetModulesNum(d); m++) module_futures.emplace_back(std::async(std::launch::async, &FPGAImagePuller::ModuleThread, this, d, m)); std::latch ready(ndatastreams); @@ -82,6 +86,16 @@ FPGAImagePuller::~FPGAImagePuller() { outside_fifo.Clear(); } +DiffractionExperiment FPGAImagePuller::CardExperiment(const DiffractionExperiment &x, int64_t modules_per_card) { + if (modules_per_card <= 0) + return x; + DiffractionExperiment ret(x); + const DetectorSettings settings = x.GetDetectorSettings(); + ret.Detector(DetJF(static_cast(modules_per_card * x.GetDataStreamsNum()))); + ret.ImportDetectorSettings(settings); + return ret; +} + void FPGAImagePuller::SetError(std::exception_ptr e) { std::unique_lock ul(error_mutex); if (!error) @@ -90,9 +104,14 @@ void FPGAImagePuller::SetError(std::exception_ptr e) { } void FPGAImagePuller::Cancel() { - // An image waiting for a slot is dropped from here on: after a cancel nobody may take the images that hold them + // An image waiting for a slot or for room in the queue is dropped from here on: after a cancel the receiver takes + // no more images cancelled = true; slot_returned.notify_all(); + CancelCards(); +} + +void FPGAImagePuller::CancelCards() { for (int d = 0; d < experiment.GetDataStreamsNum(); d++) devices[d].Cancel(); } @@ -112,11 +131,14 @@ void FPGAImagePuller::AcquireThread(uint16_t data_stream, const PixelMask &mask, // Only what the card needs for the pixels: its analysis results are not read. if (calibration != nullptr) device.InitializeCalibration(experiment, *calibration); - device.InitializePixelMask(experiment, mask); - device.StartAction(experiment); + if (card_experiment.GetModulesNum() == experiment.GetModulesNum()) + device.InitializePixelMask(experiment, mask); + else + device.InitializeEmptyPixelMask(card_experiment); + device.StartAction(card_experiment); } catch (...) { SetError(std::current_exception()); - Cancel(); // the module threads of the other cards have to come out as well + CancelCards(); // the module threads of the other cards have to come out as well ready.count_down(); return; } @@ -126,7 +148,7 @@ void FPGAImagePuller::AcquireThread(uint16_t data_stream, const PixelMask &mask, device.WaitForActionComplete(); } catch (...) { SetError(std::current_exception()); - Cancel(); + CancelCards(); } } @@ -232,7 +254,9 @@ void FPGAImagePuller::ModuleThread(uint16_t data_stream, uint16_t module_number) break; const bool collected = counters.IsAnyPacketCollected(image, module_number); - if (const auto slot = GetSlot(image)) { + // A dummy module (CardExperiment): its frames only go back to the card + const bool dummy = module_number >= experiment.GetModulesNum(data_stream); + if (const auto slot = dummy ? nullptr : GetSlot(image)) { if (collected) { const DeviceOutput *output = device.GetDeviceOutput(image, module_number); slot->metadata->Process(output); @@ -254,7 +278,7 @@ void FPGAImagePuller::ModuleThread(uint16_t data_stream, uint16_t module_number) } } catch (...) { SetError(std::current_exception()); - Cancel(); + CancelCards(); } } @@ -276,22 +300,23 @@ void FPGAImagePuller::CompressThread() { continue; } - message.image = slot->transformation.GetCompressedImage(); + // The compressed image goes to a buffer of the output's own, and the slot back at once: the slots are + // held only while an image is assembled and compressed, not while it waits for the receiver + const CompressedImage compressed = slot->transformation.GetCompressedImage(); + auto bytes = std::make_shared>(compressed.GetCompressed(), + compressed.GetCompressed() + compressed.GetCompressedSize()); + ReturnSlot(slot); + message.image = CompressedImage(bytes->data(), bytes->size(), compressed.GetWidth(), compressed.GetHeight(), + compressed.GetMode(), compressed.GetCompressionAlgorithm()); ImagePullerOutput output; output.cbor = std::make_shared(message); - // The image lives in the slot: it goes back when the last copy of this output is gone. - output.raw = std::shared_ptr( - new ReceiveBufferRegion{const_cast(message.image.GetCompressed()), - message.image.GetCompressedSize()}, - [this, slot](ReceiveBufferRegion *region) { - delete region; - ReturnSlot(slot); - }); + output.raw = std::shared_ptr(new ReceiveBufferRegion{bytes->data(), bytes->size()}, + [bytes](ReceiveBufferRegion *region) { delete region; }); Emit(image_number, std::move(output)); } catch (...) { SetError(std::current_exception()); - Cancel(); + CancelCards(); ReturnSlot(slot); Emit(image_number, std::nullopt); } @@ -309,7 +334,10 @@ void FPGAImagePuller::Emit(int64_t image_number, std::optionalsecond) { it->second->received = std::chrono::steady_clock::now(); - outside_fifo.Put(*it->second); + // The queue holds as many images as there are slots: blocking, the image waits for room; not + // blocking, it is dropped + if (!(blocking ? PutWhileNotCancelled(*it->second) : outside_fifo.Put(*it->second))) + dropped_images++; released.push_back(std::move(*it->second)); } } @@ -323,7 +351,7 @@ void FPGAImagePuller::FinalizeMeasurement() { for (auto &f: compress_futures) f.get(); - Cancel(); + CancelCards(); for (auto &f: acquire_futures) f.get(); @@ -332,8 +360,8 @@ void FPGAImagePuller::FinalizeMeasurement() { std::map> left; // destroyed after order_mutex, as in Emit std::unique_lock ul(order_mutex); for (auto &[n, output]: images_done) - if (output) - outside_fifo.Put(*output); + if (output && !PutWhileNotCancelled(*output)) + dropped_images++; left.swap(images_done); } @@ -343,6 +371,14 @@ void FPGAImagePuller::FinalizeMeasurement() { EndMessage end{}; for (size_t i = 0; i < adu_histogram.size(); i++) end.adu_histogram["module" + std::to_string(i)] = adu_histogram[i]->GetHistogram(); - outside_fifo.Put({.cbor = std::make_shared(end), - .received = std::chrono::steady_clock::now()}); + PutWhileNotCancelled({.cbor = std::make_shared(end), + .received = std::chrono::steady_clock::now()}); +} + +// Waits for room in the queue, as long as the receiver takes from it: after a cancel it no longer does +bool FPGAImagePuller::PutWhileNotCancelled(const ImagePullerOutput &output) { + while (!outside_fifo.PutTimeout(output, std::chrono::milliseconds(100))) + if (cancelled) + return false; + return true; } diff --git a/receiver/FPGAImagePuller.h b/receiver/FPGAImagePuller.h index 599abfce7..f34d862f2 100644 --- a/receiver/FPGAImagePuller.h +++ b/receiver/FPGAImagePuller.h @@ -40,6 +40,8 @@ private: }; const DiffractionExperiment experiment; + // What the cards run: the experiment, or with dummy modules (CardExperiment) + const DiffractionExperiment card_experiment; Logger &logger; AcquisitionDeviceGroup &devices; const size_t max_slots; @@ -89,11 +91,20 @@ private: std::shared_ptr GetSlot(int64_t image_number); void ReturnSlot(const std::shared_ptr &slot); void Emit(int64_t image_number, std::optional output); + bool PutWhileNotCancelled(const ImagePullerOutput &output); + void CancelCards(); public: // Arms the cards; when it returns the detector can be started. FPGAImagePuller(const DiffractionExperiment &experiment, const PixelMask &mask, const JFCalibration *calibration, AcquisitionDeviceGroup &devices, Logger &logger, int64_t compression_threads, - size_t max_slots = DefaultSlots, bool blocking = false, double frame_rate_hz = 0); + size_t max_slots = DefaultSlots, bool blocking = false, double frame_rate_hz = 0, + int64_t modules_per_card = 0); + + // The experiment the cards run where each carries modules_per_card modules (0: as `x` splits them): each card's + // modules of `x` first, in their order, then dummy modules the generator sends and the puller does not read. + // For the internal generator, whose speed goes with the modules of the card: cards of different module counts + // run apart, where a detector's modules keep in step. + static DiffractionExperiment CardExperiment(const DiffractionExperiment &x, int64_t modules_per_card); ~FPGAImagePuller() override; void Disconnect() override {} diff --git a/receiver/JFJochReceiverService.cpp b/receiver/JFJochReceiverService.cpp index 07114d667..988171da7 100644 --- a/receiver/JFJochReceiverService.cpp +++ b/receiver/JFJochReceiverService.cpp @@ -41,7 +41,7 @@ JFJochReceiverService &JFJochReceiverService::RugnuxLive(bool enable, std::share } JFJochReceiverService &JFJochReceiverService::FPGAImagePullerSettings(size_t slots, bool blocking, double frame_rate_hz, - bool always) { + bool always, int64_t modules_per_card) { std::unique_lock ul_state(state_mutex); if (state != ReceiverState::Idle) throw JFJochException(JFJochExceptionCategory::WrongDAQState, @@ -50,6 +50,7 @@ JFJochReceiverService &JFJochReceiverService::FPGAImagePullerSettings(size_t slo fpga_image_puller_blocking = blocking; fpga_image_puller_rate_hz = frame_rate_hz; fpga_image_puller_always = always; + fpga_image_puller_modules_per_card = modules_per_card; return *this; } @@ -146,7 +147,8 @@ void JFJochReceiverService::Start(const DiffractionExperiment &experiment, if (FPGAImagePullerFor(experiment)) { fpga_puller = std::make_shared(experiment, pixel_mask, calibration, aq_devices, logger, nthreads, fpga_image_puller_slots, - fpga_image_puller_blocking, fpga_image_puller_rate_hz); + fpga_image_puller_blocking, fpga_image_puller_rate_hz, + fpga_image_puller_modules_per_card); puller = fpga_puller; } diff --git a/receiver/JFJochReceiverService.h b/receiver/JFJochReceiverService.h index acc361c23..3ac3cbed2 100644 --- a/receiver/JFJochReceiverService.h +++ b/receiver/JFJochReceiverService.h @@ -43,6 +43,7 @@ class JFJochReceiverService { // A PSI collection analysed by rugnux live goes through FPGAImagePuller to the stream receivers bool fpga_image_puller_always = false; + int64_t fpga_image_puller_modules_per_card = 0; size_t fpga_image_puller_slots = FPGAImagePuller::DefaultSlots; bool fpga_image_puller_blocking = false; double fpga_image_puller_rate_hz = 0; @@ -76,11 +77,12 @@ public: int64_t stills_downsample = 1); RugnuxLiveSnapshot GetRugnuxStatus() const; void ClearRugnuxStatus(); // back to Idle, as before any collection - // slots, blocking, frame_rate_hz: see FPGAImagePuller. always: every PSI collection but pedestal and host - // summation through the puller, without rugnux to JFJochReceiverLite (for tests comparing it with + // slots, blocking, frame_rate_hz, modules_per_card: see FPGAImagePuller. always: every PSI collection but pedestal + // and host summation through the puller, without rugnux to JFJochReceiverLite (for tests comparing it with // JFJochReceiverFPGA) JFJochReceiverService& FPGAImagePullerSettings(size_t slots = FPGAImagePuller::DefaultSlots, bool blocking = false, - double frame_rate_hz = 0, bool always = false); + double frame_rate_hz = 0, bool always = false, + int64_t modules_per_card = 0); // Of the last collection through FPGAImagePuller: FPGAImagePuller::GetSlotWaitTime_s, 0 without one double GetFPGAImagePullerSlotWaitTime_s() const; JFJochReceiverService& PreviewSocket(const std::string &addr, const std::optional &watermark = {}); diff --git a/tools/jfjoch_fpga_stills_test.cpp b/tools/jfjoch_fpga_stills_test.cpp index 992ecc338..eb6254a77 100644 --- a/tools/jfjoch_fpga_stills_test.cpp +++ b/tools/jfjoch_fpga_stills_test.cpp @@ -43,10 +43,11 @@ void print_usage(Logger &logger) { logger.Info(" -r Rates the source is paced at, one collection each (default: 0 = as fast as it goes); the"); logger.Info(" host takes frame i no earlier than i/rate, the card waits meanwhile: blocking runs only"); logger.Info(" -p FPGAImagePuller slots (default 128)"); + logger.Info(" -U No dummy modules: where the cards carry different numbers of modules, they run apart"); logger.Info(" -k Analyse 1 of every images on average (rugnux live stills_downsample, default 1)"); logger.Info(" -d Not blocking, as the broker runs: images the host has no room for are dropped. The cards'"); - logger.Info(" generators run free and apart (each at its own speed), unlike a detector's modules:"); - logger.Info(" give -p at least the frames they drift apart (-v shows them)"); + logger.Info(" generators run free, each at a speed that goes with its modules: where the modules do not"); + logger.Info(" divide evenly, each card is given dummy modules up to the largest count (-U: not)"); logger.Info(" -K{} Mock of the card instead of /dev/jfjoch* (optional: its generator memory, default 64 MiB ="); logger.Info(" 128 module frames)"); } @@ -92,7 +93,7 @@ int64_t GeneratorImages(AcquisitionDeviceGroup &aq_devices, const DiffractionExp bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::string &file, std::optional nimages, uint16_t nstreams, uint16_t nthreads, size_t send_buffer_size_MiB, const IndexingSettings &indexing, const std::optional &cell, size_t puller_slots, - const std::vector &rates, bool dropping, int64_t downsample, + const std::vector &rates, bool dropping, bool pad, int64_t downsample, const std::optional &space_group) { RegisterHDF5Filter(); JFJochHDF5Reader reader; @@ -127,12 +128,18 @@ bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::s file_x.GetGemmiSpaceGroup()->hm); x.ImportIndexingSettings(indexing); - const int64_t generator_images = GeneratorImages(aq_devices, x, reader.GetNumberOfImages()); + // The generator's speed goes with the modules of its card: with the modules not dividing evenly, every card is + // given as many as the largest, the rest dummies the puller does not read (FPGAImagePuller::CardExperiment) + const int64_t modules_per_card = (pad && (x.GetModulesNum() % nstreams != 0)) ? x.GetModulesNum(0) : 0; + DiffractionExperiment card_x = FPGAImagePuller::CardExperiment(x, modules_per_card); + + const int64_t generator_images = GeneratorImages(aq_devices, card_x, reader.GetNumberOfImages()); if (generator_images < 1) { - logger.Error("The card memory cannot hold one image of {} modules", x.GetModulesNum()); + logger.Error("The card memory cannot hold one image of {} modules", card_x.GetModulesNum(0)); return false; } x.InternalPacketGeneratorImages(generator_images, FPGA_INTERNAL_GENERATOR_MAX_IMAGES); + card_x.InternalPacketGeneratorImages(generator_images, FPGA_INTERNAL_GENERATOR_MAX_IMAGES); PixelMask mask(x); if (dataset->pixel_mask->GetMask().size() == x.GetPixelsNum()) @@ -141,9 +148,17 @@ bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::s logger.Info("Dataset {}: {} images of {} modules, {} distinct ones in the generator, {} in the run", file, reader.GetNumberOfImages(), x.GetModulesNum(), generator_images, x.GetImageNum()); for (int i = 0; i < x.GetDataStreamsNum(); i++) - logger.Info(" card {}: modules {}-{}, generator memory {} module frames, {} used", i, + logger.Info(" card {}: modules {}-{} and {} dummy, generator memory {} module frames, {} used", i, x.GetFirstModuleOfDataStream(i), x.GetFirstModuleOfDataStream(i) + x.GetModulesNum(i) - 1, - aq_devices[i].GetInternalGeneratorModuleFrames(), x.GetModulesNum(i) * generator_images); + card_x.GetModulesNum(i) - x.GetModulesNum(i), aq_devices[i].GetInternalGeneratorModuleFrames(), + card_x.GetModulesNum(i) * generator_images); + if (dropping && !pad) { + for (int i = 1; i < x.GetDataStreamsNum(); i++) + if (x.GetModulesNum(i) != x.GetModulesNum(0)) { + logger.Warning("The cards carry different numbers of modules: their generators run apart (-U)"); + break; + } + } for (int m = 0; m < x.GetModulesNum(); m++) logger.Debug(" module {}: pixel 0 at ({}, {}), fast step {}, slow step {}", m, x.GetPixel0OfModuleConv(m) % x.GetXPixelsNum(), x.GetPixel0OfModuleConv(m) / x.GetXPixelsNum(), @@ -155,15 +170,19 @@ bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::s service.Indexing(x.GetIndexingSettings()); service.RugnuxLive(true, nullptr, 4, 60, false, false, downsample); - // Error, gap and beam-stop pixels of the reader become error pixels of the module frame + // Error, gap and beam-stop pixels of the reader become error pixels of the module frame. Card by card: each + // card's modules of the image, then its dummies (zeros) std::vector frame(x.GetModulesNum() * RAW_MODULE_SIZE); - std::vector frame_u16(frame.size()); + std::vector card_frame(card_x.GetModulesNum() * RAW_MODULE_SIZE); for (int64_t i = 0; i < generator_images; i++) { const auto image = reader.LoadImage(i); SqueezeToRawGeometry(x, frame.data(), image->Image().data(), BEAM_STOP_PXL_VALUE, SATURATED_PXL_VALUE, INT16_MIN, INT16_MAX); - memcpy(frame_u16.data(), frame.data(), frame.size() * sizeof(int16_t)); - service.LoadInternalGeneratorImage(x, frame_u16, i); + for (int d = 0; d < x.GetDataStreamsNum(); d++) + memcpy(card_frame.data() + card_x.GetFirstModuleOfDataStream(d) * RAW_MODULE_SIZE, + frame.data() + x.GetFirstModuleOfDataStream(d) * RAW_MODULE_SIZE, + x.GetModulesNum(d) * RAW_MODULE_SIZE * sizeof(int16_t)); + service.LoadInternalGeneratorImage(card_x, card_frame, i); } struct Row { @@ -176,7 +195,7 @@ bool RunDataset(Logger &logger, AcquisitionDeviceGroup &aq_devices, const std::s for (const double rate: rates) { // Blocking at source: the puller waits for a free slot and the receiver for room in the image buffer, // the cards hold their frames and their generators stall - service.FPGAImagePullerSettings(puller_slots, !dropping, rate); + service.FPGAImagePullerSettings(puller_slots, !dropping, rate, false, modules_per_card); logger.Info(""); logger.Info("=== FPGAImagePuller ({} slots, {}), {} ===", puller_slots, dropping ? "dropping" : "blocking", (rate > 0) ? fmt::format("source paced at {:.1f} Hz", rate) : std::string("source as fast as it goes")); @@ -309,11 +328,12 @@ int main(int argc, char **argv) { bool verbose = false; std::vector rates = {0}; bool dropping = false; + bool pad = true; int64_t downsample = 1; std::optional space_group; int opt; - while ((opt = getopt(argc, argv, "vi:s:N:B:C:S:X:t:r:p:dk:K::")) != -1) { + while ((opt = getopt(argc, argv, "vi:s:N:B:C:S:X:t:r:p:dUk:K::")) != -1) { switch (opt) { case 'v': verbose = true; @@ -366,6 +386,9 @@ int main(int argc, char **argv) { case 'd': dropping = true; break; + case 'U': + pad = false; + break; case 'k': downsample = atol(optarg); break; @@ -419,7 +442,7 @@ int main(int argc, char **argv) { bool ret = false; try { ret = RunDataset(logger, aq_devices, argv[optind], nimages, nstreams, nthreads, send_buffer_size_MiB, - i_settings, cell, puller_slots, rates, dropping, downsample, space_group); + i_settings, cell, puller_slots, rates, dropping, pad, downsample, space_group); } catch (std::exception &e) { logger.Error(e.what()); }