【24h】

OP2-Clang: A Source-to-Source Translator Using Clang/LLVM LibTooling

机译:OP2-Clang:使用Clang / LLVM LibTooling的源到源转换器

获取原文

摘要

Domain Specific Languages or Active Library frameworks have recently emerged as an important method for gaining performance portability, where an application can be efficiently executed on a wide range of HPC architectures without significant manual modifications. Embedded DSLs such as OP2, provides an API embedded in general purpose languages such as C/C++/Fortran. They rely on source- to-source translation and code refactorization to translate the higher-level API calls to platform specific parallel implementations. OP2 targets the solution of unstructured-mesh computations, where it can generate a variety of parallel implementations for execution on architectures such as CPUs, GPUs, distributed memory clusters and heterogeneous processors making use of a wide range of platform specific optimizations. Compiler tool-chains supporting source-to-source translation of code written in mainstream languages currently lack the capabilities to carry out such wide-ranging code transformations. Clang/LLVM's *The following names are subject to trademark: LLVM™, CLANG™, NVIDIA™, P100™, CUDA™, INTEL™, Tooling library (LibTooling) has long been touted as having such capabilities but have only demonstrated its use in simple source refactoring tasks. In this paper we introduce OP2-Clang, a source-to-source translator based on LibTooling, for OP2's C/C++ API, capable of generating target parallel code based on SIMD, OpenMP, CUDA and their combinations with MPI. OP2-Clang is designed to significantly reduce maintenance, particularly making it easy to be extended to generate new parallelizations and optimizations for hardware platforms. In this research, we demonstrate its capabilities including (1) the use of LibTooling's AST matchers together with a simple strategy that use parallelization templates or skeletons to significantly reduce the complexity of generating radically different and transformed target code and (2) chart the challenges and solution to generating optimized parallelizations for OpenMP, SIMD and CUDA. Results indicate that OP2-Clang produces near-identical parallel code to that of OP2's current source-to-source translator. We believe that the lessons learnt in OP2-Clang can be readily applied to developing other similar source-to-source translators, particularly for DSLs.
机译:域特定语言或活动库框架最近已成为获得性能可移植性的一种重要方法,该方法可以在广泛的HPC体系结构上有效执行应用程序,而无需进行大量的手动修改。 OP2等嵌入式DSL提供以通用语言(例如C / C ++ / Fortran)嵌入的API。他们依靠源到源转换和代码重构将高层API调用转换为平台特定的并行实现。 OP2的目标是非结构化网格计算的解决方案,它可以生成各种并行实现,以利用各种平台特定的优化在诸如CPU,GPU,分布式内存集群和异构处理器之类的体系结构上执行。目前,支持主流语言编写的代码的源代码到源代码翻译的编译器工具链缺乏执行如此广泛的代码转换的能力。 Clang / LLVM的*以下名称带有商标名称:LLVM™,CLANG™,NVIDIA™,P100™,CUDA™,INTEL™,工具库(LibTooling)长期以来被吹捧为具有此类功能,但仅在以下情况下证明了其用途简单的源重构任务。在本文中,我们介绍OP2-Clang,这是一种基于LibTooling的源到源转换器,用于OP2的C / C ++ API,它能够基于SIMD,OpenMP,CUDA及其与MPI的组合生成目标并行代码。 OP2-Clang旨在显着减少维护,特别是使其易于扩展以生成新的并行化和针对硬件平台的优化。在这项研究中,我们展示了其功能,包括(1)使用LibTooling的AST匹配器以及使用并行化模板或框架来显着降低生成根本不同的和经过转换的目标代码的复杂性的简单策略,以及(2)绘制挑战和为OpenMP,SIMD和CUDA生成优化的并行化的解决方案。结果表明,OP2-Clang与OP2当前的源到源转换器产生的并行代码几乎相同。我们相信,在OP2-Clang中吸取的教训可以轻松地用于开发其他类似的源到源转换器,尤其是DSL。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号