Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RChunkConstructor.cxx
Go to the documentation of this file.
2
3#include <numeric>
4
6
7RChunkConstructor::RChunkConstructor(const std::size_t numEntries, const std::size_t chunkSize,
8 const std::size_t blockSize)
9 : fNumEntries(numEntries), fChunkSize(chunkSize), fBlockSize(blockSize)
10{
11 // size of full and leftover chunks
14
15 // size of full and leftover blocks in a full and leftover chunk
20
21 // number of full, leftover and total chunks
22 FullChunks = numEntries / SizeOfFullChunk;
25
26 // number of full, leftover and total blocks in a full chunk
30
31 // number of full, leftover and total blocks in the leftover chunk
35
36 // total number of full and leftover blocks in the full chunks
39
40 // total number of full and leftover blocks in the leftover chunks
43
44 // vector of the different block sizes
47
48 // vector with the number of the different block
51
52 // total number of blocks
53 NumberOfBlocks = std::accumulate(NumberOfDifferentBlocks.begin(), NumberOfDifferentBlocks.end(), 0);
54};
55
56//////////////////////////////////////////////////////////////////////////
57/// \brief Group the blocks based on the block type (full or leftover) based on the size of the block.
59{
60
61 std::vector<std::vector<std::pair<Long_t, Long_t>> *> TypesOfBlockIntervals = {
64
65 std::vector<std::size_t> IndexOfDifferentBlocks(NumberOfDifferentBlocks.size());
68
69 for (size_t i = 0; i < TypesOfBlockIntervals.size(); ++i) {
70 size_t start = IndexOfDifferentBlocks[i];
71 size_t end = IndexOfDifferentBlocks[i + 1];
72
73 TypesOfBlockIntervals[i]->insert(TypesOfBlockIntervals[i]->begin(), BlockIntervals.begin() + start,
74 BlockIntervals.begin() + end);
75 }
76}
77
78//////////////////////////////////////////////////////////////////////////
79/// \brief Creates chunks from the dataset consisting of blocks with the begin and end entry.
81{
82
83 ChunksIntervals.resize(Chunks);
84 for (size_t i = 0; i < FullChunks; i++) {
85
87 size_t end_FullBlock = FullBlocksPerFullChunk * (i + 1);
88
91
94 ChunksIntervals[i].insert(ChunksIntervals[i].end(),
97 }
98
99 for (size_t i = 0; i < LeftoverChunks; i++) {
100
101 size_t j = i + FullChunks;
103 size_t end_FullBlock = FullBlocksPerLeftoverChunk * (i + 1);
104
107
110 ChunksIntervals[j].insert(ChunksIntervals[j].end(),
113 }
114}
115
116//////////////////////////////////////////////////////////////////////////
117/// \brief Fills a vector with the size of every chunk from the dataset
119{
120
121 for (size_t i = 0; i < Chunks; i++) {
122 std::size_t chunkSize = 0;
123 for (size_t j = 0; j < ChunksIntervals[i].size(); j++) {
124 std::size_t start = ChunksIntervals[i][j].first;
125 std::size_t end = ChunksIntervals[i][j].second;
126
127 std::size_t intervalSize = end - start;
129 }
130
131 ChunksSizes.insert(ChunksSizes.end(), chunkSize);
132 }
133}
134} // namespace ROOT::Experimental::Internal::ML
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
const_iterator begin() const
void CreateChunksIntervals()
Creates chunks from the dataset consisting of blocks with the begin and end entry.
std::vector< std::pair< Long_t, Long_t > > FullBlockIntervalsInFullChunks
std::vector< std::pair< Long_t, Long_t > > FullBlockIntervalsInLeftoverChunks
std::vector< std::vector< std::pair< Long_t, Long_t > > > ChunksIntervals
void SizeOfChunks()
Fills a vector with the size of every chunk from the dataset.
std::vector< std::pair< Long_t, Long_t > > LeftoverBlockIntervalsInFullChunks
std::vector< std::pair< Long_t, Long_t > > LeftoverBlockIntervalsInLeftoverChunks
std::vector< std::pair< Long_t, Long_t > > BlockIntervals
void DistributeBlockIntervals()
Group the blocks based on the block type (full or leftover) based on the size of the block.
RChunkConstructor(const std::size_t numEntries, const std::size_t chunkSize, const std::size_t blockSize)