一句话:WayOut 通过静态头文件分析与运行时类型信息,自动为 C/C++ HPC 内核生成 Python 绑定层。
高性能内核(HPK)通常用 C/C++、Fortran 等静态类型语言编写,而科学家近年倾向用 Python 进行应用原型开发,这导致 Python 应用与现有 HPK 之间出现鸿沟:要么重新实现内核,要么手工编写连接层,均需大量开发努力。本文提出 WayOut,自动为从 Python 调用、用 C/C++ 编写的 HPK 生成完整连接层。WayOut 采用混合分析:静态分析头文件以生成 Python 包装类与函数,并动态生成这些内核的绑定;借助运行时可得类型信息,它只生成必要的绑定。作者将数十个现有 C/C++ 示例改写为 Python 并利用 WayOut 启用的 HPK 进行评估,实验表明该技术可行,且 HPK 性能开销可忽略。
Traditionally, high performance kernels (HPKs) have been written in statically typed languages, such as C/C++ and Fortran. A recent trend among scientists—prototyping applications in dynamic languages such as Python—created a gap between the applications and existing HPKs. Thus, scientists have to either reimplement necessary kernels or manually create a connection layer to leverage existing kernels. Either option requires substantial development effort and slows down progress in science. We present a technique, dubbed WayOut, which automatically generates the entire connection layer for HPKs invoked from Python and written in C/C++. WayOut performs a hybrid analysis: it statically analyzes header files to generate Python wrapper classes and functions, and dynamically generates bindings for those kernels. By leveraging the type information available at run-time, it generates only the necessary bindings. We evaluate WayOut by rewriting dozens of existing examples from C/C++ to Python and leveraging HPKs enabled by WayOut. Our experiments show the feasibility of our technique, as well as negligible performance overhead on HPKs performance.
DOI 原文 ·
@inproceedings{paperbot6620,
title = {Dynamic Generation of Python Bindings for HPC Kernels},
author = {Steven Zhu and Nader AlAwar and Mattan Erez and Milos Gligoric},
booktitle = {ASE},
year = {2021},
doi = {10.1109/ase51524.2021.9678726}
}