|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Receives the FPGA DMA buffers on the GPU. More...
#include <Reader.hh>
Public Member Functions | |
| Reader (const Parameters &, MemPoolGpu &, Detector &, size_t trgPrimitiveSize, const cudaExecutionContext_t &, const cuda::std::atomic< unsigned > &terminate_d) | |
| Read the nReaders kwarg (default 1; aborts unless it is a power of 2 that divides the DMA buffer count). | |
| ~Reader () | |
| Destroy the reader graphs and free what the constructor allocated, including the host write buffers. | |
| int | setupMetrics (const std::shared_ptr< Pds::MetricExporter >, std::map< std::string, std::string > &labels) |
| Add the per-reader DRP_readerState, DRP_pblWtCtr, DRP_dmaWtCtr, DRP_rdrFwd and DRP_rdrQueOcc metrics and DRP_pblQueOcc to exporter; returns 0. | |
| bool | setup () |
| Record, instantiate and upload one graph per reader. | |
| bool | startup () |
| Clear the handshake word of every DMA buffer and give it to the FPGA (with gpuSetWriteEn() first in HOST_REARMS_DMA builds), reset the DMA buffer index and launch the reader graphs. | |
| void | freeDma (PGPEvent *) |
| Clear the event mask and advance the pebble queue head so that the readers can reuse a pebble buffer; RingIndexHtoD::push() ignores the buffer index passed to it. | |
| void | flush () |
| Free the DMA buffers of all events whose mask is still set, then flush the pebble pool. | |
| auto & | pool () const |
| Return the memory pool. | |
| auto & | readerQueues () const |
| Return the per-reader queues (host and device pointers). | |
| auto | nReaders () const |
| Return the number of reader streams. | |
Receives the FPGA DMA buffers on the GPU.
Each of nReaders streams runs a self-relaunching CUDA graph that, in turn with the other streams, waits for a DMA, takes the next pebble index, copies the DMA descriptor and TimingHeader to the pinned host write buffer and calibrates the payload into the calibration buffer. It then passes the buffer on through its reader queue and gives the DMA buffer back to the FPGA.
| Drp::Gpu::Reader::Reader | ( | const Parameters & | , |
| MemPoolGpu & | , | ||
| Detector & | , | ||
| size_t | trgPrimitiveSize, | ||
| const cudaExecutionContext_t & | , | ||
| const cuda::std::atomic< unsigned > & | terminate_d | ||
| ) |
Read the nReaders kwarg (default 1; aborts unless it is a power of 2 that divides the DMA buffer count).
Create the per-reader indices, queues, streams (in green_ctx, lowest priority), states and metric counters, the pebble queue (starting full) and the host write buffers (DMA descriptor, TimingHeader and trgPrimitiveSize bytes each).
| Drp::Gpu::Reader::~Reader | ( | ) |
Destroy the reader graphs and free what the constructor allocated, including the host write buffers.
| void Drp::Gpu::Reader::flush | ( | ) |
Free the DMA buffers of all events whose mask is still set, then flush the pebble pool.
| void Drp::Gpu::Reader::freeDma | ( | PGPEvent * | ) |
Clear the event mask and advance the pebble queue head so that the readers can reuse a pebble buffer; RingIndexHtoD::push() ignores the buffer index passed to it.
|
inline |
Return the number of reader streams.
|
inline |
Return the memory pool.
|
inline |
Return the per-reader queues (host and device pointers).
| bool Drp::Gpu::Reader::setup | ( | ) |
Record, instantiate and upload one graph per reader.
Returns true on failure, else false.
| int Drp::Gpu::Reader::setupMetrics | ( | const std::shared_ptr< Pds::MetricExporter > | , |
| std::map< std::string, std::string > & | labels | ||
| ) |
Add the per-reader DRP_readerState, DRP_pblWtCtr, DRP_dmaWtCtr, DRP_rdrFwd and DRP_rdrQueOcc metrics and DRP_pblQueOcc to exporter; returns 0.
| bool Drp::Gpu::Reader::startup | ( | ) |
Clear the handshake word of every DMA buffer and give it to the FPGA (with gpuSetWriteEn() first in HOST_REARMS_DMA builds), reset the DMA buffer index and launch the reader graphs.
Returns true only if gpuSetWriteEn() fails, else false.