|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
TebReceiver of the GPU DRP. More...
#include <PGPDetector.hh>
Inherits Drp::TebReceiverBase.
Public Member Functions | |
| TebReceiver (const Parameters &, DrpBase &, const std::atomic< bool > &terminate) | |
| Store the parameters, the DRP and the terminate flag; setup() creates the writers and the recorder thread. | |
| ~TebReceiver () override | |
| Destroy the recorder stream if one exists and stop the recorder thread (teardown()). | |
| FileWriterBase & | fileWriter () override |
| Return the cuFile FileWriter created by setup() (not valid before setup()). | |
| SmdWriterBase & | smdWriter () override |
| Return the SmdWriter created by setup() (not valid before setup()). | |
| void | setup (cudaExecutionContext_t green_ctx) |
| Create a cuFile FileWriter with a 32 MiB buffer and O_DIRECT and an SmdWriter, then start the recorder thread, which creates its stream in green_ctx. | |
| void | teardown () |
| Shut down the record queue and join the recorder thread. | |
Public Member Functions inherited from Drp::TebReceiverBase | |
| TebReceiverBase (const Parameters &, DrpBase &) | |
| Construct the EbCtrbInBase from the TEB parameters of the DRP, keep references to the DRP and its pool, and allocate a buffer of para.maxTrSize bytes for the Configure datagram. | |
| virtual | ~TebReceiverBase () |
| Does nothing; empty body. | |
| void | resetCounters (bool all) |
| Reset the EbCtrbInBase counters, the damage count and histogram and the latency; with all true, also reset the expected next buffer index so that index 0 is expected. | |
| int | connect (const std::shared_ptr< Pds::MetricExporter >) |
| Register metrics (if the exporter is non-null), remember the node ID on the timing-system DRP (detType ts), and connect to the TEBs with EbCtrbInBase::connect(). | |
| void | unconfigure () |
| Close the files (in case BeginRun failed), then call EbCtrbInBase::unconfigure(). | |
| std::string | openFiles (const RunInfo &runInfo) |
| If runInfo.runNumber is non-zero, create the directories and open the data file outputDir/instrument/experiment/xtc/RUN.xtc2 and the small-data file RUN.smd.xtc2 in its smalldata subdirectory (RUN is experiment-rNNNN-sNNN-c000), sending a file report message for each. | |
| bool | advanceChunkId () |
| If no chunk change is pending, increment the chunk ID in the file parameters, mark a change pending and return true; otherwise return false. | |
| std::string | reopenFiles () |
| Close the current data file and open the data file for the new chunk (name from FileParameters::runName()), sending a file report message and clearing the pending flag on success. | |
| std::string | closeFiles () |
| If writing, clear the writing flag and close the small-data and data files. | |
| uint64_t | chunkSize () const |
| Return the number of bytes recorded since the current chunk started. | |
| void | chunkRequestSet () |
| Set the chunk-request flag. | |
| void | chunkReset () |
| Clear the chunk offset, the chunk-request flag and the pending flag left from a previous run. | |
| void | offsetReset () |
| Set the recorded byte offset to 0. | |
| void | offsetAppend (size_t size) |
| Add size to the recorded byte offset. | |
| bool | writing () const |
| Return true while files are open for recording (from a successful openFiles() until closeFiles()). | |
| const FileParameters & | fileParameters () const |
| Return the file parameters cached by openFiles(); valid only after a successful openFiles(). | |
Public Member Functions inherited from Pds::Eb::EbCtrbInBase | |
| EbCtrbInBase (const TebCtrbParams &) | |
| Keep a reference to the parameters and create the server transport from prms.verbose and prms.kwargs. | |
| virtual | ~EbCtrbInBase () |
| Free the result region. | |
| int | resetCounters () |
| Reset the batch, event, missing, bypass and no-progress counters; returns 0. | |
| int | startConnection (std::string &port) |
| Listen on prms.ifAddr:port for up to MAX_TEBS TEB connections with EbLfServer::listen(); an empty port is replaced by the bound ephemeral port. | |
| int | connect (const std::shared_ptr< MetricExporter >) |
| Register metrics with the exporter (if non-null) and accept one link per builder in prms.builders with linksConnect(). | |
| int | configure (unsigned numBuffers) |
| Forget left-over inputs and deferred results, then for each TEB link receive the result region size, (re)allocate the shared result region if the size changed, and register it and send its description with EbLfSvrLink::setupMr(). | |
| void | unconfigure () |
| Does nothing; empty body. | |
| void | disconnect () |
| Call unconfigure(), then disconnect and drop all links. | |
| void | shutdown () |
| Call disconnect(), then shut down the transport. | |
| void | receiver (TebContributor &, std::atomic< bool > &running) |
| Thread body: pin to prms.core[1], name the thread drp/TEBreceiver and repeatedly wait (100 ms each) for result batches and match them with the pending inputs of ctrb, until running becomes false. | |
Protected Member Functions | |
| int | setupMetrics (const std::shared_ptr< Pds::MetricExporter >, std::map< std::string, std::string > &labels) override |
| void | complete (unsigned index, const Pds::Eb::ResultDgram &) override |
Protected Member Functions inherited from Drp::TebReceiverBase | |
| void | process (const Pds::Eb::ResultDgram &, unsigned index) override |
| Pure virtual: handle the result of one event; index is the buffer index of the matching input datagram. | |
Additional Inherited Members | |
Static Public Attributes inherited from Drp::TebReceiverBase | |
| static const uint64_t | DefaultChunkThresh = 500ull * 1024ull * 1024ull * 1024ull |
| Chunk threshold of 500 * 1024^3 bytes (500 GB per the comment): process() requests a new chunk when chunkSize() exceeds it, and DrpBase::enable() advances the chunk once chunkSize() exceeds half of it. | |
Protected Attributes inherited from Drp::TebReceiverBase | |
| MemPool & | m_pool |
| DrpBase & | m_drp |
| unsigned | m_tsId |
| ZmqSocket & | m_inprocSend |
| bool | m_chunkRequest |
| unsigned | m_configureIndex |
| std::vector< uint8_t > | m_configureBuffer |
| uint64_t | m_evtSize |
| uint64_t | m_latPid |
| int64_t | m_latency |
TebReceiver of the GPU DRP.
complete() queues each result for a recorder thread and starts a reducer for events to be persisted or monitored. The recorder waits for the reduced data, writes datagrams from GPU memory with cuFile and small data with SmdWriter, posts monitored events and frees the buffers.
| Drp::Gpu::TebReceiver::TebReceiver | ( | const Parameters & | , |
| DrpBase & | , | ||
| const std::atomic< bool > & | terminate | ||
| ) |
Store the parameters, the DRP and the terminate flag; setup() creates the writers and the recorder thread.
|
override |
Destroy the recorder stream if one exists and stop the recorder thread (teardown()).
|
overrideprotectedvirtual |
Implements Drp::TebReceiverBase.
|
inlineoverridevirtual |
Return the cuFile FileWriter created by setup() (not valid before setup()).
Implements Drp::TebReceiverBase.
| void Drp::Gpu::TebReceiver::setup | ( | cudaExecutionContext_t | green_ctx | ) |
Create a cuFile FileWriter with a 32 MiB buffer and O_DIRECT and an SmdWriter, then start the recorder thread, which creates its stream in green_ctx.
|
overrideprotectedvirtual |
Implements Drp::TebReceiverBase.
|
inlineoverridevirtual |
Return the SmdWriter created by setup() (not valid before setup()).
Implements Drp::TebReceiverBase.
| void Drp::Gpu::TebReceiver::teardown | ( | ) |
Shut down the record queue and join the recorder thread.