Expressing and Applying C++ Code Transformations for the HDF5 API Through a DSL

  • Martin GolasowskiEmail author
  • João Bispo
  • Jan Martinovič
  • Kateřina Slaninová
  • João M. P. CardosoEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10244)


Hierarchical Data Format (HDF5) is a popular binary storage solution in high performance computing (HPC) and other scientific fields. It has bindings for many popular programming languages, including C++, which is widely used in the HPC field. Its C++ API requires mapping of the native C++ data types to types native to the HDF5 API. This task can be error prone, especially when working with complex data structures, which are usually stored using HDF5 compound data types. Due to the lack of a comprehensive reflection mechanism in C++, the mapping code for data manipulation has to be hand-written for each compound type separately. This approach is vulnerable to bugs and mistakes, which can be eliminated by using an automated code generation phase. In this paper we present an approach implemented in the LARA language and supported by the tool Clava, which allows us to automate the generation of the HDF5 data access code for complex data structures in C++.


HDF5 Domain specific language LARA Source-to-source Aspect oriented Clava Code generation 



This work has been partially funded by ANTAREX, a project supported by the EU H2020 FET-HPC program under grant 671623, by The Ministry of Education, Youth and Sports of the Czech Republic from the National Programme of Sustainability (NPU II) project “IT4Innovations excellence in science - LQ1602” and by grant of SGS No. SP2017/177 “Optimization of machine learning algorithms for the HPC platform”, VŠB-Technical University of Ostrava, Czech Republic.


  1. 1.
    Clang. Accessed 28 Feb 2017
  2. 2.
  3. 3.
    Bispo, J.: Clava: C++ language + lara weaver and code transformer - antarex technical report v0.1. (2017)Google Scholar
  4. 4.
    Bispo, J., Cardoso, J.M.: A matlab subset to c compiler targeting embedded systems. Soft. Pract. Exp. 47(2), 249–272 (2017)CrossRefGoogle Scholar
  5. 5.
    Blanchette, J., Summerfield, M.: C++ GUI Programming with Qt 4. Prentice Hall Professional, Upper Saddle River (2006)Google Scholar
  6. 6.
    Bravenboer, M., Kalleberg, K.T., Vermaas, R., Visser, E.: Stratego/xt 0.17. a language and toolset for program transformation. Sci. Comput. Program. 72(1–2), 52–70 (2008)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Cardoso, J.M.P., Carvalho, T., Coutinho, J.G.F., Luk, W., Nobre, R., Diniz, P., Petrov, Z.: Lara: an aspect-oriented programming language for embedded systems. In: Proceedings of the 11th Annual International Conference on AOP Software Development, pp. 179–190. ACM (2012)Google Scholar
  8. 8.
    Chochlık, M.: Implementing the factory pattern with the help of reflection. Comput. Inf. 35(3), 653–686 (2016)Google Scholar
  9. 9.
    Folk, M., Heber, G., Koziol, Q., Pourmal, E., Robinson, D.: An overview of the hdf5 technology suite and its applications. In: Proceedings of the EDBT/ICDT 2011 Workshop on Array Databases, pp. 36–47. ACM (2011)Google Scholar
  10. 10.
    Gradecki, J.D., Lesiecki, N.: Mastering AspectJ: Aspect-Oriented Programming in Java. Wiley, New York (2003)Google Scholar
  11. 11.
    Klint, P., Van Der Storm, T., Vinju, J.: Rascal: a domain specific language for source code analysis and manipulation. In: Source Code Analysis and Manipulation 2009, SCAM 2009, pp. 168–177. IEEE (2009)Google Scholar
  12. 12.
    Pinto, P., Carvalho, T., Bispo, J., Cardoso, J.M.: Lara as a language-independent aspect-oriented programming approach. In: Proceedings of the 32th Annual ACM Symposium on Applied Computing. ACM (2017, to appear)Google Scholar
  13. 13.
    Qt: Qt documentation. Accessed Feb 2017
  14. 14.
    Spinczyk, O., Gal, A., Schröder-Preikschat, W.: Aspectc++: an aspect-oriented extension to the c++ programming language. In: Proceedings of the 14th International Conference on Tools Pacific, CRPIT 2002, Darlinghurst, Australia, pp. 53–60 (2002)Google Scholar

Copyright information

© IFIP International Federation for Information Processing 2017

Authors and Affiliations

  1. 1.IT4InnovationsVŠB - Technical University of OstravaOstravaCzech Republic
  2. 2.Faculdade de Engenharia da Universidade do PortoPortoPortugal

Personalised recommendations