Expressing and Applying C++ Code Transformations for the HDF5 API Through a DSL
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++.
KeywordsHDF5 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.Clang. clang.llvm.org. Accessed 28 Feb 2017
- 2.Unreal engine documentation. https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/index.html
- 3.Bispo, J.: Clava: C++ language + lara weaver and code transformer - antarex technical report v0.1. (2017)Google Scholar
- 5.Blanchette, J., Summerfield, M.: C++ GUI Programming with Qt 4. Prentice Hall Professional, Upper Saddle River (2006)Google Scholar
- 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.Chochlık, M.: Implementing the factory pattern with the help of reflection. Comput. Inf. 35(3), 653–686 (2016)Google Scholar
- 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.Gradecki, J.D., Lesiecki, N.: Mastering AspectJ: Aspect-Oriented Programming in Java. Wiley, New York (2003)Google Scholar
- 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.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.Qt: Qt documentation. http://doc.qt.io/qt-5/why-moc.html. Accessed Feb 2017
- 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