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

学习在共享内存环境中使用Transformers进行并行化

Learning to Parallelize in a Shared-Memory Environment with Transformers

Ben-Gurion University of the Negev(内盖夫本-古里安大学);Nuclear Research Center – Negev(内盖夫核研究中心);Technion – Israel Institute of Technology(以色列理工学院)

Re'em Harel, Yuval Pinter, Gal Oren

摘要:

在过去的几年里,世界已经转向众核和多核共享内存架构。因此,越来越需要通过将共享存储器并行化方案引入到软件应用程序来利用这些架构。OpenMP是实现此类方案的最全面的API,其特点是具有可读接口。然而,由于并行共享内存管理中普遍存在的缺陷,将OpenMP引入代码具有挑战性。为了促进此任务的性能,多年来已经创建了许多源到源(S2 S)编译器,其任务是将OpenMP指令自动插入代码中。除了对输入格式的鲁棒性有限之外,这些编译器在定位可并行化代码和生成适当的指令方面仍然没有达到令人满意的覆盖率和精度。在这项工作中,我们建议利用ML技术的最新进展,特别是在自然语言处理(NLP)中,完全取代S2 S编译器。我们创建了一个数据库(语料库),Open-OMP,专门为这个目标。Open-OMP包含超过28,000个代码片段,其中一半包含OpenMP指令,而另一半完全不需要并行化。我们使用该语料库来训练系统,以自动对需要并行化的代码段进行分类,并建议各个OpenMP条款。我们训练几个Transformer模型,命名为PragFormer,这些任务,并表明,他们优于训练的基线和自动S2 S并行编译器在分类的总体需求的一个OpenMP指令和引入私有和减少条款。我们的源代码和数据库可以在https://github.com/Scientific-Computing-Lab-NRCN/PragFormer上找到。

英文摘要:

In past years, the world has switched to many-core and multi-core shared memory architectures. As a result, there is a growing need to utilize these architectures by introducing shared memory parallelization schemes to software applications. OpenMP is the most comprehensive API that implements such schemes, characterized by a readable interface. Nevertheless, introducing OpenMP into code is challenging due to pervasive pitfalls in management of parallel shared memory. To facilitate the performance of this task, many source-to-source (S2S) compilers have been created over the years, tasked with inserting OpenMP directives into code automatically. In addition to having limited robustness to their input format, these compilers still do not achieve satisfactory coverage and precision in locating parallelizable code and generating appropriate directives. In this work, we propose leveraging recent advances in ML techniques, specifically in natural language processing (NLP), to replace S2S compilers altogether. We create a database (corpus), Open-OMP, specifically for this goal. Open-OMP contains over 28,000 code snippets, half of which contain OpenMP directives while the other half do not need parallelization at all with high probability. We use the corpus to train systems to automatically classify code segments in need of parallelization, as well as suggest individual OpenMP clauses. We train several transformer models, named PragFormer, for these tasks, and show that they outperform statistically-trained baselines and automatic S2S parallelization compilers in both classifying the overall need for an OpenMP directive and the introduction of private and reduction clauses. Our source code and database are available at: https://github.com/Scientific-Computing-Lab-NRCN/PragFormer.

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

↑