diff --git a/DataFormats/Portable/BuildFile.xml b/DataFormats/Portable/BuildFile.xml
index 7a845459f17c2..5255e95fcaf10 100644
--- a/DataFormats/Portable/BuildFile.xml
+++ b/DataFormats/Portable/BuildFile.xml
@@ -1,3 +1,2 @@
-
diff --git a/DataFormats/Portable/interface/PortableDeviceCollection.h b/DataFormats/Portable/interface/PortableDeviceCollection.h
index 59279e80ccef5..ce87b82ca69ea 100644
--- a/DataFormats/Portable/interface/PortableDeviceCollection.h
+++ b/DataFormats/Portable/interface/PortableDeviceCollection.h
@@ -23,7 +23,7 @@ class PortableDeviceCollection {
PortableDeviceCollection() = default;
- PortableDeviceCollection(int32_t elements, TDev const &device)
+ PortableDeviceCollection(int32_t elements, TDev const& device)
: buffer_{cms::alpakatools::make_device_buffer(device, Layout::computeDataSize(elements))},
layout_{buffer_->data(), elements},
view_{layout_} {
@@ -32,7 +32,7 @@ class PortableDeviceCollection {
}
template >>
- PortableDeviceCollection(int32_t elements, TQueue const &queue)
+ PortableDeviceCollection(int32_t elements, TQueue const& queue)
: buffer_{cms::alpakatools::make_device_buffer(queue, Layout::computeDataSize(elements))},
layout_{buffer_->data(), elements},
view_{layout_} {
@@ -40,26 +40,29 @@ class PortableDeviceCollection {
assert(reinterpret_cast(buffer_->data()) % Layout::alignment == 0);
}
- ~PortableDeviceCollection() = default;
-
// non-copyable
- PortableDeviceCollection(PortableDeviceCollection const &) = delete;
- PortableDeviceCollection &operator=(PortableDeviceCollection const &) = delete;
+ PortableDeviceCollection(PortableDeviceCollection const&) = delete;
+ PortableDeviceCollection& operator=(PortableDeviceCollection const&) = delete;
// movable
- PortableDeviceCollection(PortableDeviceCollection &&other) = default;
- PortableDeviceCollection &operator=(PortableDeviceCollection &&other) = default;
+ PortableDeviceCollection(PortableDeviceCollection&&) = default;
+ PortableDeviceCollection& operator=(PortableDeviceCollection&&) = default;
+
+ // default destructor
+ ~PortableDeviceCollection() = default;
- View &view() { return view_; }
- ConstView const &view() const { return view_; }
- ConstView const &const_view() const { return view_; }
+ // access the View
+ View& view() { return view_; }
+ ConstView const& view() const { return view_; }
+ ConstView const& const_view() const { return view_; }
- View &operator*() { return view_; }
- ConstView const &operator*() const { return view_; }
+ View& operator*() { return view_; }
+ ConstView const& operator*() const { return view_; }
- View *operator->() { return &view_; }
- ConstView const *operator->() const { return &view_; }
+ View* operator->() { return &view_; }
+ ConstView const* operator->() const { return &view_; }
+ // access the Buffer
Buffer buffer() { return *buffer_; }
ConstBuffer buffer() const { return *buffer_; }
ConstBuffer const_buffer() const { return *buffer_; }
diff --git a/DataFormats/Portable/interface/PortableHostCollection.h b/DataFormats/Portable/interface/PortableHostCollection.h
index 2d7cec9a72f63..b505064965390 100644
--- a/DataFormats/Portable/interface/PortableHostCollection.h
+++ b/DataFormats/Portable/interface/PortableHostCollection.h
@@ -3,7 +3,6 @@
#include
-#include "DataFormats/SoATemplate/interface/SoACommon.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
#include "HeterogeneousCore/AlpakaInterface/interface/host.h"
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
@@ -21,7 +20,7 @@ class PortableHostCollection {
PortableHostCollection() = default;
- PortableHostCollection(int32_t elements, alpaka_common::DevHost const &host)
+ PortableHostCollection(int32_t elements, alpaka_common::DevHost const& host)
// allocate pageable host memory
: buffer_{cms::alpakatools::make_host_buffer(Layout::computeDataSize(elements))},
layout_{buffer_->data(), elements},
@@ -31,7 +30,7 @@ class PortableHostCollection {
}
template >>
- PortableHostCollection(int32_t elements, TQueue const &queue)
+ PortableHostCollection(int32_t elements, TQueue const& queue)
// allocate pinned host memory associated to the given work queue, accessible by the queue's device
: buffer_{cms::alpakatools::make_host_buffer(queue, Layout::computeDataSize(elements))},
layout_{buffer_->data(), elements},
@@ -40,32 +39,35 @@ class PortableHostCollection {
assert(reinterpret_cast(buffer_->data()) % Layout::alignment == 0);
}
- ~PortableHostCollection() = default;
-
// non-copyable
- PortableHostCollection(PortableHostCollection const &) = delete;
- PortableHostCollection &operator=(PortableHostCollection const &) = delete;
+ PortableHostCollection(PortableHostCollection const&) = delete;
+ PortableHostCollection& operator=(PortableHostCollection const&) = delete;
// movable
- PortableHostCollection(PortableHostCollection &&other) = default;
- PortableHostCollection &operator=(PortableHostCollection &&other) = default;
+ PortableHostCollection(PortableHostCollection&&) = default;
+ PortableHostCollection& operator=(PortableHostCollection&&) = default;
+
+ // default destructor
+ ~PortableHostCollection() = default;
- View &view() { return view_; }
- ConstView const &view() const { return view_; }
- ConstView const &const_view() const { return view_; }
+ // access the View
+ View& view() { return view_; }
+ ConstView const& view() const { return view_; }
+ ConstView const& const_view() const { return view_; }
- View &operator*() { return view_; }
- ConstView const &operator*() const { return view_; }
+ View& operator*() { return view_; }
+ ConstView const& operator*() const { return view_; }
- View *operator->() { return &view_; }
- ConstView const *operator->() const { return &view_; }
+ View* operator->() { return &view_; }
+ ConstView const* operator->() const { return &view_; }
+ // access the Buffer
Buffer buffer() { return *buffer_; }
ConstBuffer buffer() const { return *buffer_; }
ConstBuffer const_buffer() const { return *buffer_; }
// part of the ROOT read streamer
- static void ROOTReadStreamer(PortableHostCollection *newObj, Layout const &layout) {
+ static void ROOTReadStreamer(PortableHostCollection* newObj, Layout const& layout) {
newObj->~PortableHostCollection();
// use the global "host" object returned by cms::alpakatools::host()
new (newObj) PortableHostCollection(layout.metadata().size(), cms::alpakatools::host());
diff --git a/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h b/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h
index 3109bb15462f0..efc527287ed2c 100644
--- a/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h
+++ b/DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h
@@ -9,7 +9,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
namespace portabletest {
- // import the top-level portabletest namespace
+ // make the names from the top-level portabletest namespace visible for unqualified lookup
+ // inside the ALPAKA_ACCELERATOR_NAMESPACE::portabletest namespace
using namespace ::portabletest;
// SoA with x, y, z, id fields in device global memory
diff --git a/HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h b/HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h
index 54affae9e2e92..589950ae6c018 100644
--- a/HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h
+++ b/HeterogeneousCore/AlpakaInterface/interface/CachingAllocator.h
@@ -336,8 +336,8 @@ namespace cms::alpakatools {
// allocate device memory
return alpaka::allocBuf(device_, bytes);
} else if constexpr (std::is_same_v) {
- // allocate pinned host memory
- return alpaka::allocMappedBuf(device_, alpaka::getDev(queue), bytes);
+ // allocate pinned host memory accessible by the queue's platform
+ return alpaka::allocMappedBuf>, std::byte, size_t>(device_, bytes);
} else {
// unsupported combination
static_assert(std::is_same_v> or std::is_same_v,
diff --git a/HeterogeneousCore/AlpakaInterface/interface/memory.h b/HeterogeneousCore/AlpakaInterface/interface/memory.h
index e994597561a29..193b5016ff1d0 100644
--- a/HeterogeneousCore/AlpakaInterface/interface/memory.h
+++ b/HeterogeneousCore/AlpakaInterface/interface/memory.h
@@ -77,6 +77,26 @@ namespace cms::alpakatools {
return alpaka::allocBuf, Idx>(host(), Vec1D{std::extent_v});
}
+ // non-cached, pinned, scalar and 1-dimensional host buffers
+ // the memory is pinned according to the device associated to the platform
+
+ template
+ std::enable_if_t, host_buffer> make_host_buffer() {
+ return alpaka::allocMappedBuf(host(), Scalar{});
+ }
+
+ template
+ std::enable_if_t and not std::is_array_v>, host_buffer>
+ make_host_buffer(Extent extent) {
+ return alpaka::allocMappedBuf, Idx>(host(), Vec1D{extent});
+ }
+
+ template
+ std::enable_if_t and not std::is_array_v>, host_buffer>
+ make_host_buffer() {
+ return alpaka::allocMappedBuf, Idx>(host(), Vec1D{std::extent_v});
+ }
+
// potentially cached, pinned, scalar and 1-dimensional host buffers, associated to a work queue
// the memory is pinned according to the device associated to the queue
@@ -85,7 +105,7 @@ namespace cms::alpakatools {
if constexpr (allocator_policy> == AllocatorPolicy::Caching) {
return allocCachedBuf(host(), queue, Scalar{});
} else {
- return alpaka::allocMappedBuf(host(), alpaka::getDev(queue), Scalar{});
+ return alpaka::allocMappedBuf>, T, Idx>(host(), Scalar{});
}
}
@@ -96,7 +116,8 @@ namespace cms::alpakatools {
if constexpr (allocator_policy> == AllocatorPolicy::Caching) {
return allocCachedBuf, Idx>(host(), queue, Vec1D{extent});
} else {
- return alpaka::allocMappedBuf, Idx>(host(), alpaka::getDev(queue), Vec1D{extent});
+ return alpaka::allocMappedBuf>, std::remove_extent_t, Idx>(host(),
+ Vec1D{extent});
}
}
@@ -107,8 +128,8 @@ namespace cms::alpakatools {
if constexpr (allocator_policy> == AllocatorPolicy::Caching) {
return allocCachedBuf, Idx>(host(), queue, Vec1D{std::extent_v});
} else {
- return alpaka::allocMappedBuf, Idx>(
- host(), alpaka::getDev(queue), Vec1D{std::extent_v});
+ return alpaka::allocMappedBuf>, std::remove_extent_t, Idx>(
+ host(), Vec1D{std::extent_v});
}
}
diff --git a/HeterogeneousCore/AlpakaTest/plugins/TestAlpakaAnalyzer.cc b/HeterogeneousCore/AlpakaTest/plugins/TestAlpakaAnalyzer.cc
index ae2f3448ed06d..4ce86fcf75afb 100644
--- a/HeterogeneousCore/AlpakaTest/plugins/TestAlpakaAnalyzer.cc
+++ b/HeterogeneousCore/AlpakaTest/plugins/TestAlpakaAnalyzer.cc
@@ -1,5 +1,4 @@
#include
-#include
#include "DataFormats/PortableTestObjects/interface/TestHostCollection.h"
#include "FWCore/Framework/interface/Event.h"
diff --git a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaProducer.cc b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaProducer.cc
index 877c9afd8a731..112c023675c3a 100644
--- a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaProducer.cc
+++ b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaProducer.cc
@@ -1,8 +1,3 @@
-#include
-#include
-
-#include
-
#include "DataFormats/Portable/interface/Product.h"
#include "DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h"
#include "FWCore/Framework/interface/Event.h"
diff --git a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaTranscriber.cc b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaTranscriber.cc
index a5c2a6fc2c92f..eeca8bc406923 100644
--- a/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaTranscriber.cc
+++ b/HeterogeneousCore/AlpakaTest/plugins/alpaka/TestAlpakaTranscriber.cc
@@ -1,6 +1,3 @@
-#include
-#include
-
#include
#include "DataFormats/Portable/interface/Product.h"