From acd7fdc48adef7eaf5288638aaf50e9c71daa926 Mon Sep 17 00:00:00 2001 From: Erik Garrison Date: Sun, 2 Jun 2024 12:44:06 -0500 Subject: [PATCH] update atomic queue definition and documentation for better single-produce multi-consumer behavior --- src/align/include/computeAlignments.hpp | 37 ++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/align/include/computeAlignments.hpp b/src/align/include/computeAlignments.hpp index 5e8f4037..b5636d6d 100644 --- a/src/align/include/computeAlignments.hpp +++ b/src/align/include/computeAlignments.hpp @@ -67,10 +67,39 @@ struct seq_record_t { { } }; -// load into this -typedef atomic_queue::AtomicQueue seq_atomic_queue_t; -// results into this, write out -typedef atomic_queue::AtomicQueue paf_atomic_queue_t; +/** + * @brief A single-producer, multi-consumer (SPMC) atomic queue for storing pointers to seq_record_t objects. + * + * This queue is designed for a setup where there is a single producer and multiple consumers. + * The producer enqueues pointers to seq_record_t objects, which represent sequences to be processed. + * Multiple consumers dequeue these pointers and perform long-running alignment processes on the sequences. + * + * The queue has the following characteristics: + * - Capacity: 1024 elements + * - Default value for empty elements: nullptr + * - MINIMIZE_CONTENTION: true (minimizes contention among consumers) + * - MAXIMIZE_THROUGHPUT: true (optimized for high throughput) + * - TOTAL_ORDER: false (relaxed memory ordering for better performance) + * - SPSC: false (single-producer, multi-consumer mode) + */ +typedef atomic_queue::AtomicQueue seq_atomic_queue_t; + +/** + * @brief A single-producer, multi-consumer (SPMC) atomic queue for storing pointers to std::string objects. + * + * This queue is designed for a setup where there is a single producer and multiple consumers. + * The producer enqueues pointers to std::string objects, which represent PAF (Pairwise Alignment Format) strings. + * Multiple consumers dequeue these pointers and write out the PAF strings. + * + * The queue has the following characteristics: + * - Capacity: 1024 elements + * - Default value for empty elements: nullptr + * - MINIMIZE_CONTENTION: true (minimizes contention among consumers) + * - MAXIMIZE_THROUGHPUT: true (optimized for high throughput) + * - TOTAL_ORDER: false (relaxed memory ordering for better performance) + * - SPSC: false (single-producer, multi-consumer mode) + */ +typedef atomic_queue::AtomicQueue paf_atomic_queue_t; /** * @class align::Aligner