Skip to content

Clarify ALPAKA_ACCELERATOR_NAMESPACE and CopyToDevice in AlpakaCore README#49709

Merged
cmsbuild merged 2 commits intocms-sw:masterfrom
makortel:alpakaDoc
Jan 22, 2026
Merged

Clarify ALPAKA_ACCELERATOR_NAMESPACE and CopyToDevice in AlpakaCore README#49709
cmsbuild merged 2 commits intocms-sw:masterfrom
makortel:alpakaDoc

Conversation

@makortel
Copy link
Copy Markdown
Contributor

PR description:

This PR extends the HeterogeneousCore/AlpakaCore/README.md by two clarifications

  • Examples of typical situations when ALPAKA_ACCELERATOR_NAMESPACE should be used
  • For implicit EDProducer host-to-device data product copies a note that the header that defines the CopyToDevice specialization must be #included

These cases came up in private discussions and I noticed we hadn't documented them.

Resolves cms-sw/framework-team#1755

PR validation:

None

@cmsbuild
Copy link
Copy Markdown
Contributor

cmsbuild commented Dec 29, 2025

cms-bot internal usage

@cmsbuild
Copy link
Copy Markdown
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49709/47281

@cmsbuild
Copy link
Copy Markdown
Contributor

A new Pull Request was created by @makortel for master.

It involves the following packages:

  • HeterogeneousCore/AlpakaCore (heterogeneous)

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

cms-bot commands are listed here

@makortel
Copy link
Copy Markdown
Contributor Author

@cmsbuild, please test

Even if there is nothing to test

In EDProducers for each device-side data product a transfer from the device memory space to the host memory space is registered automatically. The data product is copied only if the job has another EDModule that consumes the host-side data product. For each device-side data product a specialization of `cms::alpakatools::CopyToHost` is required to exist.

In addition, for each host-side data product a transfer from the host memory space to the device meory space is registered autmatically **if** a `cms::alpakatools::CopyToDevice` specialization exists. The data product is copied only if the job has another EDModule that consumes the device-side data product.
In addition, for each host-side data product a transfer from the host memory space to the device meory space is registered automatically **if** a `cms::alpakatools::CopyToDevice` specialization exists. The data product is copied only if the job has another EDModule that consumes the device-side data product. **Note:** The header where the `cms::alpakatools::CopyToDevice` specialization is defined must be `#include`d in the EDProducer source file for the transfer to be registered, even if it is _seemingly_ unused. For example, for `PortableCollection` that means `DataFormats/Portable/interface/PortableCollection.h`.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Figuring out if the necessary #include is missing can be time consuming. I'm wondering if we should think about making the intent of whether a data product should be implicitly copied to the device or not more explicit (e.g. via additional template argument to produces()).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe it would be simpler to make sure the data format itself includes the cms::alpakatools::CopyToDevice specialization ?

Can we clean up the various PortableCollection-related headers to simplify things ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe it would be simpler to make sure the data format itself includes the cms::alpakatools::CopyToDevice specialization ?

That would make the host data type header dependent on the device data type header (e.g. PortableHostCollection.h would depend on PortableDeviceCollection.h). But dependency-wise PortableDeviceCollection does not really add anything that PortableHostCollection wouldn't already depend on. And PortableDeviceCollection is templated on the device type (as effectively are the CopyTo{Host,Device}, so having those templates available during host-only compilation should have any ill effects (beyond tiny increase in compilation time) as long as they are not instantiated.

So maybe combining PortableHostCollection.h, PortableDeviceCollection.h, and the two PortableCollection.h's could work.

@cmsbuild
Copy link
Copy Markdown
Contributor

-1

Failed Tests: RelVals-INPUT
Size: This PR adds an extra 28KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-561288/50408/summary.html
COMMIT: 3de62ca
CMSSW: CMSSW_16_1_X_2025-12-29-1100/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/49709/50408/install.sh to create a dev area with all the needed externals and cmssw changes.

Failed RelVals-INPUT

  • 2025.00200012025.0020001_RunEGamma02025D_10k/step2_RunEGamma02025D_10k.log

Comparison Summary

Summary:

  • No significant changes to the logs found
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 0 differences found in the comparisons
  • Reco comparison had 4 failed jobs
  • DQMHistoTests: Total files compared: 53
  • DQMHistoTests: Total histograms compared: 4280553
  • DQMHistoTests: Total failures: 55
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 4280478
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 52 files compared)
  • Checked 227 log files, 198 edm output root files, 53 DQM output files
  • TriggerResults: no differences found

@makortel
Copy link
Copy Markdown
Contributor Author

Comparison differences are related to #47071

@makortel
Copy link
Copy Markdown
Contributor Author

ignore tests-rejected with external-failure

  • 2025.00200012025.0020001_RunEGamma02025D_10k/step2_RunEGamma02025D_10k.log

The workflow fails with an unreachable file also in the IBs.

@makortel
Copy link
Copy Markdown
Contributor Author

@fwyzard Do you have any comments?

@fwyzard
Copy link
Copy Markdown
Contributor

fwyzard commented Jan 21, 2026

I'm ok with the clarifications, and if something else comes up we can update the README.md further.

@fwyzard
Copy link
Copy Markdown
Contributor

fwyzard commented Jan 21, 2026

+heterogeneous

@cmsbuild
Copy link
Copy Markdown
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (test failures were overridden). This pull request will now be reviewed by the release team before it's merged. @ftenchini, @mandrenguyen, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2)

@mandrenguyen
Copy link
Copy Markdown
Contributor

+1

@cmsbuild cmsbuild merged commit 7507310 into cms-sw:master Jan 22, 2026
9 of 10 checks passed
@makortel makortel deleted the alpakaDoc branch January 23, 2026 19:53
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.

Clarify ALPAKA_ACCELERATOR_NAMESPACE and CopyToDevice in AlpakaCore README

4 participants