cmssw icon indicating copy to clipboard operation
cmssw copied to clipboard

Introduce vFloat and float types in ParameterSets

Open felicepantaleo opened this issue 1 year ago • 13 comments

Description

This pull request introduces vFloat and float types in the ParameterSets of the CMSSW framework. The changes aim to improve the precision and performance of floating-point parameter handling in configuration sets.

Changes

  1. Added vFloat and float type definitions.
  2. Updated relevant configuration files to utilize the new types.
  3. Ensured compatibility with existing functionality and modules.

This will allow the developers of C++ modules to directly use std::vector<float> configuration parameters avoiding manually converting each of them from std::vector<double>, if double precision is not needed.

Testing

  • Ran all existing unit tests.
  • Added new tests to cover the vFloat and float types.
  • Tested with workflow 24900.0.
  • Verified no regressions in performance or functionality.

Future Work

If the tests run smoothly, an existing reconstruction module will be migrated from double to float within this pull request.

@smuzaffar @makortel @Dr15Jones @fwyzard @rovere @VinInn FYI

felicepantaleo avatar Jun 13 '24 12:06 felicepantaleo

cms-bot internal usage

cmsbuild avatar Jun 13 '24 12:06 cmsbuild

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/40573

  • This PR adds an extra 132KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

    • File FWCore/ParameterSet/python/Config.py modified in PR(s): #43276

Code check has found code style and quality issues which could be resolved by applying following patch(s)

  • code-format: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/40573/code-format.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/40573/code-format.patch | patch -p1 You can also run scram build code-format to apply code format directly

cmsbuild avatar Jun 13 '24 12:06 cmsbuild

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/40574

  • This PR adds an extra 124KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

    • File FWCore/ParameterSet/python/Config.py modified in PR(s): #43276

cmsbuild avatar Jun 13 '24 12:06 cmsbuild

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

It involves the following packages:

  • FWCore/ParameterSet (core)
  • FWCore/PythonParameterSet (core)

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

cms-bot commands are listed here

cmsbuild avatar Jun 13 '24 12:06 cmsbuild

test parameters:

  • workflow = 25288.203,25488.203

felicepantaleo avatar Jun 13 '24 12:06 felicepantaleo

@cmsbuild please test

felicepantaleo avatar Jun 13 '24 12:06 felicepantaleo

-1

Failed Tests: RelVals Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-9ee9da/39871/summary.html COMMIT: 4e3d218223807897f2771457d06ffc62d642c5ba CMSSW: CMSSW_14_1_X_2024-06-13-1100/el8_amd64_gcc12 User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/45216/39871/install.sh to create a dev area with all the needed externals and cmssw changes.

RelVals

ValueError: Undefined workflows: 25288.203, 25488.203

cmsbuild avatar Jun 13 '24 18:06 cmsbuild

test parameters:

felicepantaleo avatar Jun 13 '24 21:06 felicepantaleo

@cmsbuild please test

felicepantaleo avatar Jun 13 '24 21:06 felicepantaleo

Given @makortel is on vacation until beginning of July, I do not plan on doing a deep dive on the PR until he gets back.

Dr15Jones avatar Jun 13 '24 21:06 Dr15Jones

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-9ee9da/39878/summary.html COMMIT: 4e3d218223807897f2771457d06ffc62d642c5ba CMSSW: CMSSW_14_1_X_2024-06-13-1100/el8_amd64_gcc12 User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/45216/39878/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 108 lines to the logs
  • Reco comparison results: 45263 differences found in the comparisons
  • DQMHistoTests: Total files compared: 48
  • DQMHistoTests: Total histograms compared: 3345018
  • DQMHistoTests: Total failures: 27593
  • DQMHistoTests: Total nulls: 24
  • DQMHistoTests: Total successes: 3317381
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.013000000000000001 KiB( 47 files compared)
  • DQMHistoSizes: changed ( 1000.0 ): 0.008 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 140.023 ): -0.016 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 140.043 ): -0.008 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 140.063 ): 0.023 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.042 ): -0.020 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.044 ): 0.016 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.046 ): -0.012 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 4.53 ): -0.004 KiB JetMET/SUSYDQM
  • Checked 202 log files, 165 edm output root files, 48 DQM output files
  • TriggerResults: found differences in 10 / 46 workflows

cmsbuild avatar Jun 14 '24 06:06 cmsbuild

no worries @Dr15Jones , there is still a bit of hammering to do before Matti comes back

felicepantaleo avatar Jun 14 '24 08:06 felicepantaleo

I have checked the changes in the DQM and they are due to the ~2000 floating point parameters in modules that are not using the fillDescriptions and are not declared as cms.double. These are now using cms.float by default. I will check now how to make cms.double the default for these.

felicepantaleo avatar Jun 14 '24 09:06 felicepantaleo

Milestone for this pull request has been moved to CMSSW_14_2_X. Please open a backport if it should also go in to CMSSW_14_1_X.

cmsbuild avatar Aug 27 '24 08:08 cmsbuild

ping (to make bot change milestone)

antoniovilela avatar Sep 03 '24 09:09 antoniovilela

@cmsbuild please test

felicepantaleo avatar Sep 12 '24 08:09 felicepantaleo

+1

Size: This PR adds an extra 16KB to repository Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-9ee9da/41469/summary.html COMMIT: 4e3d218223807897f2771457d06ffc62d642c5ba CMSSW: CMSSW_14_2_X_2024-09-11-2300/el8_amd64_gcc12 User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/45216/41469/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 78 lines to the logs
  • Reco comparison results: 45757 differences found in the comparisons
  • DQMHistoTests: Total files compared: 44
  • DQMHistoTests: Total histograms compared: 3331158
  • DQMHistoTests: Total failures: 37097
  • DQMHistoTests: Total nulls: 24
  • DQMHistoTests: Total successes: 3294017
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: -0.008 KiB( 43 files compared)
  • DQMHistoSizes: changed ( 1000.0,... ): 0.008 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 140.043,... ): -0.004 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.042 ): -0.020 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.044 ): 0.016 KiB JetMET/SUSYDQM
  • DQMHistoSizes: changed ( 141.046 ): -0.012 KiB JetMET/SUSYDQM
  • Checked 193 log files, 163 edm output root files, 44 DQM output files
  • TriggerResults: found differences in 13 / 42 workflows

cmsbuild avatar Sep 12 '24 18:09 cmsbuild

@cmsbuild please test

felicepantaleo avatar Sep 16 '24 10:09 felicepantaleo

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/41803

  • There are other open Pull requests which might conflict with changes you have proposed:
    • File FWCore/ParameterSet/python/Config.py modified in PR(s): #43276

Code check has found code style and quality issues which could be resolved by applying following patch(s)

  • code-format: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/41803/code-format.patch e.g. curl -k https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/41803/code-format.patch | patch -p1 You can also run scram build code-format to apply code format directly

cmsbuild avatar Sep 16 '24 10:09 cmsbuild

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-45216/41805

  • There are other open Pull requests which might conflict with changes you have proposed:
    • File FWCore/ParameterSet/python/Config.py modified in PR(s): #43276

cmsbuild avatar Sep 16 '24 12:09 cmsbuild

Pull request #45216 was updated. @Dr15Jones, @cmsbuild, @jfernan2, @makortel, @mandrenguyen, @smuzaffar can you please check and sign again.

cmsbuild avatar Sep 16 '24 12:09 cmsbuild

@cmsbuild please test

felicepantaleo avatar Sep 16 '24 13:09 felicepantaleo

+1

Size: This PR adds an extra 28KB to repository Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-9ee9da/41534/summary.html COMMIT: c97cd2912d52b8d16e5146fde8b298090dcc27df CMSSW: CMSSW_14_2_X_2024-09-15-2300/el8_amd64_gcc12 User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/45216/41534/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 3 lines from the logs
  • Reco comparison results: 5 differences found in the comparisons
  • DQMHistoTests: Total files compared: 44
  • DQMHistoTests: Total histograms compared: 3331158
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3331132
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 43 files compared)
  • Checked 193 log files, 163 edm output root files, 44 DQM output files
  • TriggerResults: no differences found

cmsbuild avatar Sep 16 '24 19:09 cmsbuild

+1

jfernan2 avatar Sep 17 '24 10:09 jfernan2

This will allow the developers of C++ modules to directly use std::vector<float> configuration parameters avoiding manually converting each of them from std::vector<double>, if double precision is not needed.

There are simpler ways to achieve an easier conversion from std::vector<double> to std::vector<float>, or enabling getParameter<std::vector<float>>(...), that would not require changes in the python configuration side. Could you describe what aspects, in addition to what you wrote in the PR description, you see as important so that it floating point precision is useful to be specified in the python configuration side as well?

(based on a cursory internal discussion we are leaning towards a separate configuration data type to be a better way, e.g. for consistency with the integer types and requiring consistency between fillDescriptions() and getParameter(), so this question is only about us learning what additional motivations do you have in mind)

makortel avatar Sep 17 '24 20:09 makortel

ciao Matti, thanks for looking into this. Apart from avoiding the ugly filling of the std::vector<float> from doubles in each producer, I think that specifying the floating point precision in the Python configuration offers type consistency across interfaces allows developers to control the numerical precision of parameters explicitly and help them not to focus on the implicit conversions in the code. With this PR I make any precision reduction intentional and visible, making the code more maintainable and easier to understand.

felicepantaleo avatar Sep 18 '24 13:09 felicepantaleo

@makortel let me know if you have more comments

felicepantaleo avatar Oct 03 '24 08:10 felicepantaleo

@felicepantaleo I'll have some comments, but have been distracted by other stuff (and will be for some days).

makortel avatar Oct 03 '24 16:10 makortel

Milestone for this pull request has been moved to CMSSW_15_0_X. Please open a backport if it should also go in to CMSSW_14_2_X.

cmsbuild avatar Nov 22 '24 13:11 cmsbuild

code-checks

smuzaffar avatar Dec 18 '24 07:12 smuzaffar