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.
翻译:过去几年来,世界已经转向了多个核心和多核心共享的记忆架构。 因此,越来越需要利用这些架构,在软件应用程序中引入共享的记忆平行机制。 OpenMP是实施此类机制的最全面的API,其特点是可读界面。然而,由于在管理平行共享记忆的过程中普遍存在缺陷,将OpenMP引入代码具有挑战性。为了便利这一任务的执行,多年来创建了许多源到源(S2S)编集器,任务是自动将 OpenMP 指令插入代码中。除了其输入格式的强度有限外,这些编译器在查找平行代码和生成适当指令方面仍然没有达到令人满意的覆盖范围和准确性。在这项工作中,我们提议利用ML技术的最新进展,特别是在自然语言处理(NLP)中,来完全取代S2S2S编集。我们专门为此创建了一个数据库(corpusus)、Opreal-OMP(Oral-Oral-complets) 。 Open-OMP 包含超过28 源, 其中一半含有 Open 指令,而另一半则不需要同步的版本,S transal-ral-ral-ral-ral 将S 解算,我们需要一个高级的解算系统,我们用于所有的解算系统。我们使用一个高级的解算系统,我们需要一个高的解算。我们用于。