artdaq
v3_07_02
|
A TransferInterface implementation plugin that transfers data using Shared Memory. More...
#include <artdaq/TransferPlugins/ShmemTransfer.hh>
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 | transfer_fragment_min_blocking_mode (Fragment const &fragment, size_t send_timeout_usec) override |
Transfer a Fragment to the destination. May not necessarily be reliable, but will not block longer than send_timeout_usec. More... | |
CopyStatus | transfer_fragment_reliable_mode (Fragment &&fragment) override |
Transfer a Fragment to the destination. This should be reliable, if the underlying transport mechanism supports reliable sending. More... | |
bool | isRunning () override |
Determine whether the TransferInterface plugin is able to send/receive data. More... | |
void | flush_buffers () override |
Flush any in-flight data. This should be used by the receiver after the receive loop has ended. | |
![]() | |
TransferInterface (const fhicl::ParameterSet &ps, Role role) | |
TransferInterface Constructor. More... | |
TransferInterface (const TransferInterface &)=delete | |
Copy Constructor is deleted. | |
TransferInterface & | operator= (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 | transfer_fragment_min_blocking_mode (artdaq::Fragment const &fragment, size_t send_timeout_usec)=0 |
Transfer a Fragment to the destination. May not necessarily be reliable, but will not block longer than send_timeout_usec. More... | |
virtual CopyStatus | transfer_fragment_reliable_mode (artdaq::Fragment &&fragment)=0 |
Transfer 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... | |
Additional Inherited Members | |
![]() | |
enum | ReceiveReturnCode : int { DATA_END = -2222, RECV_TIMEOUT = -1111, NO_RANK_INFO = -1, RECV_SUCCESS = 0 } |
Return codes from receive operations More... | |
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... | |
using | Parameters = fhicl::WrappedTable< Config > |
Used for ParameterSet validation (if desired) | |
![]() | |
static std::string | CopyStatusToString (CopyStatus in) |
Convert a CopyStatus variable to its string represenatation More... | |
![]() | |
Role | role () const |
Get the TransferInterface::Role of this TransferInterface. More... | |
![]() | |
const Role | role_ |
Whether this instance of TransferInterface is a sender or receiver. | |
const int | source_rank_ |
Rank of source. | |
const int | destination_rank_ |
Rank of destination. | |
const std::string | unique_label_ |
Unique label of transfer (ideally the same on sender and receiver) | |
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. | |
A TransferInterface implementation plugin that transfers data using Shared Memory.
Definition at line 13 of file ShmemTransfer.hh.
artdaq::ShmemTransfer::ShmemTransfer | ( | fhicl::ParameterSet const & | pset, |
Role | role | ||
) |
ShmemTransfer Constructor.
pset | ParameterSet used to configure ShmemTransfer |
role | Role 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 8 of file Shmem_transfer.cc.
|
overridevirtual |
Determine whether the TransferInterface plugin is able to send/receive data.
Reimplemented from artdaq::TransferInterface.
Definition at line 229 of file Shmem_transfer.cc.
|
override |
Receive a Fragment from Shared Memory.
[out] | fragment | Received Fragment |
receiveTimeout | Timeout for receive, in microseconds |
Definition at line 53 of file Shmem_transfer.cc.
|
overridevirtual |
Receive the body of a Fragment to the given destination pointer.
destination | Pointer to memory region where Fragment data should be stored |
wordCount | Number of words of Fragment data to receive |
Implements artdaq::TransferInterface.
Definition at line 145 of file Shmem_transfer.cc.
|
overridevirtual |
Receive a Fragment Header from the transport mechanism.
[out] | header | Received Fragment Header |
receiveTimeout | Timeout for receive |
Implements artdaq::TransferInterface.
Definition at line 97 of file Shmem_transfer.cc.
|
override |
Transfer a Fragment to the destination. May not necessarily be reliable, but will not block longer than send_timeout_usec.
fragment | Fragment to transfer |
send_timeout_usec | Timeout for send, in microseconds |
Definition at line 163 of file Shmem_transfer.cc.
|
override |
Transfer a Fragment to the destination. This should be reliable, if the underlying transport mechanism supports reliable sending.
fragment | Fragment to transfer |
Definition at line 169 of file Shmem_transfer.cc.