Logo ROOT  
Reference Guide
RNTupleOptions.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleOptions.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2019-08-25
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RNTupleOptions
17#define ROOT7_RNTupleOptions
18
19#include <Compression.h>
20#include <ROOT/RNTupleUtil.hxx>
21
22#include <memory>
23
24namespace ROOT {
25namespace Experimental {
26
27// clang-format off
28/**
29\class ROOT::Experimental::ENTupleContainerFormat
30\ingroup NTuple
31\brief Describes the options for wrapping RNTuple data in files
32*/
33// clang-format on
35 kTFile, // ROOT TFile
36 kBare, // A thin envelope supporting a single RNTuple only
37};
38
39
40// clang-format off
41/**
42\class ROOT::Experimental::RNTupleWriteOptions
43\ingroup NTuple
44\brief Common user-tunable settings for storing ntuples
45
46All page sink classes need to support the common options.
47*/
48// clang-format on
50protected:
53 /// Approximation of the target compressed cluster size
54 std::size_t fApproxZippedClusterSize = 50 * 1000 * 1000;
55 /// Memory limit for committing a cluster: with very high compression ratio, we need a limit
56 /// on how large the I/O buffer can grow during writing.
57 std::size_t fMaxUnzippedClusterSize = 512 * 1024 * 1024;
58 /// Should be just large enough so that the compression ratio does not benefit much more from larger pages.
59 /// Unless the cluster is too small to contain a sufficiently large page, pages are
60 /// fApproxUnzippedPageSize in size and tail pages (the last page in a cluster) is between
61 /// fApproxUnzippedPageSize/2 and fApproxUnzippedPageSize * 1.5 in size.
62 std::size_t fApproxUnzippedPageSize = 64 * 1024;
63 bool fUseBufferedWrite = true;
64
65public:
66 virtual ~RNTupleWriteOptions() = default;
67 virtual std::unique_ptr<RNTupleWriteOptions> Clone() const;
68
69 int GetCompression() const { return fCompression; }
70 void SetCompression(int val) { fCompression = val; }
71 void SetCompression(RCompressionSetting::EAlgorithm::EValues algorithm, int compressionLevel) {
72 fCompression = CompressionSettings(algorithm, compressionLevel);
73 }
74
77
79 void SetApproxZippedClusterSize(std::size_t val);
80
81 std::size_t GetMaxUnzippedClusterSize() const { return fMaxUnzippedClusterSize; }
82 void SetMaxUnzippedClusterSize(std::size_t val);
83
84 std::size_t GetApproxUnzippedPageSize() const { return fApproxUnzippedPageSize; }
85 void SetApproxUnzippedPageSize(std::size_t val);
86
87 bool GetUseBufferedWrite() const { return fUseBufferedWrite; }
88 void SetUseBufferedWrite(bool val) { fUseBufferedWrite = val; }
89};
90
91// clang-format off
92/**
93\class ROOT::Experimental::RNTupleWriteOptionsDaos
94\ingroup NTuple
95\brief DAOS-specific user-tunable settings for storing ntuples
96*/
97// clang-format on
99 std::string fObjectClass{"SX"};
100 /// The maximum cage size is set to the equivalent of 16 uncompressed pages - 1MiB by default. Empirically, such a
101 /// cage size yields acceptable results in throughput and page granularity for most use cases. A `fMaxCageSize` of 0
102 /// disables the caging mechanism.
104
105public:
106 ~RNTupleWriteOptionsDaos() override = default;
107 std::unique_ptr<RNTupleWriteOptions> Clone() const override
108 { return std::make_unique<RNTupleWriteOptionsDaos>(*this); }
109
110 const std::string &GetObjectClass() const { return fObjectClass; }
111 /// Set the object class used to generate OIDs that relate to user data. Any
112 /// `OC_xxx` constant defined in `daos_obj_class.h` may be used here without
113 /// the OC_ prefix.
114 void SetObjectClass(const std::string &val) { fObjectClass = val; }
115
116 uint32_t GetMaxCageSize() const { return fMaxCageSize; }
117 /// Set the upper bound for page concatenation into cages, in bytes. It is assumed
118 /// that cage size will be no smaller than the approximate uncompressed page size.
119 /// To disable page concatenation, set this value to 0.
120 void SetMaxCageSize(uint32_t cageSz) { fMaxCageSize = cageSz; }
121};
122
123// clang-format off
124/**
125\class ROOT::Experimental::RNTupleReadOptions
126\ingroup NTuple
127\brief Common user-tunable settings for reading ntuples
128
129All page source classes need to support the common options.
130*/
131// clang-format on
133public:
138 };
139
140private:
142 unsigned int fClusterBunchSize = 1;
143
144public:
147 unsigned int GetClusterBunchSize() const { return fClusterBunchSize; }
148 void SetClusterBunchSize(unsigned int val) { fClusterBunchSize = val; }
149};
150
151} // namespace Experimental
152} // namespace ROOT
153
154#endif
@ kDefault
Definition: TSystem.h:229
Common user-tunable settings for reading ntuples.
void SetClusterBunchSize(unsigned int val)
DAOS-specific user-tunable settings for storing ntuples.
const std::string & GetObjectClass() const
void SetObjectClass(const std::string &val)
Set the object class used to generate OIDs that relate to user data.
std::unique_ptr< RNTupleWriteOptions > Clone() const override
void SetMaxCageSize(uint32_t cageSz)
Set the upper bound for page concatenation into cages, in bytes.
uint32_t fMaxCageSize
The maximum cage size is set to the equivalent of 16 uncompressed pages - 1MiB by default.
Common user-tunable settings for storing ntuples.
void SetContainerFormat(ENTupleContainerFormat val)
void SetApproxZippedClusterSize(std::size_t val)
virtual std::unique_ptr< RNTupleWriteOptions > Clone() const
std::size_t fApproxZippedClusterSize
Approximation of the target compressed cluster size.
std::size_t fMaxUnzippedClusterSize
Memory limit for committing a cluster: with very high compression ratio, we need a limit on how large...
std::size_t fApproxUnzippedPageSize
Should be just large enough so that the compression ratio does not benefit much more from larger page...
void SetApproxUnzippedPageSize(std::size_t val)
ENTupleContainerFormat GetContainerFormat() const
void SetCompression(RCompressionSetting::EAlgorithm::EValues algorithm, int compressionLevel)
void SetMaxUnzippedClusterSize(std::size_t val)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
int CompressionSettings(RCompressionSetting::EAlgorithm::EValues algorithm, int compressionLevel)
EValues
Note: this is only temporarily a struct and will become a enum class hence the name.
Definition: Compression.h:83
@ kUseAnalysis
Use the default analysis setting; fast reading but poor compression ratio.
Definition: Compression.h:52