A writer to fill an RNTuple from multiple contexts.
Compared to the sequential RNTupleWriter, a parallel writer enables the creation of multiple RNTupleFillContext (see RNTupleParallelWriter::CreateFillContext). Each fill context prepares independent clusters that are appended to the common ntuple with internal synchronization. Before destruction, all fill contexts must have flushed their data and been destroyed (or data could be lost!).
Note that the sequence of independently prepared clusters is indeterminate and therefore entries are only partially ordered: Entries from one context are totally ordered as they were filled. However, there is no orderering with other contexts and the entries may be appended to the ntuple either before or after other entries written in parallel into other contexts. In addition, two consecutive entries in one fill context can end up separated in the final ntuple, if they happen to fall onto a cluster boundary and other contexts append more entries before the next cluster is full.
At the moment, the parallel writer does not (yet) support incremental updates of the underlying model. Please refer to RNTupleWriter::CreateModelUpdater if required for your use case.
Definition at line 58 of file RNTupleParallelWriter.hxx.
Public Member Functions | |
~RNTupleParallelWriter () | |
std::shared_ptr< RNTupleFillContext > | CreateFillContext () |
Create a new RNTupleFillContext that can be used to fill entries and prepare clusters in parallel. | |
void | EnableMetrics () |
const Detail::RNTupleMetrics & | GetMetrics () const |
Static Public Member Functions | |
static std::unique_ptr< RNTupleParallelWriter > | Append (std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, TFile &file, const RNTupleWriteOptions &options=RNTupleWriteOptions()) |
Append an ntuple to the existing file, which must not be accessed while data is filled into any created context. | |
static std::unique_ptr< RNTupleParallelWriter > | Recreate (std::unique_ptr< RNTupleModel > model, std::string_view ntupleName, std::string_view storage, const RNTupleWriteOptions &options=RNTupleWriteOptions()) |
Recreate a new file and return a writer to write an ntuple. | |
Private Member Functions | |
RNTupleParallelWriter (const RNTupleParallelWriter &)=delete | |
RNTupleParallelWriter (std::unique_ptr< RNTupleModel > model, std::unique_ptr< Internal::RPageSink > sink) | |
RNTupleParallelWriter & | operator= (const RNTupleParallelWriter &)=delete |
Private Attributes | |
std::vector< std::weak_ptr< RNTupleFillContext > > | fFillContexts |
List of all created helpers. They must be destroyed before this RNTupleParallelWriter is destructed. | |
Detail::RNTupleMetrics | fMetrics |
std::unique_ptr< RNTupleModel > | fModel |
The original RNTupleModel connected to fSink; needs to be destructed before it. | |
std::mutex | fMutex |
A global mutex to protect the internal data structures of this object. | |
std::unique_ptr< Internal::RPageSink > | fSink |
The final RPageSink that represents the synchronization point. | |
std::mutex | fSinkMutex |
A mutex to synchronize the final page sink. | |
#include <ROOT/RNTupleParallelWriter.hxx>
|
private |
Definition at line 110 of file RNTupleParallelWriter.cxx.
|
privatedelete |
ROOT::Experimental::RNTupleParallelWriter::~RNTupleParallelWriter | ( | ) |
Definition at line 119 of file RNTupleParallelWriter.cxx.
|
static |
Append an ntuple to the existing file, which must not be accessed while data is filled into any created context.
Definition at line 151 of file RNTupleParallelWriter.cxx.
std::shared_ptr< ROOT::Experimental::RNTupleFillContext > ROOT::Experimental::RNTupleParallelWriter::CreateFillContext | ( | ) |
Create a new RNTupleFillContext that can be used to fill entries and prepare clusters in parallel.
This method is thread-safe and may be called from multiple threads in parallel.
Note that all fill contexts must be destroyed before the RNTupleParallelWriter is destructed.
Definition at line 163 of file RNTupleParallelWriter.cxx.
|
inline |
Definition at line 94 of file RNTupleParallelWriter.hxx.
|
inline |
Definition at line 95 of file RNTupleParallelWriter.hxx.
|
privatedelete |
|
static |
Recreate a new file and return a writer to write an ntuple.
Definition at line 138 of file RNTupleParallelWriter.cxx.
|
private |
List of all created helpers. They must be destroyed before this RNTupleParallelWriter is destructed.
Definition at line 70 of file RNTupleParallelWriter.hxx.
|
private |
Definition at line 68 of file RNTupleParallelWriter.hxx.
|
private |
The original RNTupleModel connected to fSink; needs to be destructed before it.
Definition at line 67 of file RNTupleParallelWriter.hxx.
|
private |
A global mutex to protect the internal data structures of this object.
Definition at line 61 of file RNTupleParallelWriter.hxx.
|
private |
The final RPageSink that represents the synchronization point.
Definition at line 65 of file RNTupleParallelWriter.hxx.
|
private |
A mutex to synchronize the final page sink.
Definition at line 63 of file RNTupleParallelWriter.hxx.