arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2107.00064cs.PLcs.PF
收藏

Python与本机库之间的高效交互

Toward Efficient Interactions between Python and Native Libraries

Jialiang Tan, Yu Chen, Zhenming Liu, Bin Ren, Shuaiwen Leon Song, Xipeng Shen, Xu Liu

摘要:

Python由于其优秀的可编程性而成为一种流行的程序设计语言。许多现代软件包利用Python进行高级算法设计,并依赖于用C/C++/Fortran编写的本机库来实现高效的计算内核。Python代码和本机库之间的交互会导致性能损失,因为抽象位于Python和本机库的边界上。一方面,Python代码通常与解释一起运行,与其执行行为是不相交的。另一方面,本机库不包括程序语义来理解算法缺陷。为了理解交互效率低下,我们广泛研究了大量Python软件包,并根据效率低下的根本原因对它们进行了分类。我们提取了两个低效率的模式,是常见的交互效率低下。基于这些模式,我们开发了PieProf,一个轻量级的分析器,以查明Python应用程序中的交互效率低下。PieProf的原理是测量本机执行中的低效率,并将低效率与高级Python代码相关联,以提供整体视图。在PieProf的指导下,我们优化了17个实际应用程序,在应用程序级上产生了高达6.3 $\times$的加速比。

英文摘要:

Python has become a popular programming language because of its excellent programmability. Many modern software packages utilize Python for high-level algorithm design and depend on native libraries written in C/C++/Fortran for efficient computation kernels. Interaction between Python code and native libraries introduces performance losses because of the abstraction lying on the boundary of Python and native libraries. On the one side, Python code, typically run with interpretation, is disjoint from its execution behavior. On the other side, native libraries do not include program semantics to understand algorithm defects. To understand the interaction inefficiencies, we extensively study a large collection of Python software packages and categorize them according to the root causes of inefficiencies. We extract two inefficiency patterns that are common in interaction inefficiencies. Based on these patterns, we develop PieProf, a lightweight profiler, to pinpoint interaction inefficiencies in Python applications. The principle of PieProf is to measure the inefficiencies in the native execution and associate inefficiencies with high-level Python code to provide a holistic view. Guided by PieProf, we optimize 17 real-world applications, yielding speedups up to 6.3$\times$ on application level.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑