Writes event data that is already in GPU memory to a file with NVIDIA cuFile.
More...
#include <FileWriter.hh>
Inherits Drp::FileWriterBase.
Inherited by Drp::Gpu::FileWriterAsync.
|
| | FileWriter (size_t bufferSize, bool dio) |
| | Open the cuFile driver and allocate a GPU buffer of bufferSize bytes, reduced to the driver's maximum pinned memory size if larger.
|
| |
| | ~FileWriter () override |
| | Close the file, free the GPU buffer and close the cuFile driver, exiting if that fails.
|
| |
| int | registerStream (cudaStream_t) |
| | Use stream for the buffer copies and register it with cuFile (flags 0x7).
|
| |
| int | deregisterStream (cudaStream_t) |
| | Deregister the stream set by registerStream(), if any, and forget it; the argument is not used.
|
| |
| int | open (const std::string &fileName) override |
| | Close any open file, log the cuFile properties, create or truncate fileName (with O_DIRECT if dio was set), take a write lock and register the file and the GPU buffer with cuFile, then reset the buffer count and file offset.
|
| |
| int | close () override |
| | If a file is open, write out the buffered data, deregister the file and the GPU buffer from cuFile and close the descriptor.
|
| |
| void | writeEvent (const void *devPtr, size_t size, const XtcData::TimeStamp) override |
| | Copy size bytes from device pointer devPtr into the GPU buffer (asynchronously on the registered stream), first writing the buffer to the file with cuFileWrite when the event does not fit or the batch is more than 2 seconds old.
|
| |
| | FileWriterBase () |
| | Start with the writing counter at 0.
|
| |
| virtual | ~FileWriterBase () |
| | Does nothing; empty body.
|
| |
| virtual uint64_t | writing () const |
| | Return the writing counter (non-zero while an implementation is inside a write).
|
| |
|
| static void | dumpProperties () |
| | Log the cuFile driver properties: versions, supported file systems, control and feature flags and size limits.
|
| |
Writes event data that is already in GPU memory to a file with NVIDIA cuFile.
Events are copied device to device into a GPU buffer, which is written to the file when the next event would not fit or the oldest buffered event is more than 2 seconds older than the new one.
◆ FileWriter()
| Drp::Gpu::FileWriter::FileWriter |
( |
size_t |
bufferSize, |
|
|
bool |
dio |
|
) |
| |
Open the cuFile driver and allocate a GPU buffer of bufferSize bytes, reduced to the driver's maximum pinned memory size if larger.
Exits if bufferSize is not a power of 2 or the driver cannot be opened; dio adds O_DIRECT when open() creates a file.
◆ ~FileWriter()
| Drp::Gpu::FileWriter::~FileWriter |
( |
| ) |
|
|
override |
Close the file, free the GPU buffer and close the cuFile driver, exiting if that fails.
◆ close()
| int Drp::Gpu::FileWriter::close |
( |
| ) |
|
|
overridevirtual |
If a file is open, write out the buffered data, deregister the file and the GPU buffer from cuFile and close the descriptor.
Returns the close() result (-1 on error), or 0 if no file was open.
Implements Drp::FileWriterBase.
◆ deregisterStream()
Deregister the stream set by registerStream(), if any, and forget it; the argument is not used.
Returns -1 on failure, else 0.
◆ dumpProperties()
| static void Drp::Gpu::FileWriter::dumpProperties |
( |
| ) |
|
|
static |
Log the cuFile driver properties: versions, supported file systems, control and feature flags and size limits.
◆ open()
| int Drp::Gpu::FileWriter::open |
( |
const std::string & |
fileName | ) |
|
|
overridevirtual |
Close any open file, log the cuFile properties, create or truncate fileName (with O_DIRECT if dio was set), take a write lock and register the file and the GPU buffer with cuFile, then reset the buffer count and file offset.
Returns -1 if the file cannot be created, non-zero (after closing the file) if a cuFile registration fails, else 0; a failed lock is only logged.
Implements Drp::FileWriterBase.
◆ registerStream()
Use stream for the buffer copies and register it with cuFile (flags 0x7).
Returns -1 on failure, else 0.
◆ writeEvent()
| void Drp::Gpu::FileWriter::writeEvent |
( |
const void * |
devPtr, |
|
|
size_t |
size, |
|
|
const XtcData::TimeStamp |
|
|
) |
| |
|
overridevirtual |
Copy size bytes from device pointer devPtr into the GPU buffer (asynchronously on the registered stream), first writing the buffer to the file with cuFileWrite when the event does not fit or the batch is more than 2 seconds old.
Returns early, logging an error, if that write is short; exits if the event is larger than the buffer.
Implements Drp::FileWriterBase.
Reimplemented in Drp::Gpu::FileWriterAsync.
◆ m_batch_starttime
◆ m_buffer_d
| uint8_t* Drp::Gpu::FileWriter::m_buffer_d |
|
protected |
◆ m_bufferSize
| size_t Drp::Gpu::FileWriter::m_bufferSize |
|
protected |
◆ m_dio
| bool Drp::Gpu::FileWriter::m_dio |
|
protected |
◆ m_fd
| int Drp::Gpu::FileWriter::m_fd |
|
protected |
◆ m_fileOffset
| off_t Drp::Gpu::FileWriter::m_fileOffset |
|
protected |
◆ m_handle
| CUfileHandle_t Drp::Gpu::FileWriter::m_handle |
|
protected |
◆ m_stream
The documentation for this class was generated from the following file: