Skip to content

Commit dc67d26

Browse files
authored
Merge 4ca25d3 into sapling-pr-archive-ktf
2 parents 1a0f6a7 + 4ca25d3 commit dc67d26

File tree

13 files changed

+142
-153
lines changed

13 files changed

+142
-153
lines changed

DataFormats/Headers/include/Headers/Stack.h

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
#include "MemoryResources/MemoryResources.h"
1515
#include "Headers/DataHeader.h"
1616

17-
namespace o2
18-
{
19-
20-
namespace header
17+
namespace o2::header
2118
{
2219
//__________________________________________________________________________________________________
2320
/// @struct Stack
@@ -45,20 +42,20 @@ struct Stack {
4542
};
4643

4744
public:
48-
using allocator_type = boost::container::pmr::polymorphic_allocator<std::byte>;
45+
using allocator_type = fair::mq::pmr::polymorphic_allocator<std::byte>;
4946
using value_type = std::byte;
50-
using BufferType = std::unique_ptr<value_type[], freeobj>; //this gives us proper default move semantics for free
47+
using BufferType = std::unique_ptr<value_type[], freeobj>; // this gives us proper default move semantics for free
5148

5249
Stack() = default;
5350
Stack(Stack&&) = default;
5451
Stack(Stack&) = delete;
5552
Stack& operator=(Stack&) = delete;
56-
Stack& operator=(Stack&&) = default;
53+
Stack& operator=(Stack&&) = delete;
5754

58-
value_type* data() const { return buffer.get(); }
59-
size_t size() const { return bufferSize; }
55+
[[nodiscard]] value_type* data() const { return buffer.get(); }
56+
[[nodiscard]] size_t size() const { return bufferSize; }
6057
allocator_type get_allocator() const { return allocator; }
61-
const BaseHeader* first() const { return reinterpret_cast<const BaseHeader*>(this->data()); }
58+
[[nodiscard]] const BaseHeader* first() const { return reinterpret_cast<const BaseHeader*>(this->data()); }
6259
static const BaseHeader* firstHeader(std::byte const* buf) { return BaseHeader::get(buf); }
6360
static const BaseHeader* lastHeader(std::byte const* buf)
6461
{
@@ -90,9 +87,9 @@ struct Stack {
9087
/// all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor.
9188
template <typename FirstArgType, typename... Headers,
9289
typename std::enable_if_t<
93-
!std::is_convertible<FirstArgType, boost::container::pmr::polymorphic_allocator<std::byte>>::value, int> = 0>
90+
!std::is_convertible<FirstArgType, fair::mq::pmr::polymorphic_allocator<std::byte>>::value, int> = 0>
9491
Stack(FirstArgType&& firstHeader, Headers&&... headers)
95-
: Stack(boost::container::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
92+
: Stack(fair::mq::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
9693
std::forward<Headers>(headers)...)
9794
{
9895
}
@@ -122,7 +119,7 @@ struct Stack {
122119
template <typename T>
123120
constexpr static size_t calculateSize(T&& h) noexcept
124121
{
125-
//if it's a pointer (to a stack) traverse it
122+
// if it's a pointer (to a stack) traverse it
126123
if constexpr (std::is_convertible_v<T, std::byte*>) {
127124
const BaseHeader* next = BaseHeader::get(std::forward<T>(h));
128125
if (!next) {
@@ -133,17 +130,17 @@ struct Stack {
133130
size += next->size();
134131
}
135132
return size;
136-
//otherwise get the size directly
133+
// otherwise get the size directly
137134
} else {
138135
return h.size();
139136
}
140137
}
141138

142-
//recursion terminator
139+
// recursion terminator
143140
constexpr static size_t calculateSize() { return 0; }
144141

145142
private:
146-
allocator_type allocator{boost::container::pmr::new_delete_resource()};
143+
allocator_type allocator{fair::mq::pmr::new_delete_resource()};
147144
size_t bufferSize{0};
148145
BufferType buffer{nullptr, freeobj{allocator.resource()}};
149146

@@ -231,7 +228,6 @@ struct Stack {
231228
}
232229
};
233230

234-
} // namespace header
235-
} // namespace o2
231+
} // namespace o2::header
236232

237233
#endif // HEADERS_STACK_H

DataFormats/Headers/test/testDataHeader.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ BOOST_AUTO_TEST_CASE(headerStack_test)
280280
Stack s2{s1, meta};
281281
BOOST_CHECK(s2.size() == s1.size() + sizeof(decltype(meta)));
282282

283-
//check dynamic construction - where we don't have the type information and need to
284-
//work with BaseHeader pointers
283+
// check dynamic construction - where we don't have the type information and need to
284+
// work with BaseHeader pointers
285285
const test::MetaHeader thead{2};
286286
o2::header::BaseHeader const* bname = reinterpret_cast<BaseHeader const*>(&thead);
287287
Stack ds2(s1, *bname);
@@ -313,8 +313,8 @@ BOOST_AUTO_TEST_CASE(headerStack_test)
313313
BOOST_REQUIRE(h3 != nullptr);
314314
BOOST_CHECK(h3->secret == 42);
315315

316-
//test constructing from a buffer and an additional header
317-
using namespace boost::container::pmr;
316+
// test constructing from a buffer and an additional header
317+
using namespace fair::mq::pmr;
318318
Stack s5(new_delete_resource(), s1.data(), Stack{}, meta);
319319
BOOST_CHECK(s5.size() == s1.size() + sizeof(meta));
320320
// check if we can find the header even though there was an empty stack in the middle

DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class MessageResource : public FairMQMemoryResource
115115
// A spectator pmr memory resource which only watches the memory of the underlying buffer, does not
116116
// carry out real allocation. It owns the underlying buffer which is destroyed on deallocation.
117117
template <typename BufferType>
118-
class SpectatorMemoryResource : public boost::container::pmr::memory_resource
118+
class SpectatorMemoryResource : public fair::mq::pmr::memory_resource
119119
{
120120
public:
121121
using buffer_type = BufferType;
@@ -183,10 +183,10 @@ class SpectatorMemoryResource : public boost::container::pmr::memory_resource
183183
// This in general (as in STL) is a bad idea, but here it is safe to inherit from an allocator since we
184184
// have no additional data and only override some methods so we don't get into slicing and other problems.
185185
template <typename T>
186-
class SpectatorAllocator : public boost::container::pmr::polymorphic_allocator<T>
186+
class SpectatorAllocator : public fair::mq::pmr::polymorphic_allocator<T>
187187
{
188188
public:
189-
using boost::container::pmr::polymorphic_allocator<T>::polymorphic_allocator;
189+
using fair::mq::pmr::polymorphic_allocator<T>::polymorphic_allocator;
190190
using propagate_on_container_move_assignment = std::true_type;
191191

192192
// skip default construction of empty elements
@@ -243,7 +243,7 @@ class OwningMessageSpectatorAllocator
243243
return OwningMessageSpectatorAllocator();
244244
}
245245

246-
boost::container::pmr::memory_resource* resource() { return &mResource; }
246+
fair::mq::pmr::memory_resource* resource() { return &mResource; }
247247

248248
// skip default construction of empty elements
249249
// this is important for two reasons: one: it allows us to adopt an existing buffer (e.g. incoming message) and
@@ -269,14 +269,14 @@ class OwningMessageSpectatorAllocator
269269

270270
// The NoConstructAllocator behaves like the normal pmr vector but does not call constructors / destructors
271271
template <typename T>
272-
class NoConstructAllocator : public boost::container::pmr::polymorphic_allocator<T>
272+
class NoConstructAllocator : public fair::mq::pmr::polymorphic_allocator<T>
273273
{
274274
public:
275-
using boost::container::pmr::polymorphic_allocator<T>::polymorphic_allocator;
275+
using fair::mq::pmr::polymorphic_allocator<T>::polymorphic_allocator;
276276
using propagate_on_container_move_assignment = std::true_type;
277277

278278
template <typename... Args>
279-
NoConstructAllocator(Args&&... args) : boost::container::pmr::polymorphic_allocator<T>(std::forward<Args>(args)...)
279+
NoConstructAllocator(Args&&... args) : fair::mq::pmr::polymorphic_allocator<T>(std::forward<Args>(args)...)
280280
{
281281
}
282282

@@ -302,9 +302,9 @@ class NoConstructAllocator : public boost::container::pmr::polymorphic_allocator
302302
//__________________________________________________________________________________________________
303303

304304
using ByteSpectatorAllocator = SpectatorAllocator<std::byte>;
305-
using BytePmrAllocator = boost::container::pmr::polymorphic_allocator<std::byte>;
305+
using BytePmrAllocator = fair::mq::pmr::polymorphic_allocator<std::byte>;
306306
template <class T>
307-
using vector = std::vector<T, o2::pmr::polymorphic_allocator<T>>;
307+
using vector = std::vector<T, fair::mq::pmr::polymorphic_allocator<T>>;
308308

309309
//__________________________________________________________________________________________________
310310
/// Return a std::vector spanned over the contents of the message, takes ownership of the message

DataFormats/MemoryResources/test/testMemoryResources.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(transportallocatormap_test)
6060
BOOST_CHECK(_tmp == allocZMQ);
6161
}
6262

63-
using namespace boost::container::pmr;
63+
using namespace fair::mq::pmr;
6464

6565
BOOST_AUTO_TEST_CASE(allocator_test)
6666
{

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Configuration.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#ifndef GPUCA_GPUCODE_DEVICE
2020
#include <array>
21-
#include <climits>
21+
#include <limits>
2222
#include <vector>
2323
#include <cmath>
2424
#endif
@@ -108,7 +108,7 @@ struct TrackingParameters {
108108
float TrackFollowerNSigmaCutPhi = 1.f;
109109

110110
bool PrintMemory = false; // print allocator usage in epilog report
111-
size_t MaxMemory = 12000000000UL;
111+
size_t MaxMemory = std::numeric_limits<size_t>::max();
112112
bool DropTFUponFailure = false;
113113
};
114114

@@ -142,7 +142,7 @@ struct VertexingParameters {
142142

143143
int nThreads = 1;
144144
bool PrintMemory = false; // print allocator usage in epilog report
145-
size_t MaxMemory = 12000000000UL;
145+
size_t MaxMemory = std::numeric_limits<size_t>::max();
146146
bool DropTFUponFailure = false;
147147
};
148148

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TimeFrame.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,6 @@ struct TimeFrame {
298298
std::array<bounded_vector<Cluster>, nLayers> mUnsortedClusters;
299299
std::vector<bounded_vector<Tracklet>> mTracklets;
300300
std::vector<bounded_vector<CellSeed>> mCells;
301-
std::vector<bounded_vector<o2::track::TrackParCovF>> mCellSeeds;
302-
std::vector<bounded_vector<float>> mCellSeedsChi2;
303301
bounded_vector<Road<nLayers - 2>> mRoads;
304302
std::vector<bounded_vector<TrackITSExt>> mTracks;
305303
std::vector<bounded_vector<int>> mCellsNeighbours;
@@ -311,7 +309,7 @@ struct TimeFrame {
311309
void wipe();
312310

313311
private:
314-
void prepareClusters(const TrackingParameters& trkParam, const int maxLayers);
312+
void prepareClusters(const TrackingParameters& trkParam, const int maxLayers = nLayers);
315313
float mBz = 5.;
316314
unsigned int mNTotalLowPtVertices = 0;
317315
int mBeamPosWeight = 0;

Detectors/ITSMFT/ITS/tracking/include/ITStracking/TrackingConfigParam.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef ALICEO2_ITSDPLTRACKINGPARAM_H_
1313
#define ALICEO2_ITSDPLTRACKINGPARAM_H_
1414

15+
#include <limits>
1516
#include "CommonUtils/ConfigurableParam.h"
1617
#include "CommonUtils/ConfigurableParamHelper.h"
1718

@@ -49,7 +50,7 @@ struct VertexerParamConfig : public o2::conf::ConfigurableParamHelper<VertexerPa
4950

5051
int nThreads = 1;
5152
bool printMemory = false;
52-
size_t maxMemory = 12000000000UL;
53+
size_t maxMemory = std::numeric_limits<size_t>::max();
5354
bool dropTFUponFailure = false;
5455

5556
O2ParamDef(VertexerParamConfig, "ITSVertexerParam");
@@ -94,7 +95,7 @@ struct TrackerParamConfig : public o2::conf::ConfigurableParamHelper<TrackerPara
9495

9596
int nThreads = 1;
9697
bool printMemory = false;
97-
size_t maxMemory = 12000000000UL;
98+
size_t maxMemory = std::numeric_limits<size_t>::max();
9899
bool dropTFUponFailure = false;
99100
bool fataliseUponFailure = true; // granular management of the fatalisation in async mode
100101

Detectors/ITSMFT/ITS/tracking/src/Configuration.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,18 @@ std::string TrackingParameters::asString() const
5757
for (size_t i = 0; i < SystErrorY2.size(); i++) {
5858
str += std::format("{:.2e}/{:.2e} ", SystErrorY2[i], SystErrorZ2[i]);
5959
}
60-
str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
60+
if (std::numeric_limits<size_t>::max() != MaxMemory) {
61+
str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
62+
}
6163
return str;
6264
}
6365

6466
std::string VertexingParameters::asString() const
6567
{
6668
std::string str = std::format("NZb:{} NPhB:{} DRof:{} ClsCont:{} MaxTrkltCls:{} ZCut:{} PhCut:{}", ZBins, PhiBins, deltaRof, clusterContributorsCut, maxTrackletsPerCluster, zCut, phiCut);
67-
str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
69+
if (std::numeric_limits<size_t>::max() != MaxMemory) {
70+
str += std::format(" MemLimit {:.2f} GB", double(MaxMemory) / constants::GB);
71+
}
6872
return str;
6973
}
7074

0 commit comments

Comments
 (0)