diff --git a/CCDB/include/CCDB/CCDBDownloader.h b/CCDB/include/CCDB/CCDBDownloader.h index 3ca2e763130df..6c057a537a096 100644 --- a/CCDB/include/CCDB/CCDBDownloader.h +++ b/CCDB/include/CCDB/CCDBDownloader.h @@ -41,7 +41,7 @@ namespace o2::ccdb #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__) struct HeaderObjectPair_t { std::multimap header; - std::pmr::vector* object = nullptr; + o2::pmr::vector* object = nullptr; int counter = 0; }; diff --git a/CCDB/include/CCDB/CcdbApi.h b/CCDB/include/CCDB/CcdbApi.h index 9dc69cd10fc84..e41f58d5c6da9 100644 --- a/CCDB/include/CCDB/CcdbApi.h +++ b/CCDB/include/CCDB/CcdbApi.h @@ -355,7 +355,7 @@ class CcdbApi //: public DatabaseInterface #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__) typedef struct RequestContext { - std::pmr::vector& dest; + o2::pmr::vector& dest; std::string path; std::map const& metadata; long timestamp; @@ -365,7 +365,7 @@ class CcdbApi //: public DatabaseInterface std::string createdNotBefore; bool considerSnapshot; - RequestContext(std::pmr::vector& d, + RequestContext(o2::pmr::vector& d, std::map const& m, std::map& h) : dest(d), metadata(m), headers(h) {} @@ -379,7 +379,7 @@ class CcdbApi //: public DatabaseInterface void getFromSnapshot(bool createSnapshot, std::string const& path, long timestamp, std::map& headers, - std::string& snapshotpath, std::pmr::vector& dest, int& fromSnapshot, std::string const& etag) const; + std::string& snapshotpath, o2::pmr::vector& 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); @@ -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(std::pmr::vector& dest, const std::string& path, std::map* localHeaders = nullptr, bool fetchLocalMetaData = true) const; - void loadFileToMemory(std::pmr::vector& dest, std::string const& path, + void loadFileToMemory(o2::pmr::vector& dest, const std::string& path, std::map* localHeaders = nullptr, bool fetchLocalMetaData = true) const; + void loadFileToMemory(o2::pmr::vector& dest, std::string const& path, std::map const& metadata, long timestamp, std::map* 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(std::pmr::vector& dest, std::string& url) const; + bool loadLocalContentToMemory(o2::pmr::vector& dest, std::string& url) const; // add annotated flattened headers in the end of the blob - static void appendFlatHeader(std::pmr::vector& dest, const std::map& headers); + static void appendFlatHeader(o2::pmr::vector& dest, const std::map& headers); // the failure to load the file to memory is signaled by 0 size and non-0 capacity - static bool isMemoryFileInvalid(const std::pmr::vector& v) { return v.size() == 0 && v.capacity() > 0; } + static bool isMemoryFileInvalid(const o2::pmr::vector& v) { return v.size() == 0 && v.capacity() > 0; } template - static T* extractFromMemoryBlob(std::pmr::vector& blob) + static T* extractFromMemoryBlob(o2::pmr::vector& blob) { auto obj = static_cast(interpretAsTMemFileAndExtract(blob.data(), blob.size(), typeid(T))); if constexpr (std::is_base_of::value) { diff --git a/CCDB/src/CcdbApi.cxx b/CCDB/src/CcdbApi.cxx index 541ef28d17ede..27ad14cdf24fa 100644 --- a/CCDB/src/CcdbApi.cxx +++ b/CCDB/src/CcdbApi.cxx @@ -844,7 +844,7 @@ bool CcdbApi::retrieveBlob(std::string const& path, std::string const& targetdir return false; } - std::pmr::vector buff; + o2::pmr::vector buff; std::map headers; // avoid creating snapshot via loadFileToMemory itself loadFileToMemory(buff, path, metadata, timestamp, &headers, "", createdNotAfter, createdNotBefore, false); @@ -1830,7 +1830,7 @@ void CcdbApi::removeLeakingSemaphores(std::string const& snapshotdir, bool remov void CcdbApi::getFromSnapshot(bool createSnapshot, std::string const& path, long timestamp, std::map& headers, - std::string& snapshotpath, std::pmr::vector& dest, int& fromSnapshot, std::string const& etag) const + std::string& snapshotpath, o2::pmr::vector& dest, int& fromSnapshot, std::string const& etag) const { if (createSnapshot) { // create named semaphore std::string logfile = mSnapshotCachePath + "/log"; @@ -1884,7 +1884,7 @@ void CcdbApi::loadFileToMemory(std::vector& dest, std::string const& path, std::map* headers, std::string const& etag, const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const { - std::pmr::vector destP; + o2::pmr::vector destP; destP.reserve(dest.size()); loadFileToMemory(destP, path, metadata, timestamp, headers, etag, createdNotAfter, createdNotBefore, considerSnapshot); dest.clear(); @@ -1894,7 +1894,7 @@ void CcdbApi::loadFileToMemory(std::vector& dest, std::string const& path, } } -void CcdbApi::loadFileToMemory(std::pmr::vector& dest, std::string const& path, +void CcdbApi::loadFileToMemory(o2::pmr::vector& dest, std::string const& path, std::map const& metadata, long timestamp, std::map* headers, std::string const& etag, const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot) const @@ -1912,7 +1912,7 @@ void CcdbApi::loadFileToMemory(std::pmr::vector& dest, std::string const& vectoredLoadFileToMemory(contexts); } -void CcdbApi::appendFlatHeader(std::pmr::vector& dest, const std::map& headers) +void CcdbApi::appendFlatHeader(o2::pmr::vector& dest, const std::map& headers) { size_t hsize = getFlatHeaderSize(headers), cnt = dest.size(); dest.resize(cnt + hsize); @@ -1977,7 +1977,7 @@ void CcdbApi::vectoredLoadFileToMemory(std::vector& requestConte } } -bool CcdbApi::loadLocalContentToMemory(std::pmr::vector& dest, std::string& url) const +bool CcdbApi::loadLocalContentToMemory(o2::pmr::vector& dest, std::string& url) const { if (url.find("alien:/", 0) != std::string::npos) { std::map localHeaders; @@ -2005,7 +2005,7 @@ bool CcdbApi::loadLocalContentToMemory(std::pmr::vector& dest, std::string return false; } -void CcdbApi::loadFileToMemory(std::pmr::vector& dest, const std::string& path, std::map* localHeaders, bool fetchLocalMetaData) const +void CcdbApi::loadFileToMemory(o2::pmr::vector& dest, const std::string& path, std::map* 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; diff --git a/CCDB/test/testCcdbApi.cxx b/CCDB/test/testCcdbApi.cxx index 84119b099de3b..0ba037710cf62 100644 --- a/CCDB/test/testCcdbApi.cxx +++ b/CCDB/test/testCcdbApi.cxx @@ -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 metadata; std::map headers; - std::pmr::vector dst; + o2::pmr::vector dst; std::string url = "Analysis/ALICE3/Centrality"; api.loadFileToMemory(dst, url, metadata, 1645780010602, &headers, "", "", "", true); BOOST_CHECK(dst.size() != 0); @@ -572,7 +572,7 @@ BOOST_AUTO_TEST_CASE(vectored) api.init("http://ccdb-test.cern.ch:8080"); int TEST_SAMPLE_SIZE = 5; - std::vector> dests(TEST_SAMPLE_SIZE); + std::vector> dests(TEST_SAMPLE_SIZE); std::vector> metadatas(TEST_SAMPLE_SIZE); std::vector> headers(TEST_SAMPLE_SIZE); diff --git a/CCDB/test/testCcdbApiDownloader.cxx b/CCDB/test/testCcdbApiDownloader.cxx index 8e412dcfa7f76..76686f5ee1c00 100644 --- a/CCDB/test/testCcdbApiDownloader.cxx +++ b/CCDB/test/testCcdbApiDownloader.cxx @@ -116,12 +116,12 @@ size_t writeCallbackNoLambda(void* contents, size_t size, size_t nmemb, void* ch return realsize; } -std::vector prepareAsyncHandles(size_t num, std::vector*>& dests) +std::vector prepareAsyncHandles(size_t num, std::vector*>& dests) { std::vector handles; for (int i = 0; i < num; i++) { - auto dest = new std::pmr::vector(); + auto dest = new o2::pmr::vector(); dests.push_back(dest); CURL* curl_handle = curl_easy_init(); handles.push_back(curl_handle); @@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(asynch_schedule_test) } CCDBDownloader downloader; - std::vector*> dests; + std::vector*> dests; auto handles = prepareAsyncHandles(TRANSFERS, dests); size_t transfersLeft = 0; diff --git a/DataFormats/Headers/include/Headers/Stack.h b/DataFormats/Headers/include/Headers/Stack.h index ce1a71dafd3eb..40987c483e1b8 100644 --- a/DataFormats/Headers/include/Headers/Stack.h +++ b/DataFormats/Headers/include/Headers/Stack.h @@ -11,10 +11,9 @@ #ifndef O2_HEADERS_STACK_H #define O2_HEADERS_STACK_H +#include "MemoryResources/MemoryResources.h" #include "Headers/DataHeader.h" -#include - namespace o2::header { //__________________________________________________________________________________________________ @@ -33,18 +32,17 @@ namespace o2::header /// - returns a Stack ready to be shipped. struct Stack { - using memory_resource = std::pmr::memory_resource; + using memory_resource = o2::pmr::memory_resource; private: struct freeobj { - freeobj(memory_resource* mr, size_t s) : resource(mr), size(s) {} + freeobj(memory_resource* mr) : resource(mr) {} memory_resource* resource{nullptr}; - size_t size{0}; - void operator()(std::byte* ptr) { resource->deallocate(ptr, size, alignof(std::max_align_t)); } + void operator()(std::byte* ptr) { resource->deallocate(ptr, 0, 0); } }; public: - using allocator_type = std::pmr::polymorphic_allocator; + using allocator_type = fair::mq::pmr::polymorphic_allocator; using value_type = std::byte; using BufferType = std::unique_ptr; // this gives us proper default move semantics for free @@ -89,9 +87,9 @@ struct Stack { /// all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor. template >::value, int> = 0> + !std::is_convertible>::value, int> = 0> Stack(FirstArgType&& firstHeader, Headers&&... headers) - : Stack(std::pmr::new_delete_resource(), std::forward(firstHeader), + : Stack(fair::mq::pmr::new_delete_resource(), std::forward(firstHeader), std::forward(headers)...) { } @@ -101,7 +99,7 @@ struct Stack { Stack(const allocator_type allocatorArg, Headers&&... headers) : allocator{allocatorArg}, bufferSize{calculateSize(std::forward(headers)...)}, - buffer{static_cast(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource(), bufferSize}} + buffer{static_cast(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource()}} { if constexpr (sizeof...(headers) > 1) { injectAll(buffer.get(), std::forward(headers)...); @@ -142,9 +140,9 @@ struct Stack { constexpr static size_t calculateSize() { return 0; } private: - allocator_type allocator{std::pmr::new_delete_resource()}; + allocator_type allocator{fair::mq::pmr::new_delete_resource()}; size_t bufferSize{0}; - BufferType buffer{nullptr, freeobj{allocator.resource(), 0}}; + BufferType buffer{nullptr, freeobj{allocator.resource()}}; //______________________________________________________________________________________________ template diff --git a/DataFormats/Headers/test/testDataHeader.cxx b/DataFormats/Headers/test/testDataHeader.cxx index 23a230840fafe..2403c1a6230be 100644 --- a/DataFormats/Headers/test/testDataHeader.cxx +++ b/DataFormats/Headers/test/testDataHeader.cxx @@ -314,7 +314,8 @@ BOOST_AUTO_TEST_CASE(headerStack_test) BOOST_CHECK(h3->secret == 42); // test constructing from a buffer and an additional header - Stack s5(std::pmr::new_delete_resource(), s1.data(), Stack{}, meta); + using namespace fair::mq::pmr; + Stack s5(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(s5.data()); @@ -328,7 +329,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{std::pmr::new_delete_resource(), DataHeader{}, s1.data()}; + Stack s6{new_delete_resource(), DataHeader{}, s1.data()}; BOOST_CHECK(s6.size() == sizeof(DataHeader) + s1.size()); } diff --git a/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h b/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h index 66b44162b47ff..b52f5c715575e 100644 --- a/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h +++ b/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h @@ -28,6 +28,9 @@ #ifndef ALICEO2_MEMORY_RESOURCES_ #define ALICEO2_MEMORY_RESOURCES_ +#include +#include +#include #include #include #include @@ -42,8 +45,12 @@ namespace o2::pmr { +using FairMQMemoryResource = fair::mq::MemoryResource; +using ChannelResource = fair::mq::ChannelResource; +using namespace fair::mq::pmr; + template -fair::mq::MessagePtr getMessage(ContainerT&& container, fair::mq::MemoryResource* targetResource = nullptr) +fair::mq::MessagePtr getMessage(ContainerT&& container, FairMQMemoryResource* targetResource = nullptr) { return fair::mq::getMessage(std::forward(container), targetResource); } @@ -53,7 +60,7 @@ fair::mq::MessagePtr getMessage(ContainerT&& container, fair::mq::MemoryResource /// 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 fair::mq::MemoryResource +class MessageResource : public FairMQMemoryResource { public: @@ -75,7 +82,7 @@ class MessageResource : public fair::mq::MemoryResource size_t getNumberOfMessages() const noexcept override { return mMessageData ? 1 : 0; } protected: - fair::mq::MemoryResource* mUpstream{nullptr}; + FairMQMemoryResource* mUpstream{nullptr}; size_t mMessageSize{0}; void* mMessageData{nullptr}; bool initialImport{true}; @@ -106,14 +113,14 @@ class MessageResource : public fair::mq::MemoryResource // The NoConstructAllocator behaves like the normal pmr vector but does not call constructors / destructors template -class NoConstructAllocator : public std::pmr::polymorphic_allocator +class NoConstructAllocator : public fair::mq::pmr::polymorphic_allocator { public: - using std::pmr::polymorphic_allocator::polymorphic_allocator; + using fair::mq::pmr::polymorphic_allocator::polymorphic_allocator; using propagate_on_container_move_assignment = std::true_type; template - NoConstructAllocator(Args&&... args) : std::pmr::polymorphic_allocator(std::forward(args)...) + NoConstructAllocator(Args&&... args) : fair::mq::pmr::polymorphic_allocator(std::forward(args)...) { } @@ -138,13 +145,13 @@ class NoConstructAllocator : public std::pmr::polymorphic_allocator //__________________________________________________________________________________________________ //__________________________________________________________________________________________________ -using BytePmrAllocator = std::pmr::polymorphic_allocator; +using BytePmrAllocator = fair::mq::pmr::polymorphic_allocator; template -using vector = std::vector>; +using vector = std::vector>; //__________________________________________________________________________________________________ /// Get the allocator associated to a transport factory -inline static fair::mq::MemoryResource* getTransportAllocator(fair::mq::TransportFactory* factory) +inline static FairMQMemoryResource* getTransportAllocator(fair::mq::TransportFactory* factory) { return *factory; } diff --git a/DataFormats/MemoryResources/test/testMemoryResources.cxx b/DataFormats/MemoryResources/test/testMemoryResources.cxx index c72ac8f6d422b..a49cd00d75255 100644 --- a/DataFormats/MemoryResources/test/testMemoryResources.cxx +++ b/DataFormats/MemoryResources/test/testMemoryResources.cxx @@ -19,7 +19,6 @@ #include #include #include -#include namespace o2::pmr { @@ -61,6 +60,8 @@ 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}; @@ -75,7 +76,7 @@ BOOST_AUTO_TEST_CASE(allocator_test) testData::nconstructions = 0; { - std::vector> v(std::pmr::polymorphic_allocator{allocZMQ}); + std::vector> v(polymorphic_allocator{allocZMQ}); v.reserve(3); BOOST_CHECK(v.capacity() == 3); BOOST_CHECK(allocZMQ->getNumberOfMessages() == 1); @@ -109,7 +110,7 @@ BOOST_AUTO_TEST_CASE(getMessage_test) // test message creation on the same channel it was allocated with { - std::vector> v(std::pmr::polymorphic_allocator{allocZMQ}); + std::vector> v(polymorphic_allocator{allocZMQ}); v.emplace_back(1); v.emplace_back(2); v.emplace_back(3); @@ -124,7 +125,7 @@ BOOST_AUTO_TEST_CASE(getMessage_test) // test message creation on a different channel than it was allocated with { - std::vector> v(std::pmr::polymorphic_allocator{allocZMQ}); + std::vector> v(polymorphic_allocator{allocZMQ}); v.emplace_back(4); v.emplace_back(5); v.emplace_back(6); @@ -136,6 +137,7 @@ BOOST_AUTO_TEST_CASE(getMessage_test) BOOST_CHECK(message->GetSize() == 3 * sizeof(testData)); messageArray = static_cast(message->GetData()); BOOST_CHECK(messageArray[0] == 4 && messageArray[1] == 5 && messageArray[2] == 6); + } }; // namespace o2::pmr diff --git a/Detectors/CTP/reconstruction/include/CTPReconstruction/CTFCoder.h b/Detectors/CTP/reconstruction/include/CTPReconstruction/CTFCoder.h index 4b3d097417659..9189df5d12685 100644 --- a/Detectors/CTP/reconstruction/include/CTPReconstruction/CTFCoder.h +++ b/Detectors/CTP/reconstruction/include/CTPReconstruction/CTFCoder.h @@ -26,7 +26,6 @@ #include "CTPReconstruction/CTFHelper.h" #include "CTPReconstruction/RawDataDecoder.h" #include "DataFormatsCTP/Configuration.h" -#include class TTree; @@ -226,7 +225,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; - std::pmr::vector digits; + o2::pmr::vector digits; o2::ctp::RawDataDecoder::shiftInputs(digitsMap, digits, mFirstTFOrbit, trgclassmask); for (auto const& dig : digits) { data.emplace_back(dig); diff --git a/Detectors/CTP/reconstruction/include/CTPReconstruction/RawDataDecoder.h b/Detectors/CTP/reconstruction/include/CTPReconstruction/RawDataDecoder.h index 3027c8aea39fc..53addf32c538f 100644 --- a/Detectors/CTP/reconstruction/include/CTPReconstruction/RawDataDecoder.h +++ b/Detectors/CTP/reconstruction/include/CTPReconstruction/RawDataDecoder.h @@ -35,7 +35,7 @@ class RawDataDecoder ~RawDataDecoder() = default; static void makeGBTWordInverse(std::vector& 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& digits); - int decodeRaw(o2::framework::InputRecord& inputs, std::vector& filter, std::pmr::vector& digits, std::vector& lumiPointsHBF1); + int decodeRaw(o2::framework::InputRecord& inputs, std::vector& filter, o2::pmr::vector& digits, std::vector& lumiPointsHBF1); int decodeRawFatal(o2::framework::InputRecord& inputs, std::vector& filter); int decodeRaw(o2::framework::InputRecord& inputs, std::vector& filter, std::vector& digits, std::vector& lumiPointsHBF1); void setDecodeInps(bool decodeinps) { mDecodeInps = decodeinps; } @@ -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& digmap); - static int shiftInputs(std::map& digitsMap, std::pmr::vector& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff); - int checkReadoutConsistentncy(std::pmr::vector& digits, uint64_t trgclassmask = 0xffffffffffffffff, uint64_t trigclassmaskNoTrgDets = 0xffffffffffffffff); + static int shiftInputs(std::map& digitsMap, o2::pmr::vector& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff); + int checkReadoutConsistentncy(o2::pmr::vector& digits, uint64_t trgclassmask = 0xffffffffffffffff, uint64_t trigclassmaskNoTrgDets = 0xffffffffffffffff); std::array getClassErrorsA() { return mClassErrorsA; } std::array getClassErrorsB() { return mClassErrorsB; } std::array getClassCountersA() { return mClassCountersA; } diff --git a/Detectors/CTP/reconstruction/src/RawDataDecoder.cxx b/Detectors/CTP/reconstruction/src/RawDataDecoder.cxx index 025e63a786a48..a062a262acf62 100644 --- a/Detectors/CTP/reconstruction/src/RawDataDecoder.cxx +++ b/Detectors/CTP/reconstruction/src/RawDataDecoder.cxx @@ -128,7 +128,7 @@ int RawDataDecoder::addCTPDigit(uint32_t linkCRU, uint32_t orbit, gbtword80_t& d // Decodes one page // It is NOT assumed that CTP HBF has never more than one page. // 1 HBF/page <= 8000kB = 8*1024*8/120 = 546 GBT words = 546 IRs/page = 5.5 MHz -int RawDataDecoder::decodeRaw(o2::framework::InputRecord& inputs, std::vector& filter, std::pmr::vector& digits, std::vector& lumiPointsHBF1) +int RawDataDecoder::decodeRaw(o2::framework::InputRecord& inputs, std::vector& filter, o2::pmr::vector& digits, std::vector& lumiPointsHBF1) { int ret = 0; static int nwrites = 0; @@ -495,7 +495,7 @@ int RawDataDecoder::decodeRawFatal(o2::framework::InputRecord& inputs, std::vect // int RawDataDecoder::decodeRaw(o2::framework::InputRecord& inputs, std::vector& filter, std::vector& digits, std::vector& lumiPointsHBF1) { - std::pmr::vector pmrdigits; + o2::pmr::vector pmrdigits; int ret = decodeRaw(inputs, filter, pmrdigits, lumiPointsHBF1); for (auto const d : pmrdigits) { digits.push_back(d); @@ -532,7 +532,7 @@ int RawDataDecoder::shiftNew(const o2::InteractionRecord& irin, uint32_t TFOrbit } // -int RawDataDecoder::shiftInputs(std::map& digitsMap, std::pmr::vector& digits, uint32_t TFOrbit, uint64_t trgclassmask) +int RawDataDecoder::shiftInputs(std::map& digitsMap, o2::pmr::vector& digits, uint32_t TFOrbit, uint64_t trgclassmask) { // int nClasswoInp = 0; // counting classes without input which should never happen int lost = 0; @@ -598,7 +598,7 @@ int RawDataDecoder::shiftInputs(std::map& digit return lost; } // -int RawDataDecoder::checkReadoutConsistentncy(std::pmr::vector& digits, uint64_t trgclassmask, uint64_t trgclassmaskNoTrgDet) +int RawDataDecoder::checkReadoutConsistentncy(o2::pmr::vector& digits, uint64_t trgclassmask, uint64_t trgclassmaskNoTrgDet) { LOG(debug) << "Checking readout"; int ret = 0; diff --git a/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h b/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h index 1ba01803f3b19..3198e5c33e219 100644 --- a/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h +++ b/Detectors/CTP/workflow/include/CTPWorkflow/RawDecoderSpec.h @@ -57,7 +57,7 @@ class RawDecoderSpec : public framework::Task private: // for digits bool mDoDigits = true; - std::pmr::vector mOutputDigits; + o2::pmr::vector mOutputDigits; int mMaxInputSize = 0; bool mMaxInputSizeFatal = 0; // for lumi diff --git a/Detectors/EMCAL/workflow/src/emc-channel-data-producer.cxx b/Detectors/EMCAL/workflow/src/emc-channel-data-producer.cxx index a0141256ac29d..75e2cdbd9fce3 100644 --- a/Detectors/EMCAL/workflow/src/emc-channel-data-producer.cxx +++ b/Detectors/EMCAL/workflow/src/emc-channel-data-producer.cxx @@ -128,7 +128,7 @@ DataProcessorSpec generateData(const std::string nameRootFile, const std::string // loop over cells // ToDo: Make more realistic assumption that we dont always have the same amount of cells per event - std::pmr::vector CellOutput; + o2::pmr::vector CellOutput; for (int i = 0; i < nCellsPerEvent; ++i) { double cellID = 0; double cellE = 0; @@ -157,7 +157,7 @@ DataProcessorSpec generateData(const std::string nameRootFile, const std::string } // send output LOG(debug) << "sending " << CellOutput.size() << "cells"; - std::pmr::vector TriggerOutput; + o2::pmr::vector TriggerOutput; TriggerOutput.emplace_back(0, 0, 0, CellOutput.size()); ctx.outputs().adoptContainer(Output{o2::header::gDataOriginEMC, "CELLS", 0}, std::move(CellOutput)); diff --git a/Detectors/MUON/MCH/DevIO/Clusters/clusters-sampler-workflow.cxx b/Detectors/MUON/MCH/DevIO/Clusters/clusters-sampler-workflow.cxx index 95c748f1cc6f1..9d98ada911df2 100644 --- a/Detectors/MUON/MCH/DevIO/Clusters/clusters-sampler-workflow.cxx +++ b/Detectors/MUON/MCH/DevIO/Clusters/clusters-sampler-workflow.cxx @@ -101,7 +101,7 @@ class ClusterSamplerTask // create the output messages auto& rofs = pc.outputs().make>(OutputRef{"rofs"}); auto& clusters = pc.outputs().make>(OutputRef{"clusters"}); - std::vector>* digits(nullptr); + std::vector>* digits(nullptr); if (mDoDigits) { digits = &pc.outputs().make>(OutputRef{"digits"}); } @@ -115,8 +115,8 @@ class ClusterSamplerTask private: //_________________________________________________________________________________________________ - int readOneEvent(std::vector>& clusters, - std::vector>* digits) + int readOneEvent(std::vector>& clusters, + std::vector>* digits) { /// fill the internal buffers with the clusters and digits of the current event diff --git a/Detectors/MUON/MCH/DevIO/Tracks/TrackSamplerSpec.cxx b/Detectors/MUON/MCH/DevIO/Tracks/TrackSamplerSpec.cxx index 27291af10e3b0..4a53659e2732b 100644 --- a/Detectors/MUON/MCH/DevIO/Tracks/TrackSamplerSpec.cxx +++ b/Detectors/MUON/MCH/DevIO/Tracks/TrackSamplerSpec.cxx @@ -102,8 +102,8 @@ class TrackSamplerTask } //_________________________________________________________________________________________________ - int readOneEvent(std::vector>& tracks, - std::vector>& clusters) + int readOneEvent(std::vector>& tracks, + std::vector>& clusters) { /// fill the output messages with the tracks and attached clusters of the current event /// modify the references to the attached clusters according to their position in the global vector diff --git a/Detectors/MUON/MCH/Geometry/Transformer/src/ClusterTransformerSpec.cxx b/Detectors/MUON/MCH/Geometry/Transformer/src/ClusterTransformerSpec.cxx index 1f71af86078a8..f70f9574b6974 100644 --- a/Detectors/MUON/MCH/Geometry/Transformer/src/ClusterTransformerSpec.cxx +++ b/Detectors/MUON/MCH/Geometry/Transformer/src/ClusterTransformerSpec.cxx @@ -42,7 +42,7 @@ namespace o2::mch // convert all clusters from local to global reference frames void local2global(geo::TransformationCreator transformation, gsl::span localClusters, - std::vector>& globalClusters) + std::vector>& globalClusters) { int i{0}; globalClusters.insert(globalClusters.end(), localClusters.begin(), localClusters.end()); diff --git a/Detectors/MUON/MCH/Tracking/src/TrackFinderSpec.cxx b/Detectors/MUON/MCH/Tracking/src/TrackFinderSpec.cxx index c21249527cb23..6239186309dc3 100644 --- a/Detectors/MUON/MCH/Tracking/src/TrackFinderSpec.cxx +++ b/Detectors/MUON/MCH/Tracking/src/TrackFinderSpec.cxx @@ -145,7 +145,7 @@ class TrackFinderTask auto& trackROFs = pc.outputs().make>(OutputRef{"trackrofs"}); auto& mchTracks = pc.outputs().make>(OutputRef{"tracks"}); auto& usedClusters = pc.outputs().make>(OutputRef{"trackclusters"}); - std::vector>* usedDigits(nullptr); + std::vector>* usedDigits(nullptr); if (mDigits) { usedDigits = &pc.outputs().make>(OutputRef{"trackdigits"}); } @@ -219,9 +219,9 @@ class TrackFinderTask //_________________________________________________________________________________________________ void writeTracks(const std::list& tracks, const gsl::span& digitsIn, const ROFRecord& clusterROF, uint32_t firstTForbit, - std::vector>& mchTracks, - std::vector>& usedClusters, - std::vector>* usedDigits) const + std::vector>& mchTracks, + std::vector>& usedClusters, + std::vector>* usedDigits) const { /// fill the output messages with tracks and attached clusters and digits if requested diff --git a/Detectors/MUON/MCH/Workflow/src/ClusterFinderGEMSpec.cxx b/Detectors/MUON/MCH/Workflow/src/ClusterFinderGEMSpec.cxx index 2af245d453702..5158cc436b277 100644 --- a/Detectors/MUON/MCH/Workflow/src/ClusterFinderGEMSpec.cxx +++ b/Detectors/MUON/MCH/Workflow/src/ClusterFinderGEMSpec.cxx @@ -303,8 +303,8 @@ class ClusterFinderGEMTask private: //_________________________________________________________________________________________________ - void writeClusters(std::vector>& clusters, - std::vector>& usedDigits) const + void writeClusters(std::vector>& clusters, + std::vector>& usedDigits) const { /// fill the output messages with clusters and attached digits of the current event /// modify the references to the attached digits according to their position in the global vector diff --git a/Detectors/MUON/MCH/Workflow/src/ClusterFinderOriginalSpec.cxx b/Detectors/MUON/MCH/Workflow/src/ClusterFinderOriginalSpec.cxx index b0890e3e6c7e2..8344d2837b814 100644 --- a/Detectors/MUON/MCH/Workflow/src/ClusterFinderOriginalSpec.cxx +++ b/Detectors/MUON/MCH/Workflow/src/ClusterFinderOriginalSpec.cxx @@ -144,8 +144,8 @@ class ClusterFinderOriginalTask private: //_________________________________________________________________________________________________ void writeClusters(const gsl::span& preclusterDigits, size_t firstClusterIdx, - std::vector>& clusters, - std::vector>& usedDigits) const + std::vector>& clusters, + std::vector>& usedDigits) const { /// fill the output messages with the new clusters and all the digits from the corresponding precluster /// modify the references to the attached digits according to their position in the global vector @@ -167,8 +167,8 @@ class ClusterFinderOriginalTask } //_________________________________________________________________________________________________ - void writeClusters(std::vector>& clusters, - std::vector>& usedDigits) const + void writeClusters(std::vector>& clusters, + std::vector>& usedDigits) const { /// fill the output messages with clusters and attached digits of the current event /// modify the references to the attached digits according to their position in the global vector diff --git a/Detectors/TOF/workflow/src/TOFIntegrateClusterSpec.cxx b/Detectors/TOF/workflow/src/TOFIntegrateClusterSpec.cxx index f3e561a0c531d..2b647f9236611 100644 --- a/Detectors/TOF/workflow/src/TOFIntegrateClusterSpec.cxx +++ b/Detectors/TOF/workflow/src/TOFIntegrateClusterSpec.cxx @@ -60,8 +60,8 @@ class TOFIntegrateClusters : public Task const float sliceWidthMSinv = 1. / float(sliceWidthMS); // storage for integrated currents - std::pmr::vector iTOFCNCl(nSlices); - std::pmr::vector iTOFCqTot(nSlices); + o2::pmr::vector iTOFCNCl(nSlices); + o2::pmr::vector iTOFCqTot(nSlices); const auto clusters = pc.inputs().get>("tofcluster"); if (mTagNoise) { @@ -106,7 +106,7 @@ class TOFIntegrateClusters : public Task std::vector mCounterNeighbours; ///< buffer for noise removal (contains number of neighbouring cluster for time +-mTimeCutNoisePS) std::shared_ptr mCCDBRequest; ///< info for CCDB request - void sendOutput(ProcessingContext& pc, std::pmr::vector iTOFCNCl, std::pmr::vector iTOFCqTot) + void sendOutput(ProcessingContext& pc, o2::pmr::vector iTOFCNCl, o2::pmr::vector iTOFCqTot) { pc.outputs().adoptContainer(Output{header::gDataOriginTOF, "ITOFCN"}, std::move(iTOFCNCl)); pc.outputs().adoptContainer(Output{header::gDataOriginTOF, "ITOFCQ"}, std::move(iTOFCqTot)); diff --git a/Detectors/TPC/calibration/src/IDCFactorization.cxx b/Detectors/TPC/calibration/src/IDCFactorization.cxx index cc60be31acb54..e5474016e7b98 100644 --- a/Detectors/TPC/calibration/src/IDCFactorization.cxx +++ b/Detectors/TPC/calibration/src/IDCFactorization.cxx @@ -1241,4 +1241,4 @@ bool o2::tpc::IDCFactorization::checkReceivedIDCs() return idcsGood; } -template void o2::tpc::IDCFactorization::calcIDCOne(const std::pmr::vector&, const int, const int, const unsigned int, const CRU, std::vector>&, const IDCZero*, const CalDet*, const bool); +template void o2::tpc::IDCFactorization::calcIDCOne(const o2::pmr::vector&, const int, const int, const unsigned int, const CRU, std::vector>&, const IDCZero*, const CalDet*, const bool); diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h index e0c1a87d939ae..6e589cd6c4e8b 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCDistributeIDCSpec.h @@ -247,7 +247,7 @@ class TPCDistributeIDCSpec : public o2::framework::Task std::vector mFilter{}; ///< filter for looping over input data std::vector mDataDescrOut{}; - void sendOutput(o2::framework::ProcessingContext& pc, const unsigned int currentOutLane, const unsigned int cru, std::pmr::vector idcs) + void sendOutput(o2::framework::ProcessingContext& pc, const unsigned int currentOutLane, const unsigned int cru, o2::pmr::vector idcs) { pc.outputs().adoptContainer(Output{gDataOriginTPC, mDataDescrOut[currentOutLane], header::DataHeader::SubSpecificationType{cru}}, std::move(idcs)); } diff --git a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h index 6f6ff249c1935..ec3e158590661 100644 --- a/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h +++ b/Detectors/TPC/workflow/include/TPCWorkflow/TPCFLPIDCSpec.h @@ -93,7 +93,7 @@ class TPCFLPIDCDevice : public o2::framework::Task ++mCountTFsForBuffer; auto const* tpcCRUHeader = o2::framework::DataRefUtils::getHeader(ref); const int cru = tpcCRUHeader->subSpecification >> 7; - auto vecIDCs = pc.inputs().get>(ref); + auto vecIDCs = pc.inputs().get>(ref); mIDCs[cru].insert(mIDCs[cru].end(), vecIDCs.begin(), vecIDCs.end()); if (mEnableSynchProc) { @@ -164,7 +164,7 @@ class TPCFLPIDCDevice : public o2::framework::Task bool mDumpIDCs{}; ///< dump IDCs to tree for debugging int mCountTFsForBuffer{0}; ///< count processed TFs to track when the output will be send std::pair, std::vector> mOneDIDCs{}; ///< 1D-IDCs which will be send to the EPNs - std::unordered_map> mIDCs{}; ///< object for averaging and grouping of the IDCs + std::unordered_map> mIDCs{}; ///< object for averaging and grouping of the IDCs std::unordered_map, std::vector>>> mBuffer1DIDCs{}; ///< buffer for 1D-IDCs. The buffered 1D-IDCs for n TFs will be send to the EPNs for synchronous reco. Zero initialized to avoid empty first TFs! CalDet* mPadFlagsMap{nullptr}; ///< status flag for each pad (i.e. if the pad is dead) IDCZero mIDCZero{}; ///< I_0(r,\phi) = _t: Used for calculating IDC1 (provided from input file or CCDB) @@ -173,7 +173,7 @@ class TPCFLPIDCDevice : public o2::framework::Task /// update the time dependent parameters if they have changed (i.e. update the pad status map) void updateTimeDependentParams(ProcessingContext& pc) { pc.inputs().get*>("tpcpadmap").get(); } - void sendOutputSync(DataAllocator& output, const std::pmr::vector& idc, const uint32_t cru) + void sendOutputSync(DataAllocator& output, const o2::pmr::vector& idc, const uint32_t cru) { const header::DataHeader::SubSpecificationType subSpec{cru << 7}; const CRU cruTmp(cru); diff --git a/Detectors/TPC/workflow/test/test_ft_EPN_Aggregator.cxx b/Detectors/TPC/workflow/test/test_ft_EPN_Aggregator.cxx index f8236756b27cb..e8255f98eff6c 100644 --- a/Detectors/TPC/workflow/test/test_ft_EPN_Aggregator.cxx +++ b/Detectors/TPC/workflow/test/test_ft_EPN_Aggregator.cxx @@ -230,7 +230,7 @@ DataProcessorSpec generateIDCsCRU(int lane, const unsigned int maxTFs, const std o2::tpc::CRU cruTmp(icru); const unsigned int nPads = o2::tpc::Mapper::PADSPERREGION[cruTmp.region()]; const int cru = (icru + tf * Mapper::NREGIONS) % o2::tpc::CRU::MaxCRU; // shuffle CRUs - std::pmr::vector idcs; + o2::pmr::vector idcs; idcs.reserve(generateIDCs ? o2::tpc::Mapper::PADSPERREGION[cruTmp.region()] : mIDCs[cru].size()); const int nIntervals = intervalsRand.size(); for (int interval = 0; interval < nIntervals; ++interval) { diff --git a/Detectors/Vertexing/src/SVertexer.cxx b/Detectors/Vertexing/src/SVertexer.cxx index edaf523cddb41..1d48bcceb0097 100644 --- a/Detectors/Vertexing/src/SVertexer.cxx +++ b/Detectors/Vertexing/src/SVertexer.cxx @@ -216,7 +216,7 @@ void SVertexer::produceOutput(o2::framework::ProcessingContext& pc) auto& strTracksOut = pc.outputs().make>(o2f::Output{"GLO", "STRANGETRACKS", 0}); auto& strClustOut = pc.outputs().make>(o2f::Output{"GLO", "CLUSUPDATES", 0}); - std::pmr::vector mcLabsOut; + o2::pmr::vector mcLabsOut; strTracksOut.resize(mNStrangeTracks); strClustOut.resize(mNStrangeTracks); if (mStrTracker->getMCTruthOn()) { diff --git a/Framework/CCDBSupport/src/CCDBHelpers.cxx b/Framework/CCDBSupport/src/CCDBHelpers.cxx index 2d44469c641f4..1428e22e86651 100644 --- a/Framework/CCDBSupport/src/CCDBHelpers.cxx +++ b/Framework/CCDBSupport/src/CCDBHelpers.cxx @@ -206,7 +206,7 @@ void initialiseHelper(CCDBFetcherHelper& helper, ConfigParamRegistry const& opti } } -auto getOrbitResetTime(std::pmr::vector const& v) -> Long64_t +auto getOrbitResetTime(o2::pmr::vector const& v) -> Long64_t { Int_t previousErrorLevel = gErrorIgnoreLevel; gErrorIgnoreLevel = kFatal; diff --git a/Framework/Core/include/Framework/DataAllocator.h b/Framework/Core/include/Framework/DataAllocator.h index c5aa4bbffa480..287513ec85845 100644 --- a/Framework/Core/include/Framework/DataAllocator.h +++ b/Framework/Core/include/Framework/DataAllocator.h @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -450,7 +449,7 @@ class DataAllocator } // get the memory resource associated with an output - std::pmr::memory_resource* getMemoryResource(const Output& spec) + o2::pmr::FairMQMemoryResource* getMemoryResource(const Output& spec) { auto& timingInfo = mRegistry.get(); auto& proxy = mRegistry.get(); @@ -460,10 +459,10 @@ class DataAllocator // make a stl (pmr) vector template - std::pmr::vector makeVector(const Output& spec, Args&&... args) + o2::pmr::vector makeVector(const Output& spec, Args&&... args) { - std::pmr::memory_resource* targetResource = getMemoryResource(spec); - return std::pmr::vector{targetResource, std::forward(args)...}; + o2::pmr::FairMQMemoryResource* targetResource = getMemoryResource(spec); + return o2::pmr::vector{targetResource, std::forward(args)...}; } struct CacheId { diff --git a/Framework/Core/include/Framework/DataChunk.h b/Framework/Core/include/Framework/DataChunk.h index bbb1c44098f46..664092216a0ee 100644 --- a/Framework/Core/include/Framework/DataChunk.h +++ b/Framework/Core/include/Framework/DataChunk.h @@ -1,4 +1,4 @@ -// Copyright 2019-2025 CERN and copyright holders of ALICE O2. +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // @@ -8,13 +8,14 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -#ifndef O2_FRAMEWORK_DATACHUNK_H_ -#define O2_FRAMEWORK_DATACHUNK_H_ +#ifndef FRAMEWORK_DATACHUNK_H +#define FRAMEWORK_DATACHUNK_H -#include -#include +#include "MemoryResources/MemoryResources.h" -namespace o2::framework +namespace o2 +{ +namespace framework { /// @class DataChunk A resizable buffer used with DPL's DataAllocator /// DataChunk derives from std::vector with polymorphic allocator and forbids copying, the underlying @@ -22,11 +23,18 @@ namespace o2::framework /// message memory. /// Since MessageContext returns the object by reference, the forbidden copy and assignment makes sure that /// the code can not accidentally use a copy instead reference. -class DataChunk : public std::vector> +class DataChunk : public std::vector> { public: + // FIXME: want to have a general forwarding, but then the copy constructor is not deleted any more despite + // it's declared deleted + //template + //DataChunk(T&& arg, Args&&... args) : std::vector>(std::forward(args)...) + //{ + //} + // DataChunk is special and for the moment it's enough to declare the constructor with size and allocator - DataChunk(size_t size, const std::pmr::polymorphic_allocator& allocator) : std::vector>(size, allocator) + DataChunk(size_t size, const o2::pmr::polymorphic_allocator& allocator) : std::vector>(size, allocator) { } DataChunk(const DataChunk&) = delete; @@ -35,6 +43,6 @@ class DataChunk : public std::vector DataChunk& operator=(DataChunk&&) = default; }; -} // namespace o2::framework - -#endif // O2_FRAMEWORK_DATACHUNK_H_ +} // namespace framework +} // namespace o2 +#endif // FRAMEWORK_DATACHUNK_H diff --git a/Framework/Core/include/Framework/MessageContext.h b/Framework/Core/include/Framework/MessageContext.h index 4b0047e3e33ad..407bac0ceb00a 100644 --- a/Framework/Core/include/Framework/MessageContext.h +++ b/Framework/Core/include/Framework/MessageContext.h @@ -28,11 +28,11 @@ #include #include +#include #include #include #include #include -#include #include @@ -182,7 +182,7 @@ class MessageContext // A memory resource which can force a minimum alignment, so that // the whole polymorphic allocator business is happy... - class AlignedMemoryResource : public fair::mq::MemoryResource + class AlignedMemoryResource : public pmr::FairMQMemoryResource { public: AlignedMemoryResource(fair::mq::MemoryResource* other) @@ -230,7 +230,7 @@ class MessageContext return mUpstream->deallocate(p, bytes, alignment < 64 ? 64 : alignment); } - [[nodiscard]] bool do_is_equal(const std::pmr::memory_resource& other) const noexcept override + [[nodiscard]] bool do_is_equal(const pmr::memory_resource& other) const noexcept override { return this == &other; } @@ -240,7 +240,7 @@ class MessageContext }; /// ContainerRefObject handles a message object holding an instance of type T - /// The allocator type is required to be std::pmr::polymorphic_allocator + /// The allocator type is required to be o2::pmr::polymorphic_allocator /// can not adopt an existing message, because the polymorphic_allocator will call type constructor, /// so this works only with new messages /// FIXME: not sure if we want to have this for all container types @@ -251,7 +251,7 @@ class MessageContext using value_type = typename T::value_type; using return_type = T; using buffer_type = return_type; - static_assert(std::is_base_of, typename T::allocator_type>::value, "container must have polymorphic allocator"); + static_assert(std::is_base_of, typename T::allocator_type>::value, "container must have polymorphic allocator"); /// default contructor forbidden, object always has to control message instances ContainerRefObject() = delete; /// constructor taking header message by move and creating the paypload message @@ -263,7 +263,7 @@ class MessageContext // the memory resource takes ownership of the message mResource{mFactory ? AlignedMemoryResource(mFactory->GetMemoryResource()) : AlignedMemoryResource(nullptr)}, // create the vector with apropriate underlying memory resource for the message - mData{std::forward(args)..., std::pmr::polymorphic_allocator(&mResource)} + mData{std::forward(args)..., pmr::polymorphic_allocator(&mResource)} { // FIXME: drop this repeated check and make sure at initial setup of devices that everything is fine // introduce error policy @@ -313,7 +313,7 @@ class MessageContext /// VectorObject handles a message object holding std::vector with polymorphic_allocator /// can not adopt an existing message, because the polymorphic_allocator will call the element constructor, /// so this works only with new messages - template >>> + template >>> class VectorObject : public _BASE { public: diff --git a/Framework/Core/src/LifetimeHelpers.cxx b/Framework/Core/src/LifetimeHelpers.cxx index 439e6f852123a..21aa29c1f10e9 100644 --- a/Framework/Core/src/LifetimeHelpers.cxx +++ b/Framework/Core/src/LifetimeHelpers.cxx @@ -353,7 +353,7 @@ size_t readToMessage(void* p, size_t size, size_t nmemb, void* userdata) if (size == 0) { return 0; } - auto* buffer = (std::pmr::vector*)userdata; + auto* buffer = (o2::pmr::vector*)userdata; size_t oldSize = buffer->size(); buffer->resize(oldSize + nmemb * size); memcpy(buffer->data() + oldSize, p, nmemb * size); diff --git a/Framework/Core/test/test_DataAllocator.cxx b/Framework/Core/test/test_DataAllocator.cxx index 739c999e868b9..fefb6438b98d5 100644 --- a/Framework/Core/test/test_DataAllocator.cxx +++ b/Framework/Core/test/test_DataAllocator.cxx @@ -144,7 +144,7 @@ DataProcessorSpec getSourceSpec() // make a PMR std::vector, make it large to test the auto transport buffer resize funtionality as well Output pmrOutputSpec{"TST", "PMRTESTVECTOR", 0}; - auto pmrvec = std::pmr::vector(pc.outputs().getMemoryResource(pmrOutputSpec)); + auto pmrvec = o2::pmr::vector(pc.outputs().getMemoryResource(pmrOutputSpec)); pmrvec.reserve(100); pmrvec.emplace_back(o2::test::TriviallyCopyable{1, 2, 3}); pc.outputs().adoptContainer(pmrOutputSpec, std::move(pmrvec)); diff --git a/Framework/Core/test/test_DataRefUtils.cxx b/Framework/Core/test/test_DataRefUtils.cxx index a0bc4dec49df6..d4accde0fecf0 100644 --- a/Framework/Core/test/test_DataRefUtils.cxx +++ b/Framework/Core/test/test_DataRefUtils.cxx @@ -15,7 +15,6 @@ #include #include "Framework/RootSerializationSupport.h" #include "Framework/DataRefUtils.h" -#include #include #include diff --git a/Framework/Core/test/test_DataRelayer.cxx b/Framework/Core/test/test_DataRelayer.cxx index 5f6cde4078540..7d5a3ded88e16 100644 --- a/Framework/Core/test/test_DataRelayer.cxx +++ b/Framework/Core/test/test_DataRelayer.cxx @@ -26,7 +26,6 @@ #include "Framework/WorkflowSpec.h" #include #include -#include #include #include #include diff --git a/Framework/Core/test/test_FairMQ.cxx b/Framework/Core/test/test_FairMQ.cxx index e80741c143060..f11d98505298f 100644 --- a/Framework/Core/test/test_FairMQ.cxx +++ b/Framework/Core/test/test_FairMQ.cxx @@ -27,7 +27,7 @@ using namespace o2::pmr; //__________________________________________________________________________________________________ // addDataBlock for generic (compatible) containers, that is contiguous containers using the pmr allocator template ::value, int>::type = 0> -bool addDataBlock(fair::mq::Parts& parts, o2::header::Stack&& inputStack, ContainerT&& inputData, fair::mq::MemoryResource* targetResource = nullptr) +bool addDataBlock(fair::mq::Parts& parts, o2::header::Stack&& inputStack, ContainerT&& inputData, o2::pmr::FairMQMemoryResource* targetResource = nullptr) { auto headerMessage = o2::pmr::getMessage(std::move(inputStack), targetResource); auto dataMessage = o2::pmr::getMessage(std::forward(inputData), targetResource); @@ -42,7 +42,7 @@ bool addDataBlock(fair::mq::Parts& parts, o2::header::Stack&& inputStack, Contai // addDataBlock for data already wrapped in fair::mq::MessagePtr // note: since we cannot partially specialize function templates, use SFINAE here instead template ::value, int>::type = 0> -bool addDataBlock(fair::mq::Parts& parts, o2::header::Stack&& inputStack, ContainerT&& dataMessage, fair::mq::MemoryResource* targetResource = nullptr) +bool addDataBlock(fair::mq::Parts& parts, o2::header::Stack&& inputStack, ContainerT&& dataMessage, o2::pmr::FairMQMemoryResource* targetResource = nullptr) { // make sure the payload size in DataHeader corresponds to message size using o2::header::DataHeader; @@ -174,8 +174,9 @@ TEST_CASE("addDataBlockForEach_test") int i; int j; }; + using namespace fair::mq::pmr; fair::mq::Parts message; - std::vector> vec(std::pmr::polymorphic_allocator{allocZMQ}); + std::vector> vec(polymorphic_allocator{allocZMQ}); vec.reserve(100); vec.push_back({1, 2}); vec.push_back({3, 4}); diff --git a/Framework/Core/test/test_O2DataModelHelpers.cxx b/Framework/Core/test/test_O2DataModelHelpers.cxx index 98a269ed3a907..c32738699c222 100644 --- a/Framework/Core/test/test_O2DataModelHelpers.cxx +++ b/Framework/Core/test/test_O2DataModelHelpers.cxx @@ -13,7 +13,6 @@ #include "Framework/DataProcessingHeader.h" #include "Headers/DataHeader.h" #include "Headers/Stack.h" -#include "MemoryResources/MemoryResources.h" #include #include diff --git a/Framework/Utils/include/DPLUtils/Utils.h b/Framework/Utils/include/DPLUtils/Utils.h index 93758fbfe53db..8786a579fdc53 100644 --- a/Framework/Utils/include/DPLUtils/Utils.h +++ b/Framework/Utils/include/DPLUtils/Utils.h @@ -37,7 +37,7 @@ o2f::DataProcessorSpec defineBroadcaster(std::string devName, o2f::InputSpec usr size_t fixMsgSize); o2f::DataProcessorSpec defineBroadcaster(std::string devName, o2f::InputSpec usrInput, o2f::Outputs usrOutputs); -using OutputBuffer = std::pmr::vector; +using OutputBuffer = o2::pmr::vector; // Merger implementations o2f::DataProcessorSpec defineMerger(std::string devName, o2f::Inputs usrInputs, o2f::OutputSpec usrOutput, std::function const mergerFunc);