accparser: A Standalone OpenACC Parser and Its Usage on Mapping OpenACC to OpenMP Directives
摘要
Heterogeneous computing with accelerators has emerged as an effective approach to high-performance computing. Directive-based programming models such as OpenMP and OpenACC simplify parallel programming for GPU accelerators by enabling compilers to translate directive-annotated code into GPU-optimized code automatically. This paper presents accparser, a standalone and unified OpenACC parser built using ANTLR 4. Designed for both C/C++ and Fortran, accparser provides a complete grammar for OpenACC 3.3, making it a valuable tool for compiler developers who aim to implement OpenACC program transformations and code generation. It supports the syntax and semantic verification of OpenACC constructs and helps to interpret the OpenACC standard. Additionally, it can be leveraged as a tool to assist in creating compiler passes that convert OpenACC programs into OpenMP programs, enabling full utilization of OpenMP’s compiler optimizations and runtime support. The source code for accparser is available under the 2-Clause BSD License at https://github.com/passlab/accparser .