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

[cxxmodules] Fix failing runtime_cxxmodules tests by preloading modules #1814

Merged
merged 1 commit into from May 18, 2018

Conversation

yamaguchi1024
Copy link
Contributor

@yamaguchi1024 yamaguchi1024 commented Apr 3, 2018

Currently, 36 tests are failing for runtime modules:
https://epsft-jenkins.cern.ch/view/ROOT/job/root-nightly-runtime-cxxmodules/
We want to make these test pass so that we can say that the runtime modules is
finally working.

This patch enables ROOT to preload all modules at startup time. In my
environment, this patch fixes 14 tests for runtime cxxmodules.

Preloading all the modules has several advantages. 1. We do not have to
rely on rootmap files which don't support some features (namespaces and
templates) 2. Lookup would be faster because we don't have to do
trampoline via rootmap files.

The only disadvantage of preloading all the modules is the startup time performance.
root.exe -q -l memory.C
This is a release build without modules:

 cpu  time = 0.091694 seconds
 sys  time = 0.026187 seconds
 res  memory = 133.008 Mbytes
 vir  memory = 217.742 Mbytes

This is a release build with modules, with this patch:

 cpu  time = 0.234134 seconds
 sys  time = 0.066774 seconds
 res  memory = 275.301 Mbytes
 vir  memory = 491.832 Mbytes

As you can see, preloading all the modules makes both time and memory 2
to 3 times worse at a startup time.

Edit : With hsimple.C
root.exe -l -b tutorials/hsimple.C -q ~/CERN/ROOT/memory.C
Release build without modules:

Processing tutorials/hsimple.C...                                                                        
hsimple   : Real Time =   0.04 seconds Cpu Time =   0.05 seconds                        
(TFile *) 0x555ae2a9d560                                                                  
Processing /home/yuka/CERN/ROOT/memory.C...                                                              
 cpu  time = 0.173591 seconds                                   
 sys  time = 0.011835 seconds                       
 res  memory = 135.32 Mbytes                                    
 vir  memory = 209.664 Mbytes 

Release build with modules, with this patch:

Processing tutorials/hsimple.C...
hsimple   : Real Time =   0.04 seconds Cpu Time =   0.04 seconds
(TFile *) 0x55d1b036d230
Processing /home/yuka/CERN/ROOT/memory.C...
 cpu  time = 0.290742 seconds
 sys  time = 0.043851 seconds
 res  memory = 256.844 Mbytes
 vir  memory = 438.484 Mbytes

However, it is a matter of course that we get slower startup time if we
try to load all the modules at startup time, not on-demand. I haven't had a good benchmark for this but, in theory, it reduces execution time instead as we're anyway loading modules after the startup.

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=on

@@ -1258,7 +1274,32 @@ TCling::TCling(const char *name, const char *title)
// Load libc and stl first.
LoadModules({"libc", "stl"}, *fInterpreter);

LoadModules({"ROOT_Foundation_C", "ROOT_Config", "ROOT_Foundation_Stage1_NoRTTI", "Core", "RIO"}, *fInterpreter);
// Load core modules
std::vector<std::string> CoreModules = {"ROOT_Foundation_C","ROOT_Config","ROOT_Foundation_Stage1_NoRTTI", "Core", "RIO"};
Copy link
Member

Choose a reason for hiding this comment

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

Maybe that'd be better being a std::set<const char*>?

if (!ModuleName.empty() && std::find(CoreModules.begin(), CoreModules.end(), ModuleName) == CoreModules.end()) {
if (M->IsSystem && !M->IsMissingRequirement)
LoadModule(ModuleName, *fInterpreter);
else if (!M->IsSystem && !M->IsMissingRequirement)
Copy link
Member

Choose a reason for hiding this comment

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

We should check for filenames, i.e. if the module is present on disk as a pcm file.

LoadModules(CoreModules, *fInterpreter);

// Otherwise module conflicts between rootcling and root
if (!fromRootCling) {
Copy link
Member

Choose a reason for hiding this comment

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

This check can likely go away if we check if the module is already built (i.e. if it has an on-disk representing pcm). This way rootcling will become more efficient by building a module, while reusing the previously build ones.

@vgvassilev
Copy link
Member

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=on

1 similar comment
@vgvassilev
Copy link
Member

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=on

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=on
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc62.
See console output.

Errors:

  • 299/1675 Test Master tmva gsoc2016 #180: tutorial-benchmarks ...............................................................................***Failed Error regular expression found in output. Regex=[: error:] 66.76 sec
  • 433/1675 Test [RooFit] Add missing 'add' functions to RooArgSet. #325: tutorial-graphics-tornado .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 2.94 sec
  • 470/1675 Test Add a chunking interface to TProcessExecutor #364: tutorial-hist-ContourList .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 3.27 sec
  • 684/1675 Test C++17 fixes #591: tutorial-roostats-HybridInstructional .............................................................***Failed Error regular expression found in output. Regex=[: error:] 4.91 sec
  • 686/1675 Test Add support for LZ4 in classic build #593: tutorial-roostats-HybridStandardForm ..............................................................***Failed Error regular expression found in output. Regex=[: error:] 4.06 sec

Failing tests:

And 86 more

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=on
How to customize builds

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=on

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=on
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc62.
See console output.

Errors:

  • 298/1675 Test Documentation fixes fixes #184: tutorial-dataframe-tdf002_dataModel ...............................................................***Failed Error regular expression found in output. Regex=[: error:] 9.81 sec
  • 304/1675 Test Force ON LLVM_ENABLE_CXX1Y when cxx14 is enabled. #195: tutorial-dataframe-tdf013_InspectAnalysis .........................................................***Failed Error regular expression found in output. Regex=[: error:] 0.52 sec
  • 308/1675 Test First GPU implementation of DNNs. #199: tutorial-dataframe-tdf017_vecOpsHEP ...............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.24 sec
  • 560/1675 Test Fix ABI compability when linking against OCCI when using clang. #460: tutorial-math-quasirandom .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.12 sec
  • 586/1675 Test [WIP] Allow hadd to run in multiprocess mode #491: tutorial-multicore-mtbb201_parallelHistoFill ......................................................***Failed Error regular expression found in output. Regex=[: error:] 2.99 sec
  • 702/1675 Test TMVA various fixes #610: tutorial-roostats-Zbi_Zgamma ......................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.15 sec
  • 714/1675 Test Extend TCanvasImp interface #622: tutorial-roostats-rs_numbercountingutils ..........................................................***Failed Error regular expression found in output. Regex=[: error:] 1.23 sec
  • 796/1675 Test Updated gitignore for QtCreator files. #715: tutorial-dataframe-tdf002_dataModel-py ............................................................***Failed Error regular expression found in output. Regex=[: error:] 0.92 sec

Failing tests:

And 32 more

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=on
How to customize builds

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=On

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=On
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc62.
See console output.

Errors:

  • 299/1675 Test Master tmva gsoc2016 #180: tutorial-benchmarks ...............................................................................***Failed Error regular expression found in output. Regex=[: error:] 21.54 sec
  • 433/1675 Test [RooFit] Add missing 'add' functions to RooArgSet. #325: tutorial-graphics-tornado .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.20 sec
  • 473/1675 Test Add a chunking interface to TProcessExecutor #364: tutorial-hist-ContourList .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.50 sec
  • 684/1675 Test C++17 fixes #591: tutorial-roostats-HybridInstructional .............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.55 sec
  • 687/1675 Test Add support for LZ4 in classic build #593: tutorial-roostats-HybridStandardForm ..............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.76 sec

Failing tests:

And 84 more

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=On -DCMAKE_BUILD_TYPE=Release

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=On -DCMAKE_BUILD_TYPE=Release
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc62.
See console output.

Errors:

  • 301/1677 Test Master tmva gsoc2016 #180: tutorial-benchmarks ...............................................................................***Failed Error regular expression found in output. Regex=[: error:] 14.37 sec
  • 434/1677 Test [RooFit] Add missing 'add' functions to RooArgSet. #325: tutorial-graphics-tornado .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.43 sec
  • 470/1677 Test Add a chunking interface to TProcessExecutor #364: tutorial-hist-ContourList .........................................................................***Failed Error regular expression found in output. Regex=[: error:] 1.01 sec
  • 684/1677 Test C++17 fixes #591: tutorial-roostats-HybridInstructional .............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.34 sec
  • 688/1677 Test Add support for LZ4 in classic build #593: tutorial-roostats-HybridStandardForm ..............................................................***Failed Error regular expression found in output. Regex=[: error:] 1.19 sec

Failing tests:

And 84 more

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=On -DCMAKE_BUILD_TYPE=Release
How to customize builds

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -Druntime_cxxmodules=On -Dctest_test_exclude_none=On

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -Druntime_cxxmodules=On -Dctest_test_exclude_none=On
How to customize builds

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -DLLVM_BUILD_TYPE=Debug -Droofit=Off -Druntime_cxxmodules=On -DCMAKE_VERBOSE_MAKEFILE:BOOL=On -Dctest_test_exclude_none=On

@phsft-bot
Copy link
Collaborator

Starting build on slc6/gcc62 with flags -Dvc=OFF -Dimt=ON -Dccache=ON -DLLVM_BUILD_TYPE=Debug -Droofit=Off -Druntime_cxxmodules=On BOOL=On -Dctest_test_exclude_none=On
How to customize builds

@yamaguchi1024
Copy link
Contributor Author

@phsft-bot build just on slc6/gcc62 with flags -DLLVM_BUILD_TYPE=Debug -Droofit=Off -Druntime_cxxmodules=On -DCMAKE_VERBOSE_MAKEFILE:BOOL=On -Dctest_test_exclude_none=On

@phsft-bot
Copy link
Collaborator

Starting build on slc6/clang39, slc6/gcc48, slc6/gcc48, slc6/gcc49, slc6/gcc52, centos7/gcc62, centos7/gcc7, centos7/gcc7, ubuntu16/native, mac1013/native, windows10/vc15 with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on ubuntu16/native.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on centos7/gcc7.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on centos7/gcc62.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc48.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on centos7/gcc7.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc52.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc49.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc48.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/clang39.
See console output.

Warnings:

  • ../root/core/metacling/src/TCling.cxx:1307:11: warning: suggest braces around initialization of subobject [-Wmissing-braces]

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on mac1013/native.
See console output.

Warnings:

  • /Volumes/HD2/build/jenkins/workspace/root-pullrequests-build/root/core/metacling/src/TCling.cxx:1307:11: warning: suggest braces around initialization of subobject [-Wmissing-braces]

Failing tests:

…ized decls

Preloading all the modules has several advantages. 1. We do not have to
rely on rootmap files which don't support some features (namespaces and
templates) 2. Lookup would be faster because we don't have to do
trampoline via rootmap files.

Autoloading libraries when decls are deserialized gives us correctness.
However we still need to optimize the performance by reducing the amount
of loaded libraries and improving Clang performance.
@phsft-bot
Copy link
Collaborator

Starting build on slc6/clang39, slc6/gcc48, slc6/gcc48, slc6/gcc49, slc6/gcc52, centos7/gcc62, centos7/gcc7, centos7/gcc7, ubuntu16/native, mac1013/native, windows10/vc15 with flags -Dvc=OFF -Dimt=ON -Dccache=ON
How to customize builds

@phsft-bot
Copy link
Collaborator

Build failed on ubuntu16/native.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on centos7/gcc7.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on centos7/gcc62.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc48.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/clang39.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc52.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on mac1013/native.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc48.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on slc6/gcc49.
See console output.

Failing tests:

@phsft-bot
Copy link
Collaborator

Build failed on centos7/gcc7.
See console output.

Failing tests:

Copy link
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM!

@vgvassilev vgvassilev merged commit 180c3a8 into root-project:master May 18, 2018
@yamaguchi1024 yamaguchi1024 deleted the allmodules branch May 18, 2018 08:25
@pcanal
Copy link
Member

pcanal commented May 21, 2018

Could a comment be added here on why the failure "projectroot.roottest.root.meta.roottest_root_meta_execUnloading_auto" does not prevent merging? (i.e. what is the plan to resolve it (upcoming fix in ROOT or ROOTTEST or revert this PR or something else?) ... in the meantime this will show up in all master builds including new PRs ... )

@pcanal
Copy link
Member

pcanal commented May 21, 2018

To answer my own question:

The test needed to be updated and was updated by root-project/roottest#180.

Several PR and incremental failed due to the (unavoidable) lag between this PR being merged in and the roottest PR being merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants