Skip to content

RooFit::MultiProcess & TestStatistics part 7: MultiProcess based TestStatistics classes#9349

Merged
guitargeek merged 8 commits intoroot-project:masterfrom
roofit-dev:RooFit_MultiProcess_PR_7_MultiProcess_TestStatistics
Dec 3, 2021
Merged

RooFit::MultiProcess & TestStatistics part 7: MultiProcess based TestStatistics classes#9349
guitargeek merged 8 commits intoroot-project:masterfrom
roofit-dev:RooFit_MultiProcess_PR_7_MultiProcess_TestStatistics

Conversation

@egpbos
Copy link
Copy Markdown
Contributor

@egpbos egpbos commented Nov 29, 2021

In this PR, we introduce two new classes: LikelihoodJob and LikelihoodGradientJob. These are RooFit::MultiProcess based test-statistic calculators that parallelize likelihood and likelihood gradient calculation respectively over multiple processes. These classes can be used internally by RooMinimizer to speed up fitting with migrad. The way to use them is to use the new RooMinimizer constructor that takes a (pointer to a) RooAbsL likelihood class that was introduced in previous PR #8700.

This PR is the seventh and final part of a split and clean-up of #8294.

Changes or fixes:

  • Adds LikelihoodJob and LikelihoodGradientJob under the RooFit::TestStatistics namespace.
  • Adds the LikelihoodGradientJob test case, which also covers the rest of the TestStatistics framework, as promised in RooFit::MultiProcess & TestStatistics part 6: add RooFit::TestStatistics #8700 (comment).
  • Adds two KahanSum constructors that allow for initialization of the full internal state. This is necessary for serializing and rematerializing KahanSums so they can be sent over ZeroMQ sockets.
  • RooMinimizer templated constructors and create factory functions were removed. These are replaced with enum class flags that allow the user to choose the type of RooAbsMinimizerFcn (this was already in place) and the Likelihood(Gradient)Wrapper implementations to use, i.e. the classes introduced in this PR. Similar changes were made in MinuitFcnGrad, which is now also template-free.
  • RooMinimizer's (now) two constructors use two helper functions now to avoid code duplication.
  • There were some mistakes in the build setup of RooFitZMQ and RooFit::MultiProcess that only came to light now when building these classes that depend on RooFit::MultiProcess. These are fixed.
  • A few functions had to be added to LikelihoodGradientWrapper and MinuitFcnGrad for passing along previous gradient, second derivative and step size information from Minuit2 to RooFit and back, i.e. using the functionality introduced in RooFit::MultiProcess & TestStatistics part 5b: test RooGradMinimizerFcn #8694.

Checklist:

  • tested changes locally
  • update the docs (if necessary)
  • unify copyright/license headers with previous commits
  • includes: correct order (matching header, RooFit, ROOT, std) and ROOT includes in quotation marks
  • refactor member names: underscore suffix
  • remove commented out code and TODOs and other junk
  • clang-tidy up
  • rebase into two commits (one for KahanSum and one for the rest)
  • make Readme.md for developers with some examples to run

@phsft-bot

This comment has been minimized.

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Nov 29, 2021

@phsft-bot build with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON

@phsft-bot

This comment has been minimized.

@phsft-bot

This comment has been minimized.

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Nov 30, 2021

@phsft-bot build with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON

@phsft-bot

This comment has been minimized.

@phsft-bot

This comment has been minimized.

@phsft-bot

This comment has been minimized.

@root-project root-project deleted a comment from phsft-bot Nov 30, 2021
@phsft-bot

This comment has been minimized.

@root-project root-project deleted a comment from phsft-bot Nov 30, 2021
@root-project root-project deleted a comment from phsft-bot Nov 30, 2021
@root-project root-project deleted a comment from phsft-bot Nov 30, 2021
@root-project root-project deleted a comment from phsft-bot Nov 30, 2021
@phsft-bot

This comment has been minimized.

@phsft-bot

This comment has been minimized.

@phsft-bot

This comment has been minimized.

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Nov 30, 2021

@phsft-bot build with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14 with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu16/nortcxxmod.
Running on sft-ubuntu-1604-2.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2021-11-30T15:18:03.662Z] /data/sftnight/workspace/root-pullrequests-build/root/graf2d/mathtext/src/table/adobeglyphlist.h:128:44: warning: unpaired UTF-8 bidirectional character detected [-Wbidirectional=]
  • [2021-11-30T15:18:03.662Z] /data/sftnight/workspace/root-pullrequests-build/root/graf2d/mathtext/src/table/adobeglyphlist.h:128:55: warning: unpaired UTF-8 bidirectional character detected [-Wbidirectional=]
  • [2021-11-30T15:23:37.929Z] /data/sftnight/workspace/root-pullrequests-build/root/graf2d/postscript/src/AdobeGlyphList.h:110:44: warning: unpaired UTF-8 bidirectional character detected [-Wbidirectional=]
  • [2021-11-30T15:23:37.929Z] /data/sftnight/workspace/root-pullrequests-build/root/graf2d/postscript/src/AdobeGlyphList.h:110:55: warning: unpaired UTF-8 bidirectional character detected [-Wbidirectional=]

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-11-30T17:09:20.330Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\res\TestStatistics/LikelihoodJob.h(17,10): fatal error C1083: Cannot open include file: 'RooFit/MultiProcess/Job.h': No such file or directory [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\RooFitCore.vcxproj]

@phsft-bot

This comment has been minimized.

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Nov 30, 2021

@phsft-bot build on windows10/cxx14 with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON

@phsft-bot
Copy link
Copy Markdown

Starting build on windows10/cxx14 with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Dec 2, 2021

@phsft-bot build with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14 with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-12-02T16:09:35.520Z] CMake Error at cmake/modules/RootBuildOptions.cmake:353 (message):
  • [2021-12-02T16:09:35.520Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1128 (message):

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Dec 2, 2021

Building successfully with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON (Windows failure is as expected, since we set it to error when activating roofit_multiprocess):
Schermafbeelding 2021-12-02 om 19 43 32

@egpbos egpbos force-pushed the RooFit_MultiProcess_PR_7_MultiProcess_TestStatistics branch from ce08c20 to 807564d Compare December 2, 2021 18:57
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@egpbos egpbos force-pushed the RooFit_MultiProcess_PR_7_MultiProcess_TestStatistics branch from 807564d to fb952c0 Compare December 3, 2021 12:06
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Thanks @egpbos for this very well organized PR, respecting many good practices! It was smooth to review with this commit history and there is nothing that blocks us from merging.

One thing that we need to still follow up on is the leaking of zeromq symbols. I will check again if they still leak in my environment, and if yes, open a GitHub issue so we have a communication thread to talk about this further.

…o_workers

Also use perfect forwarding to avoid copying movable messages.
Replaces custom variables, which were not working anyway, because they
are not defined outside of their scope, in parent (or sibling)
directories.
The default setting for roofit_multiprocess on Windows is now OFF. If
-Droofit_multiprocess=ON is passed manually, CMake configuration will
emit a fatal error.
Three things that also impact existing files (not just the ones added in this commit):

- RooMinimizer templated constructors and create factory functions removed.
  Replaced with enum class flags that allow the user to choose the type of
  RooAbsMinimizerFcn and the Likelihood(Gradient)Wrapper implementations to
  use. Same for TestStatistics::MinuitFcnGrad.
- add *WithPrevResults implementations to pass along previous gradient,
  second derivative and step size information between Minuit2 and
  RooFit.
- Add compiler definition to disable MultiProcess based classes (also in
  MinuitFcnGrad) when not building with MultiProcess (e.g. in Windows).
@egpbos egpbos force-pushed the RooFit_MultiProcess_PR_7_MultiProcess_TestStatistics branch from fb952c0 to 8341962 Compare December 3, 2021 13:58
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14
How to customize builds

@guitargeek
Copy link
Copy Markdown
Contributor

@phsft-bot build with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, ROOT-ubuntu2004/soversion, mac1015/python3, mac11/cxx17, windows10/cxx14 with flags -Droofit_multiprocess=ON -Dbuiltin_zeromq=ON -Dbuiltin_cppzmq=ON
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2021-12-03T14:06:24.028Z] CMake Error at cmake/modules/RootBuildOptions.cmake:354 (message):
  • [2021-12-03T14:06:24.304Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1128 (message):

Copy link
Copy Markdown
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

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

LGTM !
Thank you Patrick for this contribution!

@guitargeek guitargeek merged commit 62d3323 into root-project:master Dec 3, 2021
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