Skip to content

RooFit::MultiProcess & TestStatistics part 5: RooGradMinimizerFcn#8596

Merged
guitargeek merged 7 commits intoroot-project:masterfrom
roofit-dev:RooFit_MultiProcess_PR_5_Gradient_Minimizer
Jul 16, 2021
Merged

RooFit::MultiProcess & TestStatistics part 5: RooGradMinimizerFcn#8596
guitargeek merged 7 commits intoroot-project:masterfrom
roofit-dev:RooFit_MultiProcess_PR_5_Gradient_Minimizer

Conversation

@egpbos
Copy link
Copy Markdown
Contributor

@egpbos egpbos commented Jul 3, 2021

This PR adds RooGradMinimizerFcn, an alternative to RooMinimizerFcn that calculates gradient itself outside of Minuit during minimization.

To be able to use RooGradMinimizerFcn, RooMinimizer had to be refactored to be able to use RooAbsMinimizerFcn instead of the concrete RooMinimizerFcn class. To accomodate this change, several other changes had to be made:

  • _optConst and _func members were removed, since these are now managed by the *MinimizerFcn.
  • This means also things like function name and title, but also optimization switches, were moved to RooAbsMinimizerFcn as well.
  • Functions getMultiGenFcn, fitterFcn and fitFcn were added which are used in several places as convenience functions to access the concrete RooAbsMinimizerFcn object with its proper type. The concrete type matters, for instance, when passing the class to the derivator, because a gradient enabled *MinimizerFcn needs to take different overloads than the classic function-value-only RooMinimizerFcn. A FcnMode enum class was added for this disambiguation as well.
  • Construction of a RooMinimizer can be done the same as always when using a classic RooMinimizerFcn. However, to activate RooGradMinimizerFcn, a new create function can be used with the proper type as template parameter. In a later PR, this pattern will be extended with another gradient-enabled RooAbsMinimizerFcn instantiation that will also include multi-processing implementations.

Since we had to refactor construction, we took the opportunity to also put default parameters in the header declaration, instead of in the constructor initializer lists.

Finally, this PR changes the default minimizer from Minuit to Minuit2. Note that this may require some discussion. We already briefly touched upon this in a Zoom meeting, but haven't thoroughly mapped out consequences yet. The reason for the switch is that the derivator scheme used in RooGradMinimizerFcn replicates that of Minuit2, so comparing to that makes more sense. Also, it just hasn't been tested at all with Minuit 1, I'm not even sure it will work with that version.

Other than these RooMinimizer changes and the addition of RooGradMinimizerFcn, a new test was added called testRooGradMinimizer. It also uses a test_lib.h header that will also be used later on in tests of other new likelihood minimization implementations. Do note that the test currently fails. I originally had carefully made sure the results were bit-wise exactly the same as those from using classic RooMinimizerFcn, but there must have been some change in the meantime that I have not been able to integrate yet. I suspect it is caused by a change in Kahan summation, but have to inspect. In any case, the results are minor differences that do not negatively affect the effectiveness, the minimization just takes slightly different paths to the end results that will agree within the desired precision when set high enough.

Final note: this PR depends on three others: #8369, #8567 and #8569. These branches as they currently are were merged into this branch before making the one commit that adds everything in this actual commit. Do not merge this one before those. Also take care that this branch will be rebased and force pushed after each of those three are merged. In short: probably it will be easier to review this branch after those others are merged. However, of course, a review is already most welcome. Just make sure to only look at the diff from the final commit: 6b129be

Update: two of the above dependency PRs were merged. Only #8567 still needs to be merged and hence is also still included in this PR to make it compile. I have marked these three math/minuit2 files with a review comment. All the other files actually do belong to this PR. So, in short: ready for review!

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

@egpbos egpbos requested review from guitargeek and lmoneta July 3, 2021 19:28
@egpbos egpbos requested review from bellenot and hageboeck as code owners July 3, 2021 19:28
@phsft-bot
Copy link
Copy Markdown

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

@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-07-03T19:38:45.170Z] /data/sftnight/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:822:1: warning: control reaches end of non-void function [-Wreturn-type]
  • [2021-07-03T19:38:45.170Z] /data/sftnight/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:844:1: warning: control reaches end of non-void function [-Wreturn-type]
  • [2021-07-03T19:38:45.746Z] /data/sftnight/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:275:11: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Failing tests:

@phsft-bot
Copy link
Copy Markdown

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

Warnings:

  • [2021-07-03T19:35:14.381Z] /mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:822:1: warning: control reaches end of non-void function [-Wreturn-type]
  • [2021-07-03T19:35:14.381Z] /mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:844:1: warning: control reaches end of non-void function [-Wreturn-type]
  • [2021-07-03T19:35:14.381Z] /mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:275:11: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]

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-07-03T20:29:06.845Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\test_lib.h(66,15): error C2131: expression did not evaluate to a constant [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:06.845Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\test_lib.h(66,25): error C2131: expression did not evaluate to a constant [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:06.845Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\test_lib.h(68,56): error C3863: array type 'double [n]' is not assignable [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:06.845Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\test_lib.h(69,68): error C3863: array type 'double [n]' is not assignable [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:06.845Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\RooGradMinimizer.cxx(387,17): error C2131: expression did not evaluate to a constant [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:06.845Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\RooGradMinimizer.cxx(388,16): error C2131: expression did not evaluate to a constant [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:07.148Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\RooGradMinimizer.cxx(393,83): error C3863: array type 'double [N]' is not assignable [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:07.148Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\RooGradMinimizer.cxx(398,82): error C3863: array type 'double [N]' is not assignable [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:07.148Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\RooGradMinimizer.cxx(418,17): error C2131: expression did not evaluate to a constant [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]
  • [2021-07-03T20:29:07.148Z] C:\build\workspace\root-pullrequests-build\root\roofit\roofitcore\test\RooGradMinimizer.cxx(419,16): error C2131: expression did not evaluate to a constant [C:\build\workspace\root-pullrequests-build\build\roofit\roofitcore\test\testRooGradMinimizer.vcxproj]

And 10 more

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2021-07-03T19:46:42.247Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:822:1: warning: control reaches end of non-void function [-Wreturn-type]
  • [2021-07-03T19:46:42.247Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:844:1: warning: control reaches end of non-void function [-Wreturn-type]
  • [2021-07-03T19:46:42.247Z] /home/sftnight/build/workspace/root-pullrequests-build/root/roofit/roofitcore/src/RooMinimizer.cxx:275:11: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Failing tests:

@phsft-bot
Copy link
Copy Markdown

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1014/python3.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

Copy link
Copy Markdown
Member

@hageboeck hageboeck left a comment

Choose a reason for hiding this comment

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

Hi, I tried my best, but this is too much to review. All code that's longer than a few lines had to go unchecked.
I also saw merge commits, which ROOT doesn't use. A fresh rebase might be beneficial. That might also give an opportunity to kill the back-and-forth reverts that were a bit confusing to review.

I'm also not really sure if I hadn't seen some of those (or similar) commits. If that was desired, e.g. because this PR lives on top of another: OK
If that's not the intention, something is wrong.

One recommendation:
If you change whitespaces or other kinds of formatting or documentation, mark the commit with [NFC] Change formatting or [Docs] Fix docstrings of ..., and don't mix this with code changes. This makes the review a lot easier (especially because the reviewer can easily skip all things that you promise to be NFC).

@@ -456,6 +456,7 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitCore
Matrix
Tree
Minuit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a Minuit dependency? @guitargeek ?
By now, this might be behind interfaces.

@phsft-bot
Copy link
Copy Markdown

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

@egpbos egpbos force-pushed the RooFit_MultiProcess_PR_5_Gradient_Minimizer branch from 1df6d18 to 95b8c3b Compare July 8, 2021 14:51
@phsft-bot
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

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

Errors:

  • [2021-07-08T14:56:52.381Z] FAILED: cd /mnt/build/workspace/root-pullrequests-build/build/roofit/roofitcore && /usr/bin/cmake -E env LD_LIBRARY_PATH=/mnt/build/workspace/root-pullrequests-build/build/lib: ROOTIGNOREPREFIX=1 /mnt/build/workspace/root-pullrequests-build/build/bin/rootcling -rootbuild -v2 -f G__RooFitCore.cxx -s /mnt/build/workspace/root-pullrequests-build/build/lib/libRooFitCore.so -m libCore_rdict.pcm -m libHist_rdict.pcm -m libGraf_rdict.pcm -m libMatrix_rdict.pcm -m libTree_rdict.pcm -m libMinuit_rdict.pcm -m libMinuit2_rdict.pcm -m libRIO_rdict.pcm -m libMathCore_rdict.pcm -m libFoam_rdict.pcm -m libSmatrix_rdict.pcm -excludePath /mnt/build/workspace/root-pullrequests-build/root -excludePath /mnt/build/workspace/root-pullrequests-build/build/ginclude -excludePath /mnt/build/workspace/root-pullrequests-build/build/externals -excludePath /mnt/build/workspace/root-pullrequests-build/build/builtins -rml libRooFitCore.so -rmf /mnt/build/workspace/root-pullrequests-build/build/lib/libRooFitCore.rootmap -writeEmptyRootPCM -DVECCORE_ENABLE_VC -I/mnt/build/workspace/root-pullrequests-build/build/include -I/usr/include/freetype2 -I/usr/include/x86_64-linux-gnu/freetype2 -I/mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/unix/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clingutils/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/textinput/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/thread/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/zip/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/rint/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/meta/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/gui/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/cont/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/inc -I/mnt/build/workspace/root-pullrequests-build/build/ginclude -I/mnt/build/workspace/root-pullrequests-build/root/hist/hist/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/v7/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/imt/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/multiproc/inc -I/mnt/build/workspace/root-pullrequests-build/build/externals//mnt/build/workspace/root-pullrequests-build/install/include -I/mnt/build/workspace/root-pullrequests-build/root/math/matrix/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/graf/inc -I/mnt/build/workspace/root-pullrequests-build/root/io/io/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/res -I/mnt/build/workspace/root-pullrequests-build/root/builtins -I/usr/include/freetype2 -I/usr/include/x86_64-linux-gnu/freetype2 -I/mnt/build/workspace/root-pullrequests-build/root/tree/tree/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/minuit/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/minuit2/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/foam/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/smatrix/inc -I/mnt/build/workspace/root-pullrequests-build/root/roofit/batchcompute/inc -I/mnt/build/workspace/root-pullrequests-build/root/net/net/inc Floats.h Roo1DTable.h RooAbsAnaConvPdf.h RooAbsArg.h RooAbsBinning.h RooAbsCachedPdf.h RooAbsCachedReal.h RooAbsCacheElement.h RooAbsCache.h RooAbsCategory.h RooAbsCategoryLValue.h RooAbsCollection.h RooAbsData.h RooAbsDataStore.h RooAbsFunc.h RooAbsGenContext.h RooAbsHiddenReal.h RooAbsIntegrator.h RooAbsLValue.h RooAbsMCStudyModule.h RooAbsMinimizerFcn.h RooAbsMoment.h RooAbsNumGenerator.h RooAbsOptTestStatistic.h RooAbsPdf.h RooAbsProxy.h RooAbsReal.h RooAbsRealLValue.h RooAbsRootFinder.h RooAbsSelfCachedPdf.h RooAbsSelfCachedReal.h RooAbsString.h RooAbsStudy.h RooAbsTestStatistic.h RooAcceptReject.h RooAdaptiveIntegratorND.h RooAddGenContext.h RooAddition.h RooAddModel.h RooAddPdf.h RooAICRegistry.h RooArgList.h RooArgProxy.h RooArgSet.h RooBinIntegrator.h RooBinnedGenContext.h RooBinningCategory.h RooBinning.h RooBrentRootFinder.h RooCachedPdf.h RooCachedReal.h RooCacheManager.h RooCategory.h RooCategoryProxy.h RooChangeTracker.h RooChi2Var.h RooClassFactory.h RooCmdArg.h RooCmdConfig.h RooCompositeDataStore.h RooConstraintSum.h RooConstVar.h RooConvCoefVar.h RooConvGenContext.h RooConvIntegrandBinding.h RooCurve.h RooCustomizer.h RooDataHist.h RooDataHistSliceIter.h RooDataProjBinding.h RooDataSet.h RooDataWeightedAverage.h RooDerivative.h RooDirItem.h RooDLLSignificanceMCSModule.h RooDouble.h RooEffGenContext.h RooEfficiency.h RooEffProd.h RooEllipse.h RooErrorHandler.h RooErrorVar.h RooExpensiveObjectCache.h RooExtendedBinding.h RooExtendedTerm.h RooExtendPdf.h RooFactoryWSTool.h RooFFTConvPdf.h RooFirstMoment.h RooFit.h RooFitResult.h RooFoamGenerator.h RooFormula.h RooFormulaVar.h RooFracRemainder.h RooFunctor.h RooGenContext.h RooGenericPdf.h RooGenFitStudy.h RooGenFunction.h RooGenProdProj.h RooGlobalFunc.h RooGradMinimizerFcn.h RooGrid.h RooHistError.h RooHistFunc.h RooHist.h RooHistPdf.h RooImproperIntegrator1D.h RooIntegrator1D.h RooIntegrator2D.h RooIntegratorBinding.h RooInt.h RooInvTransform.h RooLinearCombination.h RooLinearVar.h RooLinkedListElem.h RooLinkedList.h RooLinkedListIter.h RooLinTransBinning.h RooList.h RooListProxy.h RooMappedCategory.h RooMath.h RooMCIntegrator.h RooMCStudy.h RooMinimizerFcn.h RooMinimizer.h RooMoment.h RooMPSentinel.h RooMsgService.h RooMultiCategory.h RooMultiGenFunction.h RooMultiVarGaussian.h RooNameReg.h RooNLLVar.h RooNormSetCache.h RooNumber.h RooNumCdf.h RooNumConvolution.h RooNumConvPdf.h RooNumGenConfig.h RooNumGenFactory.h RooNumIntConfig.h RooNumIntFactory.h RooNumRunningInt.h RooObjCacheManager.h RooParamBinning.h RooPlotable.h RooPlot.h RooPolyVar.h RooPrintable.h RooProdGenContext.h RooProdPdf.h RooProduct.h RooProfileLL.h RooProjectedPdf.h RooProofDriverSelector.h RooPullVar.h RooQuasiRandomGenerator.h RooRatio.h RooRandom.h RooRandomizeParamMCSModule.h RooRangeBinning.h RooRangeBoolean.h RooRealAnalytic.h RooRealBinding.h RooRealConstant.h RooRealIntegral.h RooRealMPFE.h RooTemplateProxy.h RooRealProxy.h RooRealSumFunc.h RooRealSumPdf.h RooRealVar.h RooRealVarSharedProperties.h RooRecursiveFraction.h RooRefCountList.h RooSTLRefCountList.h RooResolutionModel.h RooScaledFunc.h RooSecondMoment.h RooSegmentedIntegrator1D.h RooSegmentedIntegrator2D.h RooSentinel.h RooSetPair.h RooSetProxy.h RooSharedProperties.h RooSimGenContext.h RooSimPdfBuilder.h RooSimSplitGenContext.h RooSimultaneous.h RooSimWSTool.h RooStreamParser.h RooStringVar.h RooStudyManager.h RooStudyPackage.h RooSuperCategory.h RooTable.h RooTFoamBinding.h RooThresholdCategory.h RooTObjWrap.h RooTrace.h RooTreeDataStore.h RooTruthModel.h RooUniformBinning.h RooUnitTest.h RooVectorDataStore.h RooWorkspace.h RooWorkspaceHandle.h RooXYChi2Var.h RooHelpers.h RooWrapperPdf.h RooNaNPacker.h RooBinSamplingPdf.h RooBinWidthFunction.h RooFitLegacy/RooCatTypeLegacy.h RooFitLegacy/RooCategorySharedProperties.h RooFitLegacy/RooHashTable.h RooFitLegacy/RooMinuit.h RooFitLegacy/RooNameSet.h RooFitLegacy/RooTreeData.h /mnt/build/workspace/root-pullrequests-build/root/roofit/roofitcore/inc/LinkDef.h
  • [2021-07-08T14:56:52.381Z] /mnt/build/workspace/root-pullrequests-build/build/include/RooGradMinimizerFcn.h:25:10: fatal error: 'NumericalDerivatorMinuit2.h' file not found

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

Errors:

  • [2021-07-08T14:59:45.273Z] /data/sftnight/workspace/root-pullrequests-build/build/include/RooGradMinimizerFcn.h:25:10: fatal error: 'NumericalDerivatorMinuit2.h' file not found

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-08T15:12:09.787Z] /home/sftnight/build/workspace/root-pullrequests-build/build/include/RooGradMinimizerFcn.h:25:10: fatal error: 'NumericalDerivatorMinuit2.h' file not found

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1014/python3.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-08T16:26:35.372Z] FAILED: roofit/roofitcore/G__RooFitCore.cxx lib/RooFitCore.pcm
  • [2021-07-08T16:26:38.662Z] /Volumes/HD2/build/workspace/root-pullrequests-build/build/include/RooGradMinimizerFcn.h:25:10: fatal error: 'NumericalDerivatorMinuit2.h' file not found

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-08T16:30:03.096Z] FAILED: roofit/roofitcore/G__RooFitCore.cxx lib/RooFitCore.pcm
  • [2021-07-08T16:30:04.998Z] /Users/sftnight/build/workspace/root-pullrequests-build/build/include/RooGradMinimizerFcn.h:25:10: fatal error: 'NumericalDerivatorMinuit2.h' file not found

@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-07-08T17:44:19.260Z] C:/build/workspace/root-pullrequests-build/build/include\RooGradMinimizerFcn.h:25:10: fatal error: 'NumericalDerivatorMinuit2.h' file not found

@egpbos egpbos force-pushed the RooFit_MultiProcess_PR_5_Gradient_Minimizer branch from 95b8c3b to 692fae6 Compare July 9, 2021 19:12
@phsft-bot
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-09T19:13:22.829Z] CMake Error at /Users/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1045 (message):

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

Errors:

  • [2021-07-09T19:14:22.657Z] CMake Error at /data/sftnight/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1045 (message):

@phsft-bot
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

@phsft-bot
Copy link
Copy Markdown

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

Failing tests:

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Jul 16, 2021

Are those tests failing because of the changes in this PR or were they already failing? I see on my laptop (I don't see the failure messages in Jenkins) that testNaNPacker fails on FitAddPdf_DegenerateCoeff with output:

[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3
[#0] WARNING:Eval -- RooAddPdf::updateCoefCache(sum WARNING: sum of PDF coefficients not in range [0-1], value=1.3 (no more will be printed)
../roofit/roofitcore/test/testNaNPacker.cxx:228: Failure
Warning in <ROOT::Math::Fitter::CalculateHessErrors>: Error when calculating Hessian
Value of: a1Final.getVal() < 0. || a1Final.getVal() > 1. || a2Final.getVal() < 0. || a2Final.getVal() > 1.
  Actual: false
Expected: true
Recovery strength=0

RooFit stress tests give the following output:

/Users/pbos/projects/apcocsm/roofit-dev/root/cmake-build-debug/test/stressRooFit

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read http://roofit.sourceforge.net/license.txt

******************************************************************
*  RooFit - S T R E S S suite                                    *
******************************************************************
******************************************************************
*  Starting  S T R E S S  basic suite                            *
******************************************************************
Test  1 : Fitting,plotting & event generation of basic p.d.f.....OK
Test  2 : Data import methods....................................OK
Test  3 : Interpreted expression p.d.f...........................OK
Test  4 : C++ function binding operator p.d.f....................OK
Test  5 : Non-standard binning in counting and asymmetry plots...OK
Test  6 : Calculation of chi^2 and residuals in plots............OK
Test  7 : Normalization of p.d.f.s in 1D.........................OK
Test  8 : Numeric integration configuration......................OK
Test  9 : Addition operator p.d.f................................OK
Test 10 : Extended ML fits to addition operator p.d.f.s..........OK
Test 11 : Basic fitting and plotting in ranges...................OK
Test 12 : Extended ML fit in sub range...........................OK
Test 13 : Component plotting variations..........................OK
Test 14 : FFT Convolution operator p.d.f.........................SKIPPED
Test 15 : Analytical convolution operator........................OK
Test 16 : Composition extension of basic p.d.f...................OK
Test 17 : Sum and product utility functions......................OK
Test 18 : Conditional use of F(x|y)..............................OK
Test 19 : Product operator p.d.f. with uncorrelated terms........OK
Test 20 : Product operator p.d.f. with conditional term..........OK
Test 21 : Conditional use of per-event error p.d.f. F(t|dt)......OK
Test 22 : Full per-event error p.d.f. F(t|dt)G(dt)...............OK
Test 23 : Normalization of p.d.f.s in 2D.........................OK
Test 24 : Data and p.d.f projection in category slice............OK
Test 25 : Data and p.d.f projection in sub range.................OK
Test 26 : Fit in multiple rectangular ranges.....................OK
Test 27 : Integration over non-rectangular regions...............OK
Test 28 : P.d.f. marginalization through integration.............OK
Test 29 : Fit with non-rectangular observable boundaries.........OK
Test 30 : Likelihood ratio projection plot.......................OK
Test 31 : Basic operations on datasets...........................OK
RooFitResult::isIdentical: final parameter a1 differs in value:	-0.0526778 vs.	-0.0526783	(-1.09602e-05)
RooFitResult::isIdentical: final parameter a2 differs in value:	0.0908314 vs.	0.0907493	(0.000904683)
RooUnitTest ERROR: comparison of object RooFitResult::chi2 from result rf403_ml_chi2 fails comparison with counterpart in reference RooFitResult chi2
Test 32 : Fits with weighted datasets............................FAILED
Test 33 : Categories basic functionality.........................OK
Test 34 : Real-to-category functions.............................OK
Test 35 : Category-to-category functions.........................OK
Test 36 : Simultaneous p.d.f. operator...........................OK
Test 37 : Workspace and p.d.f. persistence.......................OK
Test 38 : Interactive Minuit.....................................OK
RooFitResult::isIdentical: final parameter a0 differs in value:	0.478231 vs.	0.478381	(-0.000314757)
RooFitResult::isIdentical: final parameter a1 differs in value:	-0.21727 vs.	-0.217115	(0.000711025)
RooFitResult::isIdentical: final parameter bkgfrac differs in value:	0.488312 vs.	0.488364	(-0.000106041)
RooFitResult::isIdentical: final parameter sig1frac differs in value:	0.775519 vs.	0.775715	(-0.000252656)
RooFitResult::isIdentical: global correlation coefficient GC[a0] differs in value:	0.352563 vs.	0.352672	(-0.000309017)
RooFitResult::isIdentical: global correlation coefficient GC[a1] differs in value:	0.699297 vs.	0.699506	(-0.000298908)
RooFitResult::isIdentical: global correlation coefficient GC[bkgfrac] differs in value:	0.789273 vs.	0.789494	(-0.00027918)
RooFitResult::isIdentical: global correlation coefficient GC[sig1frac] differs in value:	0.744941 vs.	0.74518	(-0.000319591)
RooFitResult::isIdentical: correlation coefficient C[a0,bkgfrac] differs in value:	-0.251715 vs.	-0.252003	(-0.00114039)
RooFitResult::isIdentical: correlation coefficient C[a0,sig1frac] differs in value:	-0.230889 vs.	-0.231128	(-0.00103182)
RooFitResult::isIdentical: correlation coefficient C[a1,bkgfrac] differs in value:	-0.661174 vs.	-0.661446	(-0.000410473)
RooFitResult::isIdentical: correlation coefficient C[a1,sig1frac] differs in value:	-0.579023 vs.	-0.579319	(-0.000510146)
RooFitResult::isIdentical: correlation coefficient C[bkgfrac,a0] differs in value:	-0.251715 vs.	-0.252003	(-0.00114039)
RooFitResult::isIdentical: correlation coefficient C[bkgfrac,a1] differs in value:	-0.661174 vs.	-0.661446	(-0.000410473)
RooFitResult::isIdentical: correlation coefficient C[bkgfrac,sig1frac] differs in value:	0.734244 vs.	0.734495	(-0.000341388)
RooFitResult::isIdentical: correlation coefficient C[sig1frac,a0] differs in value:	-0.230889 vs.	-0.231128	(-0.00103182)
RooFitResult::isIdentical: correlation coefficient C[sig1frac,a1] differs in value:	-0.579023 vs.	-0.579319	(-0.000510146)
RooFitResult::isIdentical: correlation coefficient C[sig1frac,bkgfrac] differs in value:	0.734244 vs.	0.734495	(-0.000341388)
RooUnitTest ERROR: comparison of object RooFitResult::chi2 from result rf602_r fails comparison with counterpart in reference RooFitResult chi2
Test 39 : Chi2 minimization......................................FAILED
Test 40 : Auxiliary observable constraints.......................OK
RooCurve::isIdentical[  5] Y tolerance exceeded ( 0.0041295>0.004),  x,y=(    3.4275,    9.0733)	ref: y=    9.0209. [Nearest point from ref: j=5	x,y=(    3.4275,    9.0209) ]	range=12.699
RooCurve::isIdentical[  6] Y tolerance exceeded ( 0.0042093>0.004),  x,y=(      3.47,    7.9973)	ref: y=    7.9439. [Nearest point from ref: j=6	x,y=(      3.47,    7.9439) ]	range=12.699
RooCurve::isIdentical[  7] Y tolerance exceeded ( 0.0042354>0.004),  x,y=(    3.5125,    6.9909)	ref: y=    6.9371. [Nearest point from ref: j=7	x,y=(    3.5125,    6.9371) ]	range=12.699
RooCurve::isIdentical[  8] Y tolerance exceeded ( 0.0042106>0.004),  x,y=(     3.555,    6.0549)	ref: y=    6.0014. [Nearest point from ref: j=8	x,y=(     3.555,    6.0014) ]	range=12.699
RooCurve::isIdentical[  9] Y tolerance exceeded (  0.004138>0.004),  x,y=(    3.5975,    5.1899)	ref: y=    5.1373. [Nearest point from ref: j=9	x,y=(    3.5975,    5.1373) ]	range=12.699
RooCurve::isIdentical[ 10] Y tolerance exceeded ( 0.0040204>0.004),  x,y=(      3.64,    4.3957)	ref: y=    4.3446. [Nearest point from ref: j=10	x,y=(      3.64,    4.3446) ]	range=12.699
RooCurve::isIdentical[ 30] Y tolerance exceeded ( 0.0043299>0.004),  x,y=(      4.49,    1.3763)	ref: y=    1.4312. [Nearest point from ref: j=30	x,y=(      4.49,    1.4312) ]	range=12.699
RooCurve::isIdentical[ 31] Y tolerance exceeded ( 0.0049231>0.004),  x,y=(    4.5325,    1.7329)	ref: y=    1.7954. [Nearest point from ref: j=31	x,y=(    4.5325,    1.7954) ]	range=12.699
RooCurve::isIdentical[ 32] Y tolerance exceeded ( 0.0055249>0.004),  x,y=(     4.575,     2.125)	ref: y=    2.1952. [Nearest point from ref: j=32	x,y=(     4.575,    2.1952) ]	range=12.699
RooCurve::isIdentical[ 33] Y tolerance exceeded ( 0.0061345>0.004),  x,y=(    4.6175,    2.5509)	ref: y=    2.6288. [Nearest point from ref: j=33	x,y=(    4.6175,    2.6288) ]	range=12.699
RooCurve::isIdentical[ 34] Y tolerance exceeded ( 0.0067512>0.004),  x,y=(      4.66,    3.0092)	ref: y=    3.0949. [Nearest point from ref: j=34	x,y=(      4.66,    3.0949) ]	range=12.699
RooCurve::isIdentical[ 35] Y tolerance exceeded ( 0.0073744>0.004),  x,y=(    4.7025,    3.4982)	ref: y=    3.5919. [Nearest point from ref: j=35	x,y=(    4.7025,    3.5919) ]	range=12.699
RooCurve::isIdentical[ 36] Y tolerance exceeded ( 0.0080035>0.004),  x,y=(     4.745,    4.0168)	ref: y=    4.1184. [Nearest point from ref: j=36	x,y=(     4.745,    4.1184) ]	range=12.699
RooCurve::isIdentical[ 37] Y tolerance exceeded (  0.008638>0.004),  x,y=(    4.7875,    4.5633)	ref: y=     4.673. [Nearest point from ref: j=37	x,y=(    4.7875,     4.673) ]	range=12.699
RooCurve::isIdentical[ 38] Y tolerance exceeded ( 0.0092771>0.004),  x,y=(      4.83,    5.1366)	ref: y=    5.2544. [Nearest point from ref: j=38	x,y=(      4.83,    5.2544) ]	range=12.699
RooCurve::isIdentical[ 39] Y tolerance exceeded (  0.010568>0.004),  x,y=(     4.915,    6.3583)	ref: y=    6.4925. [Nearest point from ref: j=39	x,y=(     4.915,    6.4925) ]	range=12.699
RooCurve::isIdentical[ 40] Y tolerance exceeded (  0.011872>0.004),  x,y=(         5,    7.6719)	ref: y=    7.8227. [Nearest point from ref: j=40	x,y=(         5,    7.8227) ]	range=12.699
RooCurve::isIdentical[ 41] Y tolerance exceeded (  0.011872>0.004),  x,y=(         5,    7.6719)	ref: y=    7.8227. [Nearest point from ref: j=40	x,y=(         5,    7.8227) ]	range=12.699
RooUnitTest ERROR: comparison of object RooCurve::nll_Norm[sigma_g2] fails comparison with counterpart in reference RooPlot rf605_plot2
Test 41 : Profile Likelihood operator............................FAILED
Test 42 : NLL error handling.....................................OK
Test 43 : Fit Result functionality...............................OK
Test 44 : Chi^2 fit to X-Y dataset...............................OK
Test 45 : Efficiency operator p.d.f. 1D..........................OK
Test 46 : Efficiency operator p.d.f. 2D..........................OK
Test 47 : Efficiency product operator p.d.f......................OK
Test 48 : Amplitude sum operator p.d.f...........................OK
Test 49 : Linear morph operator p.d.f............................OK
Test 50 : Histogram based p.d.f.s................................OK
Test 51 : Kernel estimation p.d.f.s..............................OK
Test 52 : B Physics p.d.f.s......................................OK
Test 53 : Automated MC studies...................................OK
Test 54 : MC Study with chi^2 calculator.........................OK
Test 55 : MC Study with param rand. and Z calc...................OK
Test 56 : MC Studies with aux. obs. constraints..................OK
******************************************************************
*  SYS: Darwin ESLT0149 20.5.0 Darwin Kernel Version 20.5.0: Sat May
*  SYS: 11.4 Mac OS X 
******************************************************************
******************************************************************
*  ROOTMARKS =1199.2   *  Root6.25/01   20210303/1746
******************************************************************
Time at the end of job = 67.120000 seconds

Process finished with exit code 3

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-16T12:07:07.207Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

Failing tests:

@phsft-bot
Copy link
Copy Markdown

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1014/python3.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@egpbos
Copy link
Copy Markdown
Contributor Author

egpbos commented Jul 16, 2021

Build successful! Ready to merge?

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 for the PR and following up on the review comments! This PR introduced the RooGradMinimizerFcn, which is the second implementation of RooAbsMinimizerFcn after the good old RooMinimizerFcn. The unit test is disabled for now, but it should be enabled with the next PRs.

@guitargeek guitargeek merged commit 612b68e into root-project:master Jul 16, 2021
guitargeek pushed a commit that referenced this pull request Jul 16, 2021
From comments by @hageboeck on PR #8596 (#8596):

- Include reordering
- Camel case member function names
- Inline simple functions
guitargeek pushed a commit that referenced this pull request Jul 16, 2021
From comments by @guitargeek and @hageboeck on PR #8596 (#8596):

In RooMinimizer:
- Removed template parameter from RooMinimizer ctor.
- Remove dynamic_cast nullptr checks when FcnMode is already known.
- Also replace static with dynamic_casts when downcasting; fixes clang tidy warning.
- Fix compile warnings due to not returning anything at end of non-void function with switch statements.

Other places:
- In test_lib: remove Hex number printing class and reorder includes.
- Renamed test to testRooGradMinimizerFcn(.cxx) and cleaned up old commented out code.
@hahnjo
Copy link
Copy Markdown
Member

hahnjo commented Jul 16, 2021

Can you please squash future PRs if there are commits such as "apply review comments" and "fix compilation errors after rebase"? In particular the latter makes git bisect a lot less useful because you have to skip around broken commits...

@guitargeek
Copy link
Copy Markdown
Contributor

Sorry! Indeed it might have been appropriate to squash and rebase here.

egpbos added a commit to roofit-dev/root that referenced this pull request Jul 16, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR root-project#8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.
egpbos added a commit to roofit-dev/root that referenced this pull request Jul 16, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR root-project#8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.
egpbos added a commit to roofit-dev/root that referenced this pull request Jul 20, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR root-project#8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.

In addition, a compilation warning was produced by FunctorGradHandler, which shadowed the 5-parameter DoDerivative version. To silence the warning, we just add a five-parameter overload that forwards to the two-parameter one. To implement a full 5-parameter path in the Functor class hierarchy would require more work and discussion.
egpbos added a commit to roofit-dev/root that referenced this pull request Jul 20, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR root-project#8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.

In addition, compilation warnings were produced by overloads that shadowed the 5-parameter DoDerivative/Gradient overloads. To silence the warnings, we just add five-parameter overloads that forward to the two-parameter ones. To implement full 5-parameter paths everywhere would require more work and discussion.
egpbos added a commit to roofit-dev/root that referenced this pull request Jul 21, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR root-project#8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.

In addition, compilation warnings were produced by overloads that shadowed the 5-parameter DoDerivative/Gradient overloads. To silence the warnings, we just add five-parameter overloads that forward to the two-parameter ones. To implement full 5-parameter paths everywhere would require more work and discussion. Also some compilation errors on Windows fixed by using vectors instead of non-standard dynamic sized arrays.
egpbos added a commit to roofit-dev/root that referenced this pull request Aug 24, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR root-project#8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.

In addition, compilation warnings were produced by overloads that shadowed the 5-parameter DoDerivative/Gradient overloads. To silence the warnings, we just add five-parameter overloads that forward to the two-parameter ones. To implement full 5-parameter paths everywhere would require more work and discussion. Also some compilation errors on Windows fixed by using vectors instead of non-standard dynamic sized arrays.
pzhristov pushed a commit to alisw/root that referenced this pull request Aug 27, 2021
From comments by @hageboeck on PR root-project#8596 (root-project#8596):

- Include reordering
- Camel case member function names
- Inline simple functions
pzhristov pushed a commit to alisw/root that referenced this pull request Aug 27, 2021
From comments by @guitargeek and @hageboeck on PR root-project#8596 (root-project#8596):

In RooMinimizer:
- Removed template parameter from RooMinimizer ctor.
- Remove dynamic_cast nullptr checks when FcnMode is already known.
- Also replace static with dynamic_casts when downcasting; fixes clang tidy warning.
- Fix compile warnings due to not returning anything at end of non-void function with switch statements.

Other places:
- In test_lib: remove Hex number printing class and reorder includes.
- Renamed test to testRooGradMinimizerFcn(.cxx) and cleaned up old commented out code.
guitargeek pushed a commit that referenced this pull request Aug 31, 2021
Turns out the RooGradMinimizerFcn also still had a slight remaining bug, which was introduced by the "detemplatization" redesign of RooMinimizer in PR #8596. The problem was that the RooMinimizer ctor, which calls the RooGradMinimizerFcn ctor, which calls synchronizeGradientParameterSettings... called _context->getMultiGenFcn() (_context is the same RooMinimizer that is creating the RooGradMinimizerFcn at this point...) and that in turn tries to do a dynamic_cast on _fcn, which is going to be the RooGradMinimizerFcn after it has been assigned after construction, but this is still in progress at that point, so the dynamic_cast fails, since _fcn is still nullptr.

The fix was to remove a fortunately unused parameter in NumericalDerivator::SetInitialGradient, which removes the problematic _context->getMultiGenFcn() call.

In addition, compilation warnings were produced by overloads that shadowed the 5-parameter DoDerivative/Gradient overloads. To silence the warnings, we just add five-parameter overloads that forward to the two-parameter ones. To implement full 5-parameter paths everywhere would require more work and discussion. Also some compilation errors on Windows fixed by using vectors instead of non-standard dynamic sized arrays.
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.

6 participants