-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pixel Alpaka Migration: Portable Product [II] #43295
Pixel Alpaka Migration: Portable Product [II] #43295
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37711
|
A new Pull Request was created by @AdrianoDee (Adriano Di Florio) for master. It involves the following packages:
@cmsbuild, @fwyzard, @makortel can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37712
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First look.
DataFormats/BeamSpot/BuildFile.xml
Outdated
<use name="clhep"/> | ||
<use name="DataFormats/Portable"/> | ||
<use name="HeterogeneousCore/AlpakaInterface"/> | ||
<flags ALPAKA_BACKENDS="cuda rocm"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<flags ALPAKA_BACKENDS="cuda rocm"/> | |
<flags ALPAKA_BACKENDS="!serial"/> |
is preferred now
<class name="BeamSpotPOD" ClassVersion="10"> | ||
<version ClassVersion="10" checksum="280341519"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New class versions should start with 3
<class name="BeamSpotPOD" ClassVersion="10"> | |
<version ClassVersion="10" checksum="280341519"/> | |
<class name="BeamSpotPOD" ClassVersion="3"> | |
<version ClassVersion="3" checksum="280341519"/> |
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" | ||
|
||
// generic SoA-based product in device memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any relation to SoA. The class stores an object of type T
in an Alpaka buffer.
|
||
// generic SoA-based product in device memory | ||
template <typename T, typename TDev, typename = std::enable_if_t<alpaka::isDevice<TDev>>> | ||
class PortableDeviceProduct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the added value of this class compared to plain Alpaka buffer?
I can think of
- can be default-constructed
- handles the data format
const
-requirements of the framework correctly
Are these correct? Is something missing?
(I'm mostly trying to understand the situation better, e.g. if we could eventually find a way without this level of indirection)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about PortableDeviceObject
as the name? The name "product" is quite specific to how framework handles "data products", whereas this class seems to address a bit different concern. Also edm::DeviceProduct<PortableDeviceProduct<Foo>>
looks repetitive with the name "Product".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can think of
- can be default-constructed
- handles the data format const-requirements of the framework correctly
Are these correct? Is something missing?
I think this were the two main points at the time (@borzari correct me if I'm wrong). And yes, I agree PortableDeviceObject
would work better. The same for the host counterpart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And for the "general one" would go with PortableObject
instead of PortableProduct
.
#include "HeterogeneousCore/AlpakaInterface/interface/host.h" | ||
#include "HeterogeneousCore/AlpakaInterface/interface/memory.h" | ||
|
||
// generic SoA-based product in host memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to not have anything to do with SoA either.
// part of the ROOT read streamer | ||
static void ROOTReadStreamer(PortableHostProduct* newObj, Product& product) { | ||
std::cerr << "ROOT object at " << &product << std::endl; | ||
std::cerr << "id: " << product.id << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printouts need to be removed
Product const* operator->() const { return buffer_->data(); } | ||
|
||
// access the buffer | ||
Buffer buffer() { return *buffer_; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be
Buffer buffer() { return *buffer_; } | |
Buffer& buffer() { return *buffer_; } |
(although I see the same pattern in PortableDeviceCollection
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it really should be a copy.
Otherwise one could modify the internals of the buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
|
||
// generic SoA-based product in host memory | ||
template <typename T> | ||
class PortableHostProduct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about PortableHostObject
?
ConstBuffer const_buffer() const { return *buffer_; } | ||
|
||
// part of the ROOT read streamer | ||
static void ROOTReadStreamer(PortableHostProduct* newObj, Product& product) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly this function is not currently called? Could you add a test where it is used?
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37732
|
enable gpu |
please test |
+heterogeneous |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37821
|
Pull request #43295 was updated. @jfernan2, @mandrenguyen can you please check and sign again. |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a88f5d/35992/summary.html Comparison SummarySummary:
GPU Comparison SummarySummary:
|
The tests are complaining about a namespace in the header files: |
The
which is fine (because nothing is added to the global namespace) |
@cms-sw/reconstruction-l2 @makortel |
+reconstruction |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @antoniovilela, @sextonkennedy, @rappoccio (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
This PR stems from #41117 and it's the 2nd of a series of smaller PRs:
It includes the
PortableProduct
object and a couple of tests.Keeping track of the comments in PixelTracksAlpaka#40.