Ompparser: A Standalone and Unified OpenMP Parser

  • Anjia Wang
  • Yaying Shi
  • Xinyao Yi
  • Yonghong YanEmail author
  • Chunhua Liao
  • Bronis R. de Supinski
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11718)


OpenMP has been quickly evolving to meet the insatiable demand for productive parallel programming on high performance computing systems. Creating a robust and optimizing OpenMP compiler has become increasingly challenging due to the expanding capabilities and complexity of OpenMP, especially for its latest 5.0 release. Although OpenMP’s syntax and semantics are very similar between C/C++ and Fortran, the corresponding compiler support, such as parsing and lowering are often separately implemented, which is a significant obstacle to support the fast changing OpenMP specification. In this paper, we present the design and implementation of a standalone and unified OpenMP parser, named ompparser, for both C/C++ and Fortran. ompparser is designed to be useful both as an independent tool and an integral component of an OpenMP compiler. It can be used for syntax and semantics checking of OpenMP constructs, validating and verifying the usage of existing constructs, and helping to prototype new constructs. The formal grammar included in ompparser also helps interpretation of the OpenMP standard. The ompparser implementation supports the latest OpenMP 5.0, including complex directives such as metadirective. It is released as open-source from with a BSD-license. We also demonstrate how it is integrated with the ROSE’s open-source OpenMP compiler.


OpenMP Parser Intermediate representation Compiler 



This work was performed under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344, and supported by the U.S. Dept. of Energy, Office of Science, Advanced Scientific Computing Research (SC-21), under contract DE-AC02-06CH11357. LLNL-CONF-774801. This material is also based upon work supported by the National Science Foundation under Grant No. 1833332 and 1652732.


  1. 1.
    OpenMP Support in Clang/LLVM.
  2. 2.
    OpenMP Support in Flang/LLVM.
  3. 3.
    Antao, S.F., et al.: Offloading support for OpenMP in Clang and LLVM. In: Proceedings of the Third Workshop on LLVM Compiler Infrastructure in HPC, pp. 1–11 (2016)Google Scholar
  4. 4.
    Hayashi, A., Shirako, J., Tiotto, E., Ho, R., Sarkar, V.: Exploring compiler optimization opportunities for the OpenMP 4.x accelerator model on a POWER8+GPU platform. In: Proceedings of the Third International Workshop on Accelerator Programming Using Directives, WACCPD 2016, pp. 68–78. IEEE Press, Piscataway (2016).
  5. 5.
    Leontiadis, I., Tzoumas, G.: OpenMP C Parser, December 2001Google Scholar
  6. 6.
    Liao, C., Quinlan, D.J., Panas, T., de Supinski, B.R.: A ROSE-based OpenMP 3.0 research compiler supporting multiple runtime libraries. In: Sato, M., Hanawa, T., Müller, M.S., Chapman, B.M., de Supinski, B.R. (eds.) IWOMP 2010. LNCS, vol. 6132, pp. 15–28. Springer, Heidelberg (2010). Scholar
  7. 7.
    Liao, C., Yan, Y., de Supinski, B.R., Quinlan, D.J., Chapman, B.: Early experiences with the OpenMP accelerator model. In: Rendell, A.P., Chapman, B.M., Müller, M.S. (eds.) IWOMP 2013. LNCS, vol. 8122, pp. 84–98. Springer, Heidelberg (2013). Scholar
  8. 8.
    Novillo, D.: OpenMP and automatic parallelization in GCC. In: In the Proceedings of the GCC Developers (2006)Google Scholar
  9. 9.
    Ozen, G., Atzeni, S., Wolfe, M., Southwell, A., Klimowicz, G.: OpenMP GPU offload in Flang and LLVM. In: LLVM-HPC2018: The Fifth Workshop on the LLVM Compiler Infrastructure in HPC, pp. 1–9, November 2018Google Scholar
  10. 10.
    de Supinski, B.R., et al.: The ongoing evolution of OpenMP. Proc. IEEE 106(11), 2004–2019 (2018)CrossRefGoogle Scholar
  11. 11.
    Tian, X., et al.: LLVM framework and IR extensions for parallelization, SIMD vectorization and offloading. In: Third Workshop on the LLVM Compiler Infrastructure in HPC, LLVM-HPC@SC 2016, Salt Lake City, UT, USA, 14 November 2016, pp. 21–31 (2016).

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Anjia Wang
    • 1
  • Yaying Shi
    • 1
  • Xinyao Yi
    • 1
  • Yonghong Yan
    • 1
    Email author
  • Chunhua Liao
    • 2
  • Bronis R. de Supinski
    • 2
  1. 1.University of South CarolinaColumbiaUSA
  2. 2.Lawrence Livermore National LaboratoryLivermoreUSA

Personalised recommendations