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

Implement AlpakaBackendProducer and AlpakaBackendFilter [14.0.x] #44388

Merged

Conversation

fwyzard
Copy link
Contributor

@fwyzard fwyzard commented Mar 13, 2024

PR description:

Implement AlpakaBackendProducer, an empty alpaka-based EDProducer whose only purpose is to save in the event what alpaka backend has been used.

Implement AlpakaBackendFilter, an EDFilter that selects events based on the alpaka backend used to run a previous producer.

Implement a unit test for both modules.

The aim is to replace this SwitchProducer in the HLT menu

process.statusOnGPU = SwitchProducerCUDA(
   cpu = cms.EDProducer( "BooleanProducer",
       value = cms.bool( False )
   ),
  cuda = cms.EDProducer( "BooleanProducer",
       value = cms.bool( True )
   ),
 )

process.statusOnGPUFilter = cms.EDFilter( "BooleanFilter",
    src = cms.InputTag( "statusOnGPU" )
)

process.Status_OnCPU = cms.Path( process.statusOnGPU + ~process.statusOnGPUFilter )
process.Status_OnGPU = cms.Path( process.statusOnGPU + process.statusOnGPUFilter )

with this alpaka-based solution

process.hltBackend = cms.EDProducer('AlpakaBackendProducer@alpaka')

process.hltStatusOnGPUFilter = cms.EDFilter('AlpakaBackendFilter',
  producer = cms.InputTag('hltBackend', 'backend'),
  backends = cms.vstring('CudaAsync', 'ROCmAsync')
)

process.Status_OnCPU = cms.Path( process.hltBackend + ~process.hltStatusOnGPUFilter )
process.Status_OnGPU = cms.Path( process.hltBackend + process.hltStatusOnGPUFilter )

PR validation:

The new unit test passes.

Backport status

Backport of #44387 to 14.0.x for data taking.

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 13, 2024

backport #44387

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 13, 2024

enable gpu

@cmsbuild cmsbuild added this to the CMSSW_14_0_X milestone Mar 13, 2024
@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 13, 2024

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 13, 2024

A new Pull Request was created by @fwyzard for CMSSW_14_0_X.

It involves the following packages:

  • HeterogeneousCore/AlpakaCore (heterogeneous)

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

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

cmsbuild commented Mar 13, 2024

cms-bot internal usage

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 13, 2024

@mmusich @Martin-Grunewald @missirol FYI

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a818d9/38096/summary.html
COMMIT: 8d6395c
CMSSW: CMSSW_14_0_X_2024-03-12-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/44388/38096/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

GPU Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 24 differences found in the comparisons
  • DQMHistoTests: Total files compared: 3
  • DQMHistoTests: Total histograms compared: 39740
  • DQMHistoTests: Total failures: 584
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 39156
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 2 files compared)
  • Checked 8 log files, 10 edm output root files, 3 DQM output files
  • TriggerResults: no differences found

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.

The test doesn't seem to really test the behavior of AlpakaBackendFilter.

process.source = cms.Source('EmptySource')

process.load('Configuration.StandardSequences.Accelerators_cff')
process.load('HeterogeneousCore.AlpakaCore.ProcessAcceleratorAlpaka_cfi')
Copy link
Contributor

Choose a reason for hiding this comment

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

Strictly speaking this load() is redundant because ProcessAcceleratorAlpaka_cfi is already imported in Accelerators_cff.

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 13, 2024

The test doesn't seem to really test the behavior of AlpakaBackendFilter.

What do you mean ?

Comment on lines 38 to 39
process.SelectedBackend = cms.Path(process.alpakaBackendProducer + process.alpakaBackendFilter)
process.AnyOtherBackend = cms.Path(process.alpakaBackendProducer + ~process.alpakaBackendFilter)
Copy link
Contributor

Choose a reason for hiding this comment

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

The test doesn't seem to really test the behavior of AlpakaBackendFilter.

What do you mean ?

I mean the filtering decision being the expected one is not being tested. E.g. something along

Suggested change
process.SelectedBackend = cms.Path(process.alpakaBackendProducer + process.alpakaBackendFilter)
process.AnyOtherBackend = cms.Path(process.alpakaBackendProducer + ~process.alpakaBackendFilter)
process.mustRun = cms.EDProducer("edmtest::MustRunIntProducer", ivalue=cms.int32(1))
process.mustNotRun = cms.EDProducer("FailingProducer")
process.SelectedBackend = cms.Path(process.alpakaBackendProducer + process.alpakaBackendFilter + process.mustRun)
process.AnyOtherBackend = cms.Path(process.alpakaBackendProducer + ~process.alpakaBackendFilter + process.mustNotRun)

would lead to the job to fail if the filtering decision (i.e. the joint logic in AlpakaBackendFilter constructor and filter() function) would be unexpected for any reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see.
I guess it's enough to have the FailingProducer ?
Is that a real module one can use, or just an example ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's enough to have the FailingProducer ?

Right, in this case where the "other behavior" is achieved with ~ (whose behavior we should be testing in the framework) the first case should indeed be sufficient.

If the other Path would use another instance of AlpakaBackendFilter with different backend configuration, then testing it explicitly could be useful.

Is that a real module one can use, or just an example ?

It is available (from test modules defined in FWCore/Framework/test).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, thanks, I'll make the changes.

Implement AlpakaBackendProducer, an empty alpaka-based EDProducer whose
only purpose is to save in the event what alpaka backend has been used.

Implement AlpakaBackendFilter, an EDFilter that selects events based on
the alpaka backend used to run a previous producer.

Implement a unit test for both modules.
@fwyzard fwyzard force-pushed the implement_AlpakaBackendFilter_14_0_x branch from 8d6395c to 6c9a284 Compare March 15, 2024 16:14
@cmsbuild
Copy link
Contributor

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

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 15, 2024

please test

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 15, 2024

+1

This name is unique, the previous name clashed with AlpakaTest/plugins/BuildFile.xml

Co-authored-by: Matti Kortelainen <[email protected]>
@cmsbuild
Copy link
Contributor

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

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 18, 2024

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a818d9/38208/summary.html
COMMIT: c58cda6
CMSSW: CMSSW_14_0_X_2024-03-17-2300/el8_amd64_gcc12
Additional Tests: GPU
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/44388/38208/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

GPU Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 3
  • DQMHistoTests: Total histograms compared: 39740
  • DQMHistoTests: Total failures: 23
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 39717
  • DQMHistoTests: Total skipped: 0
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 2 files compared)
  • Checked 8 log files, 10 edm output root files, 3 DQM output files
  • TriggerResults: no differences found

@cmsbuild
Copy link
Contributor

REMINDER @sextonkennedy, @antoniovilela, @rappoccio: This PR was tested with #44440, please check if they should be merged together

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 20, 2024

+heterogeneous

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_14_0_X IBs (tests are also fine) and once validation in the development release cycle CMSSW_14_1_X is complete. This pull request will now be reviewed by the release team before it's merged. @rappoccio, @antoniovilela, @sextonkennedy (and backports should be raised in the release meeting by the corresponding L2)

@fwyzard
Copy link
Contributor Author

fwyzard commented Mar 20, 2024

@cms-sw/orp-l2 I think this is ready to be merged.

@antoniovilela
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 4244a0c into cms-sw:CMSSW_14_0_X Mar 20, 2024
13 checks passed
@fwyzard fwyzard deleted the implement_AlpakaBackendFilter_14_0_x branch April 7, 2024 10:02
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.

5 participants