added move for filling
Build on RHEL9 / build (push) Successful in 2m32s
Build on RHEL8 / build (push) Successful in 3m18s
Run tests using data on local RHEL8 / build (push) Successful in 3m56s

This commit is contained in:
Erik Fröjdh
2026-06-05 16:32:17 +02:00
parent bcb0a58272
commit 025de12fd1
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -49,6 +49,8 @@ class PixelHistogram {
// Async producer/consumer pipeline. SPSC queue feeds the coordinator
// thread, which fans each image out to the worker pool one at a time.
// TODO: batch processing?
// TODO: FIFO to avoid allocations?
std::unique_ptr<AsyncQueue> async_queue_;
std::thread coordinator_;
std::atomic<bool> stop_coordinator_{false};
@@ -74,7 +76,7 @@ class PixelHistogram {
// coordinator thread, and returns. Blocks the caller only if the queue
// is full (single-producer, single-consumer queue with a sleep-poll
// backpressure loop, matching the convention in ClusterFinderMT).
void fill_async(NDArray<AxisType, 2> image);
void fill_async(NDArray<AxisType, 2> &&image);
// Wait for all queued async fills to complete. Cheap when the queue
// is already drained.
@@ -289,7 +291,7 @@ void PixelHistogram<StorageType, AxisType>::dispatch(
template <typename StorageType, typename AxisType>
void PixelHistogram<StorageType, AxisType>::fill_async(
NDArray<AxisType, 2> image) {
NDArray<AxisType, 2> &&image) {
if (image.shape(0) != rows_ || image.shape(1) != cols_) {
throw std::invalid_argument(
"PixelHistogram image shape does not match constructor shape");
+1 -1
View File
@@ -40,7 +40,7 @@ void define_pixel_histogram_binding(py::module &m, const char *class_name,
asynchronous filling before fill_async() applies
backpressure on the caller (default: 16)
)",
py::arg("rows"), py::arg("cols"), py::arg("n_bins"),
py::kw_only(), py::arg("rows"), py::arg("cols"), py::arg("n_bins"),
py::arg("xmin"), py::arg("xmax"), py::arg("n_threads") = 1,
py::arg("max_pending") = std::size_t{16})