Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CCDB/include/CCDB/CCDBDownloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace o2::ccdb
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
struct HeaderObjectPair_t {
std::multimap<std::string, std::string> header;
o2::pmr::vector<char>* object = nullptr;
std::pmr::vector<char>* object = nullptr;
int counter = 0;
};

Expand Down
18 changes: 9 additions & 9 deletions CCDB/include/CCDB/CcdbApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class CcdbApi //: public DatabaseInterface

#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
typedef struct RequestContext {
o2::pmr::vector<char>& dest;
std::pmr::vector<char>& dest;
std::string path;
std::map<std::string, std::string> const& metadata;
long timestamp;
Expand All @@ -365,7 +365,7 @@ class CcdbApi //: public DatabaseInterface
std::string createdNotBefore;
bool considerSnapshot;

RequestContext(o2::pmr::vector<char>& d,
RequestContext(std::pmr::vector<char>& d,
std::map<std::string, std::string> const& m,
std::map<std::string, std::string>& h)
: dest(d), metadata(m), headers(h) {}
Expand All @@ -379,7 +379,7 @@ class CcdbApi //: public DatabaseInterface

void getFromSnapshot(bool createSnapshot, std::string const& path,
long timestamp, std::map<std::string, std::string>& headers,
std::string& snapshotpath, o2::pmr::vector<char>& dest, int& fromSnapshot, std::string const& etag) const;
std::string& snapshotpath, std::pmr::vector<char>& dest, int& fromSnapshot, std::string const& etag) const;
void releaseNamedSemaphore(boost::interprocess::named_semaphore* sem, std::string const& path) const;
boost::interprocess::named_semaphore* createNamedSemaphore(std::string const& path) const;
static std::string determineSemaphoreName(std::string const& basedir, std::string const& objectpath);
Expand All @@ -388,22 +388,22 @@ class CcdbApi //: public DatabaseInterface
static bool removeSemaphore(std::string const& name, bool remove = false);
static void removeLeakingSemaphores(std::string const& basedir, bool remove = false);

void loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr, bool fetchLocalMetaData = true) const;
void loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
void loadFileToMemory(std::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr, bool fetchLocalMetaData = true) const;
void loadFileToMemory(std::pmr::vector<char>& dest, std::string const& path,
std::map<std::string, std::string> const& metadata, long timestamp,
std::map<std::string, std::string>* headers, std::string const& etag,
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot = true) const;

// Loads files from alien and cvmfs into given destination.
bool loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string& url) const;
bool loadLocalContentToMemory(std::pmr::vector<char>& dest, std::string& url) const;

// add annotated flattened headers in the end of the blob
static void appendFlatHeader(o2::pmr::vector<char>& dest, const std::map<std::string, std::string>& headers);
static void appendFlatHeader(std::pmr::vector<char>& dest, const std::map<std::string, std::string>& headers);

// the failure to load the file to memory is signaled by 0 size and non-0 capacity
static bool isMemoryFileInvalid(const o2::pmr::vector<char>& v) { return v.size() == 0 && v.capacity() > 0; }
static bool isMemoryFileInvalid(const std::pmr::vector<char>& v) { return v.size() == 0 && v.capacity() > 0; }
template <typename T>
static T* extractFromMemoryBlob(o2::pmr::vector<char>& blob)
static T* extractFromMemoryBlob(std::pmr::vector<char>& blob)
{
auto obj = static_cast<T*>(interpretAsTMemFileAndExtract(blob.data(), blob.size(), typeid(T)));
if constexpr (std::is_base_of<o2::conf::ConfigurableParam, T>::value) {
Expand Down
14 changes: 7 additions & 7 deletions CCDB/src/CcdbApi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ bool CcdbApi::retrieveBlob(std::string const& path, std::string const& targetdir
return false;
}

o2::pmr::vector<char> buff;
std::pmr::vector<char> buff;
std::map<std::string, std::string> headers;
// avoid creating snapshot via loadFileToMemory itself
loadFileToMemory(buff, path, metadata, timestamp, &headers, "", createdNotAfter, createdNotBefore, false);
Expand Down Expand Up @@ -1838,7 +1838,7 @@ void CcdbApi::removeLeakingSemaphores(std::string const& snapshotdir, bool remov

void CcdbApi::getFromSnapshot(bool createSnapshot, std::string const& path,
long timestamp, std::map<std::string, std::string>& headers,
std::string& snapshotpath, o2::pmr::vector<char>& dest, int& fromSnapshot, std::string const& etag) const
std::string& snapshotpath, std::pmr::vector<char>& dest, int& fromSnapshot, std::string const& etag) const
{
if (createSnapshot) { // create named semaphore
std::string logfile = mSnapshotCachePath + "/log";
Expand Down Expand Up @@ -1892,7 +1892,7 @@ void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
std::map<std::string, std::string>* headers, std::string const& etag,
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
{
o2::pmr::vector<char> destP;
std::pmr::vector<char> destP;
destP.reserve(dest.size());
loadFileToMemory(destP, path, metadata, timestamp, headers, etag, createdNotAfter, createdNotBefore, considerSnapshot);
dest.clear();
Expand All @@ -1902,7 +1902,7 @@ void CcdbApi::loadFileToMemory(std::vector<char>& dest, std::string const& path,
}
}

void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& path,
void CcdbApi::loadFileToMemory(std::pmr::vector<char>& dest, std::string const& path,
std::map<std::string, std::string> const& metadata, long timestamp,
std::map<std::string, std::string>* headers, std::string const& etag,
const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const
Expand All @@ -1920,7 +1920,7 @@ void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, std::string const& p
vectoredLoadFileToMemory(contexts);
}

void CcdbApi::appendFlatHeader(o2::pmr::vector<char>& dest, const std::map<std::string, std::string>& headers)
void CcdbApi::appendFlatHeader(std::pmr::vector<char>& dest, const std::map<std::string, std::string>& headers)
{
size_t hsize = getFlatHeaderSize(headers), cnt = dest.size();
dest.resize(cnt + hsize);
Expand Down Expand Up @@ -1985,7 +1985,7 @@ void CcdbApi::vectoredLoadFileToMemory(std::vector<RequestContext>& requestConte
}
}

bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string& url) const
bool CcdbApi::loadLocalContentToMemory(std::pmr::vector<char>& dest, std::string& url) const
{
if (url.find("alien:/", 0) != std::string::npos) {
std::map<std::string, std::string> localHeaders;
Expand Down Expand Up @@ -2013,7 +2013,7 @@ bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector<char>& dest, std::string&
return false;
}

void CcdbApi::loadFileToMemory(o2::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
void CcdbApi::loadFileToMemory(std::pmr::vector<char>& dest, const std::string& path, std::map<std::string, std::string>* localHeaders, bool fetchLocalMetaData) const
{
// Read file to memory as vector. For special case of the locally cached file retriev metadata stored directly in the file
constexpr size_t MaxCopySize = 0x1L << 25;
Expand Down
4 changes: 2 additions & 2 deletions CCDB/test/testCcdbApi.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ BOOST_AUTO_TEST_CASE(multi_host_test)
api.init("http://bogus-host.cern.ch,http://ccdb-test.cern.ch:8080");
std::map<std::string, std::string> metadata;
std::map<std::string, std::string> headers;
o2::pmr::vector<char> dst;
std::pmr::vector<char> dst;
std::string url = "Analysis/ALICE3/Centrality";
api.loadFileToMemory(dst, url, metadata, 1645780010602, &headers, "", "", "", true);
BOOST_CHECK(dst.size() != 0);
Expand All @@ -572,7 +572,7 @@ BOOST_AUTO_TEST_CASE(vectored)
api.init("http://ccdb-test.cern.ch:8080");

int TEST_SAMPLE_SIZE = 5;
std::vector<o2::pmr::vector<char>> dests(TEST_SAMPLE_SIZE);
std::vector<std::pmr::vector<char>> dests(TEST_SAMPLE_SIZE);
std::vector<std::map<std::string, std::string>> metadatas(TEST_SAMPLE_SIZE);
std::vector<std::map<std::string, std::string>> headers(TEST_SAMPLE_SIZE);

Expand Down
6 changes: 3 additions & 3 deletions CCDB/test/testCcdbApiDownloader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ size_t writeCallbackNoLambda(void* contents, size_t size, size_t nmemb, void* ch
return realsize;
}

std::vector<CURL*> prepareAsyncHandles(size_t num, std::vector<o2::pmr::vector<char>*>& dests)
std::vector<CURL*> prepareAsyncHandles(size_t num, std::vector<std::pmr::vector<char>*>& dests)
{
std::vector<CURL*> handles;

for (int i = 0; i < num; i++) {
auto dest = new o2::pmr::vector<char>();
auto dest = new std::pmr::vector<char>();
dests.push_back(dest);
CURL* curl_handle = curl_easy_init();
handles.push_back(curl_handle);
Expand Down Expand Up @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(asynch_schedule_test)
}

CCDBDownloader downloader;
std::vector<o2::pmr::vector<char>*> dests;
std::vector<std::pmr::vector<char>*> dests;
auto handles = prepareAsyncHandles(TRANSFERS, dests);
size_t transfersLeft = 0;

Expand Down
13 changes: 7 additions & 6 deletions DataFormats/Headers/include/Headers/Stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#ifndef O2_HEADERS_STACK_H
#define O2_HEADERS_STACK_H

#include "MemoryResources/MemoryResources.h"
#include "Headers/DataHeader.h"

#include <memory_resource>

namespace o2::header
{
//__________________________________________________________________________________________________
Expand All @@ -32,7 +33,7 @@ namespace o2::header
/// - returns a Stack ready to be shipped.
struct Stack {

using memory_resource = o2::pmr::memory_resource;
using memory_resource = std::pmr::memory_resource;

private:
struct freeobj {
Expand All @@ -42,7 +43,7 @@ struct Stack {
};

public:
using allocator_type = fair::mq::pmr::polymorphic_allocator<std::byte>;
using allocator_type = std::pmr::polymorphic_allocator<std::byte>;
using value_type = std::byte;
using BufferType = std::unique_ptr<value_type[], freeobj>; // this gives us proper default move semantics for free

Expand Down Expand Up @@ -87,9 +88,9 @@ struct Stack {
/// all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor.
template <typename FirstArgType, typename... Headers,
typename std::enable_if_t<
!std::is_convertible<FirstArgType, fair::mq::pmr::polymorphic_allocator<std::byte>>::value, int> = 0>
!std::is_convertible<FirstArgType, std::pmr::polymorphic_allocator<std::byte>>::value, int> = 0>
Stack(FirstArgType&& firstHeader, Headers&&... headers)
: Stack(fair::mq::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
: Stack(std::pmr::new_delete_resource(), std::forward<FirstArgType>(firstHeader),
std::forward<Headers>(headers)...)
{
}
Expand Down Expand Up @@ -140,7 +141,7 @@ struct Stack {
constexpr static size_t calculateSize() { return 0; }

private:
allocator_type allocator{fair::mq::pmr::new_delete_resource()};
allocator_type allocator{std::pmr::new_delete_resource()};
size_t bufferSize{0};
BufferType buffer{nullptr, freeobj{allocator.resource()}};

Expand Down
5 changes: 2 additions & 3 deletions DataFormats/Headers/test/testDataHeader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ BOOST_AUTO_TEST_CASE(headerStack_test)
BOOST_CHECK(h3->secret == 42);

// test constructing from a buffer and an additional header
using namespace fair::mq::pmr;
Stack s5(new_delete_resource(), s1.data(), Stack{}, meta);
Stack s5(std::pmr::new_delete_resource(), s1.data(), Stack{}, meta);
BOOST_CHECK(s5.size() == s1.size() + sizeof(meta));
// check if we can find the header even though there was an empty stack in the middle
h3 = get<test::MetaHeader*>(s5.data());
Expand All @@ -329,7 +328,7 @@ BOOST_AUTO_TEST_CASE(headerStack_test)
BOOST_CHECK(h4 == h3);

// let's assume we have some stack that is missing the required DataHeader at the beginning:
Stack s6{new_delete_resource(), DataHeader{}, s1.data()};
Stack s6{std::pmr::new_delete_resource(), DataHeader{}, s1.data()};
BOOST_CHECK(s6.size() == sizeof(DataHeader) + s1.size());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#ifndef ALICEO2_MEMORY_RESOURCES_
#define ALICEO2_MEMORY_RESOURCES_

#include <boost/container/pmr/memory_resource.hpp>
#include <boost/container/pmr/monotonic_buffer_resource.hpp>
#include <boost/container/pmr/polymorphic_allocator.hpp>
#include <cstring>
#include <string>
#include <type_traits>
Expand All @@ -45,12 +42,8 @@
namespace o2::pmr
{

using FairMQMemoryResource = fair::mq::MemoryResource;
using ChannelResource = fair::mq::ChannelResource;
using namespace fair::mq::pmr;

template <typename ContainerT>
fair::mq::MessagePtr getMessage(ContainerT&& container, FairMQMemoryResource* targetResource = nullptr)
fair::mq::MessagePtr getMessage(ContainerT&& container, fair::mq::MemoryResource* targetResource = nullptr)
{
return fair::mq::getMessage(std::forward<ContainerT>(container), targetResource);
}
Expand All @@ -60,7 +53,7 @@ fair::mq::MessagePtr getMessage(ContainerT&& container, FairMQMemoryResource* ta
/// Ownership of hte message is taken. Meant to be used for transparent data adoption in containers.
/// In combination with the SpectatorAllocator this is an alternative to using span, as raw memory
/// (e.g. an existing buffer message) will be accessible with appropriate container.
class MessageResource : public FairMQMemoryResource
class MessageResource : public fair::mq::MemoryResource
{

public:
Expand All @@ -82,7 +75,7 @@ class MessageResource : public FairMQMemoryResource
size_t getNumberOfMessages() const noexcept override { return mMessageData ? 1 : 0; }

protected:
FairMQMemoryResource* mUpstream{nullptr};
fair::mq::MemoryResource* mUpstream{nullptr};
size_t mMessageSize{0};
void* mMessageData{nullptr};
bool initialImport{true};
Expand Down Expand Up @@ -113,14 +106,14 @@ class MessageResource : public FairMQMemoryResource

// The NoConstructAllocator behaves like the normal pmr vector but does not call constructors / destructors
template <typename T>
class NoConstructAllocator : public fair::mq::pmr::polymorphic_allocator<T>
class NoConstructAllocator : public std::pmr::polymorphic_allocator<T>
{
public:
using fair::mq::pmr::polymorphic_allocator<T>::polymorphic_allocator;
using std::pmr::polymorphic_allocator<T>::polymorphic_allocator;
using propagate_on_container_move_assignment = std::true_type;

template <typename... Args>
NoConstructAllocator(Args&&... args) : fair::mq::pmr::polymorphic_allocator<T>(std::forward<Args>(args)...)
NoConstructAllocator(Args&&... args) : std::pmr::polymorphic_allocator<T>(std::forward<Args>(args)...)
{
}

Expand All @@ -145,13 +138,13 @@ class NoConstructAllocator : public fair::mq::pmr::polymorphic_allocator<T>
//__________________________________________________________________________________________________
//__________________________________________________________________________________________________

using BytePmrAllocator = fair::mq::pmr::polymorphic_allocator<std::byte>;
using BytePmrAllocator = std::pmr::polymorphic_allocator<std::byte>;
template <class T>
using vector = std::vector<T, fair::mq::pmr::polymorphic_allocator<T>>;
using vector = std::vector<T, std::pmr::polymorphic_allocator<T>>;

//__________________________________________________________________________________________________
/// Get the allocator associated to a transport factory
inline static FairMQMemoryResource* getTransportAllocator(fair::mq::TransportFactory* factory)
inline static fair::mq::MemoryResource* getTransportAllocator(fair::mq::TransportFactory* factory)
{
return *factory;
}
Expand Down
4 changes: 1 addition & 3 deletions DataFormats/MemoryResources/test/testMemoryResources.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ BOOST_AUTO_TEST_CASE(transportallocatormap_test)
BOOST_CHECK(_tmp == allocZMQ);
}

using namespace fair::mq::pmr;

BOOST_AUTO_TEST_CASE(allocator_test)
{
size_t session{(size_t)getpid() * 1000 + 1};
Expand All @@ -76,7 +74,7 @@ BOOST_AUTO_TEST_CASE(allocator_test)
testData::nconstructions = 0;

{
std::vector<testData, polymorphic_allocator<testData>> v(polymorphic_allocator<testData>{allocZMQ});
std::vector<testData, std::pmr::polymorphic_allocator<testData>> v(std::pmr::polymorphic_allocator<testData>{allocZMQ});
v.reserve(3);
BOOST_CHECK(v.capacity() == 3);
BOOST_CHECK(allocZMQ->getNumberOfMessages() == 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "CTPReconstruction/CTFHelper.h"
#include "CTPReconstruction/RawDataDecoder.h"
#include "DataFormatsCTP/Configuration.h"
#include <vector>

class TTree;

Expand Down Expand Up @@ -225,7 +226,7 @@ o2::ctf::CTFIOSize CTFCoder::decode(const CTF::base& ec, VTRG& data, LumiInfo& l
trgclassmask = mCTPConfig.getTriggerClassMask();
}
// std::cout << "trgclassmask:" << std::hex << trgclassmask << std::dec << std::endl;
o2::pmr::vector<CTPDigit> digits;
std::pmr::vector<CTPDigit> digits;
o2::ctp::RawDataDecoder::shiftInputs(digitsMap, digits, mFirstTFOrbit, trgclassmask);
for (auto const& dig : digits) {
data.emplace_back(dig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class RawDataDecoder
~RawDataDecoder() = default;
static void makeGBTWordInverse(std::vector<gbtword80_t>& diglets, gbtword80_t& GBTWord, gbtword80_t& remnant, uint32_t& size_gbt, uint32_t Npld);
int addCTPDigit(uint32_t linkCRU, uint32_t triggerOrbit, gbtword80_t& diglet, gbtword80_t& pldmask, std::map<o2::InteractionRecord, CTPDigit>& digits);
int decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter, o2::pmr::vector<CTPDigit>& digits, std::vector<LumiInfo>& lumiPointsHBF1);
int decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter, std::pmr::vector<CTPDigit>& digits, std::vector<LumiInfo>& lumiPointsHBF1);
int decodeRawFatal(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter);
int decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter, std::vector<CTPDigit>& digits, std::vector<LumiInfo>& lumiPointsHBF1);
void setDecodeInps(bool decodeinps) { mDecodeInps = decodeinps; }
Expand All @@ -54,8 +54,8 @@ class RawDataDecoder
CTPConfiguration& getCTPConfig() { return mCTPConfig; }
int init();
static int shiftNew(const o2::InteractionRecord& irin, uint32_t TFOrbit, std::bitset<48>& inpmask, int64_t shift, int level, std::map<o2::InteractionRecord, CTPDigit>& digmap);
static int shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digitsMap, o2::pmr::vector<CTPDigit>& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff);
int checkReadoutConsistentncy(o2::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask = 0xffffffffffffffff, uint64_t trigclassmaskNoTrgDets = 0xffffffffffffffff);
static int shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digitsMap, std::pmr::vector<CTPDigit>& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff);
int checkReadoutConsistentncy(std::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask = 0xffffffffffffffff, uint64_t trigclassmaskNoTrgDets = 0xffffffffffffffff);
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassErrorsA() { return mClassErrorsA; }
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassErrorsB() { return mClassErrorsB; }
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassCountersA() { return mClassCountersA; }
Expand Down
Loading