artdaq  v3_01_00
artdaq::ShmemTransfer Class Reference

A TransferInterface implementation plugin that transfers data using Shared Memory. More...

#include <artdaq/TransferPlugins/ShmemTransfer.hh>

Inheritance diagram for artdaq::ShmemTransfer:
artdaq::TransferInterface

Public Member Functions

 ShmemTransfer (fhicl::ParameterSet const &pset, Role role)
 ShmemTransfer Constructor. More...
 
virtual ~ShmemTransfer () noexcept
 ShmemTransfer Destructor.
 
int receiveFragment (Fragment &fragment, size_t receiveTimeout) override
 Receive a Fragment from Shared Memory. More...
 
int receiveFragmentHeader (detail::RawFragmentHeader &header, size_t receiveTimeout) override
 Receive a Fragment Header from the transport mechanism. More...
 
int receiveFragmentData (RawDataType *destination, size_t wordCount) override
 Receive the body of a Fragment to the given destination pointer. More...
 
CopyStatus copyFragment (Fragment &fragment, size_t send_timeout_usec) override
 Copy a Fragment to the destination. May be unreliable. More...
 
CopyStatus moveFragment (Fragment &&fragment) override
 Move a Fragment to the destination. More...
 
- Public Member Functions inherited from artdaq::TransferInterface
 TransferInterface (const fhicl::ParameterSet &ps, Role role)
 TransferInterface Constructor. More...
 
 TransferInterface (const TransferInterface &)=delete
 Copy Constructor is deleted.
 
TransferInterfaceoperator= (const TransferInterface &)=delete
 Copy Assignment operator is deleted. More...
 
virtual ~TransferInterface ()=default
 Default virtual Destructor.
 
virtual int receiveFragment (artdaq::Fragment &fragment, size_t receiveTimeout)
 Receive a Fragment from the transport mechanism. More...
 
virtual CopyStatus copyFragment (artdaq::Fragment &fragment, size_t send_timeout_usec)=0
 Copy a Fragment to the destination. May not necessarily be reliable. More...
 
virtual CopyStatus moveFragment (artdaq::Fragment &&fragment)=0
 Move a Fragment to the destination. This should be reliable, if the underlying transport mechanism supports reliable sending. More...
 
std::string uniqueLabel () const
 Get the unique label of this TransferInterface instance. More...
 
virtual int source_rank () const
 Get the source rank for this TransferInterface instance. More...
 
virtual int destination_rank () const
 Get the destination rank for this TransferInterface instance. More...
 
std::string GetTraceName () const
 Constructs a name suitable for TRACE messages. More...
 

Additional Inherited Members

- Public Types inherited from artdaq::TransferInterface
enum  : int { DATA_END = -2222, RECV_TIMEOUT = -1111, RECV_SUCCESS = 0 }
 
enum  Role { Role::kSend, Role::kReceive }
 Used to determine if a TransferInterface is a Sender or Receiver. More...
 
enum  CopyStatus { CopyStatus::kSuccess, CopyStatus::kTimeout, CopyStatus::kErrorNotRequiringException }
 Returned from the send functions, this enumeration describes the possible return codes. If an exception occurs, it will be thrown and should be handled normally. More...
 
- Static Public Member Functions inherited from artdaq::TransferInterface
static std::string CopyStatusToString (CopyStatus in)
 
- Protected Member Functions inherited from artdaq::TransferInterface
Role role () const
 Get the TransferInterface::Role of this TransferInterface. More...
 
- Protected Attributes inherited from artdaq::TransferInterface
size_t buffer_count_
 The number of Fragment transfers the TransferInterface can handle simultaneously.
 
const size_t max_fragment_size_words_
 The maximum size of the transferred Fragment objects, in artdaq::Fragment::RawDataType words.
 
const short partition_number_
 The partition number of the DAQ.
 

Detailed Description

A TransferInterface implementation plugin that transfers data using Shared Memory.

Definition at line 14 of file ShmemTransfer.hh.

Constructor & Destructor Documentation

artdaq::ShmemTransfer::ShmemTransfer ( fhicl::ParameterSet const &  pset,
Role  role 
)

ShmemTransfer Constructor.

Parameters
psetParameterSet used to configure ShmemTransfer
roleRole of this ShmemTransfer instance (kSend or kReceive)
* ShmemTransfer accepts the following Parameters:
* "shm_key_offset" (Default: 0): Offset to add to shared memory key (hash of uniqueLabel)
* 

ShmemTransfer also requires all Parameters for configuring a TransferInterface Additionally, an offset can be added via the ARTDAQ_SHMEM_TRANSFER_OFFSET envrionment variable. Note that this variable, if used, MUST have the same value for all artdaq processes communicating via ShmemTransfer.

Definition at line 7 of file Shmem_transfer.cc.

Member Function Documentation

artdaq::TransferInterface::CopyStatus artdaq::ShmemTransfer::copyFragment ( Fragment &  fragment,
size_t  send_timeout_usec 
)
override

Copy a Fragment to the destination. May be unreliable.

Parameters
fragmentFragment to copy
send_timeout_usecTimeout for send, in microseconds
Returns
CopyStatus detailing result of copy

Definition at line 161 of file Shmem_transfer.cc.

artdaq::TransferInterface::CopyStatus artdaq::ShmemTransfer::moveFragment ( Fragment &&  fragment)
override

Move a Fragment to the destination.

Parameters
fragmentFragment to move
Returns
CopyStatus detailing result of move

Definition at line 167 of file Shmem_transfer.cc.

int artdaq::ShmemTransfer::receiveFragment ( Fragment &  fragment,
size_t  receiveTimeout 
)
override

Receive a Fragment from Shared Memory.

Parameters
[out]fragmentReceived Fragment
receiveTimeoutTimeout for receive, in microseconds
Returns
Rank of sender or RECV_TIMEOUT

Definition at line 63 of file Shmem_transfer.cc.

int artdaq::ShmemTransfer::receiveFragmentData ( RawDataType *  destination,
size_t  wordCount 
)
overridevirtual

Receive the body of a Fragment to the given destination pointer.

Parameters
destinationPointer to memory region where Fragment data should be stored
wordCountNumber of words of Fragment data to receive
Returns
The rank the Fragment was received from (should be source_rank), or RECV_TIMEOUT

Implements artdaq::TransferInterface.

Definition at line 147 of file Shmem_transfer.cc.

int artdaq::ShmemTransfer::receiveFragmentHeader ( detail::RawFragmentHeader &  header,
size_t  receiveTimeout 
)
overridevirtual

Receive a Fragment Header from the transport mechanism.

Parameters
[out]headerReceived Fragment Header
receiveTimeoutTimeout for receive
Returns
The rank the Fragment was received from (should be source_rank), or RECV_TIMEOUT

Implements artdaq::TransferInterface.

Definition at line 103 of file Shmem_transfer.cc.


The documentation for this class was generated from the following files: