Optimizing Frameworks' Performance Using C++ Modules

Optimizing Frameworks' Performance Using C++ Modules

CHEP 2018, Sofia, Bulgaria Optimizing Frameworks’ Performance Using C++ Modules-Aware ROOT Yuka Takahashi, Vassil Vassilev, Raphael Isemann yuka.takahashi, vvasilev, raphael.isemann @cern.ch 1. Introduction PCH files are precompiled header files and ever, with modules, we can automatically We will present our results and challenges work similar to C++ modules. The advan- resolve symbols and cases like those are with C++ modules in ROOT. ROOT was ex- tage of modules over PCH is that they can now correctly handled. be used by experiments. Experiments are tended with experimental support for using 6. Implementation C++ modules during runtime, with aims to still using textual includes as PCH only cov- reduce it’s memory usage and improve its ers ROOT. PCH cannot be exported to ex- correctness. periments because of various technical limi- tations. 2. C++ Modules in a Nutshell • Header information is stored in precom- 5. Results piled PCM files 5.1 Perfomance • No more header parsing during ROOT’s runtime In C/C++, the interface of a library is ac- cessed by including the appropriate header files: # include < s t d i o . h> Figure 5: Visualization of ROOT interpreter These textual includes cause well-known core. problems: As shown in Fig.5, we are developing • Compile-time scalability: #include is and using LLVM/Clang implementation of copying the contents to the includer’s C++ modules, collaborating with develop- code, so the parser has to reparse the ers from Google and Apple. Cling is a C++ same common header files multiple times, interpreter developed by CERN, and root- which is expensive. cling is a dictionary generator for ROOT. We • Fragility: Textual includes are influenced Figure 3: CPU Time required to run se- are implementing runtime modules in these by previously defined macros. For ex- lected tutorials. The first column is display- parts while integrating ROOT with them. ample, macro PI is #defined in Rcpp li- ing ROOT’s time to start into an empty shell. brary. Including this library while using 7. Roadmap local variable PI will end up in a redefini- • Compile ROOT with C++ modules tion error. Status: Completed C++ modules is a mechanism to boost com- • Compile CMSSW with C++ modules pilation time by precompiling headers into Status: Work in progress PCM files, where AST information can be • Use runtime C++ modules in ROOT lazily loaded. Status: Mostly Done 3. From C++ Modules to Runtime C++ • Use runtime C++ modules in experiments Modules Status: Work in progress To summarize, runtime modules are mostly working, but need work to get bet- ter performance. Figure 4: Residential memory used to run 8. Conclusion tutorials. Here we briefly introduced our experimen- Figure 1: Runtime Modules (pcms). Each Fig.3 and Fig.4 are the performance re- tal runtime C++ modules support in ROOT PCM file (E.g. Core.pcm) corresponds to a sults we receive from modules, compared and how it will affect experiments’ software library (E.g. libCore.so). to textual headers. The results are coming stacks. Modules are not yet competent com- from synthetic benchmarks close to the ex- C++ modules are able to reduce compi- pared to PCH, but are more flexible and periment software stacks and in particular lation times. However, the compilation have clear advantage over texual includes. CMSSW. scalability issues in C/C++ becomes run- 9. Future work 5.2 Correctness time issues for an interpretative environ- Runtime modules are still an experimental ment which ROOT provides. They span PCH: feature. Our ultimate goal is to make it de- from slow prompt to slow IO. $ bin/root.exe −l fault in ROOT and in experiments: root [0] gMinuit 4. Advantages over the Status Quo IncrementalExecutor :: executeFunction : • Stabilize modules behavior and tests symbol ’gMinuit’ unresolved while • Adoption by experiments and other ROOT linking [cling interface function]! users Runtime Modules: • Improve performance of loading modules $ bin/root.exe −l root [0] gMinuit Further Information ( TMinuit ) n u l l p t r * • https://clang.llvm.org/docs/Modules.html Runtime Modules are supporting more • https://root.cern.ch/ features than PCH. For example, gMinuit • https://root.cern.ch/cling Figure 2: Precompiled Headers (PCH). In- is an extern variable which cannot be au- formation of the header is stored in one file. toloaded by ROOT at the moment. How-.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us