Skip to content
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

Merged
merged 5 commits into from
Nov 24, 2023

Conversation

AdrianoDee
Copy link
Contributor

@AdrianoDee AdrianoDee commented Nov 15, 2023

@AdrianoDee AdrianoDee changed the title Pixel Alpaka Migration: Portable Collection [II] Pixel Alpaka Migration: Portable Product [VIII] Nov 15, 2023
@cmsbuild cmsbuild added this to the CMSSW_14_0_X milestone Nov 15, 2023
@AdrianoDee AdrianoDee changed the title Pixel Alpaka Migration: Portable Product [VIII] Pixel Alpaka Migration: Portable Product [II] Nov 15, 2023
@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37711

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @AdrianoDee (Adriano Di Florio) for master.

It involves the following packages:

  • DataFormats/Portable (heterogeneous)
  • DataFormats/PortableTestObjects (heterogeneous)

@cmsbuild, @fwyzard, @makortel can you please review it and eventually sign? Thanks.
@rovere, @missirol this is something you requested to watch as well.
@antoniovilela, @sextonkennedy, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37712

@cmsbuild
Copy link
Contributor

Pull request #43295 was updated. @fwyzard, @makortel, @mandrenguyen, @jfernan2, @cmsbuild can you please check and sign again.

Copy link
Contributor

@makortel makortel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First look.

<use name="clhep"/>
<use name="DataFormats/Portable"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<flags ALPAKA_BACKENDS="cuda rocm"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<flags ALPAKA_BACKENDS="cuda rocm"/>
<flags ALPAKA_BACKENDS="!serial"/>

is preferred now

Comment on lines 8 to 9
<class name="BeamSpotPOD" ClassVersion="10">
<version ClassVersion="10" checksum="280341519"/>
Copy link
Contributor

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

Suggested change
<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
Copy link
Contributor

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 {
Copy link
Contributor

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)

Copy link
Contributor

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".

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Contributor

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;
Copy link
Contributor

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_; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be

Suggested change
Buffer buffer() { return *buffer_; }
Buffer& buffer() { return *buffer_; }

(although I see the same pattern in PortableDeviceCollection)

Copy link
Contributor

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.

Copy link
Contributor

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 {
Copy link
Contributor

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) {
Copy link
Contributor

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?

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37732

@fwyzard
Copy link
Contributor

fwyzard commented Nov 22, 2023

enable gpu

@fwyzard
Copy link
Contributor

fwyzard commented Nov 22, 2023

please test

@fwyzard
Copy link
Contributor

fwyzard commented Nov 22, 2023

+heterogeneous

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43295/37821

@cmsbuild
Copy link
Contributor

Pull request #43295 was updated. @jfernan2, @mandrenguyen can you please check and sign again.

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a88f5d/35992/summary.html
COMMIT: 1066b18
CMSSW: CMSSW_14_0_X_2023-11-21-2300/el8_amd64_gcc12
Additional Tests: GPU
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/43295/35992/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

GPU Comparison Summary

Summary:

@mandrenguyen
Copy link
Contributor

The tests are complaining about a namespace in the header files:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a88f5d/35992/codeRules/cmsCodeRule1.txt

@makortel
Copy link
Contributor

The tests are complaining about a namespace in the header files: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a88f5d/35992/codeRules/cmsCodeRule1.txt

The using namespace checker is too strict (see #40322). As far as I can tell, the the only using namespace in this PR is in

namespace ALPAKA_ACCELERATOR_NAMESPACE {
namespace portabletest {
// make the names from the top-level portabletest namespace visible for unqualified lookup
// inside the ALPAKA_ACCELERATOR_NAMESPACE::portabletest namespace
using namespace ::portabletest;

which is fine (because nothing is added to the global namespace)

@antoniovilela
Copy link
Contributor

@cms-sw/reconstruction-l2 @makortel
Hi Matthew, Matti,
Would you go ahead with this PR as is?
Thanks.

@mandrenguyen
Copy link
Contributor

+reconstruction
Only changes to comparisons show up in patatrack workflows, but these changes appear negligible.

@cmsbuild
Copy link
Contributor

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)

@antoniovilela
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 4fd19dd into cms-sw:master Nov 24, 2023
@AdrianoDee AdrianoDee deleted the alpaka_port_13_1_portable branch February 8, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants