陳俊良Chen, Chuen-Liang臺灣大學:資訊工程學研究所許書瑋Hsu, Shu-WeiShu-WeiHsu2010-06-092018-07-052010-06-092018-07-052009U0001-1201200923380300http://ntur.lib.ntu.edu.tw//handle/246246/185367儘管OpenMP API提供了比POSIX threads函式庫更方便使用的方法將程式平行化,程式設計師仍需付出心力將OpenMP directives安插到程式碼內,並設定變數的分享屬性。在本篇論文中,我們設計一個系統用來將這些工作量由程式設計師移至編譯器來負擔。由於GCC是一個開放程式碼的編譯器並且支援OpenMP,所以我們使用GCC做為系統實作以及評估的平臺。開始我們先了解OpenMP directives以及data sharing attribute clauses的功能以及其限制,之後再了解GCC是如何處理OpenMP directives以及data sharing attribute clauses。最後使用這些資訊以發展出一組條件用來分類變數的分享屬性,以及安插OpenMP directives的步驟。Although the OpenMP API provides a more convenient way for parallel programming than POSIX threads library, the programmer still has the workload to insert the OpenMP directives and data-sharing attribute clauses. In this thesis, we design a system which moves the workload of OpenMP programming from the programmer to the compiler. We use GCC compiler as our implementation and evaluation platform, because GCC is an open source compiler and it supports OpenMP.e first study the functionality and restriction of the OpenMP directives and data sharing attribute clauses. After that, we study the GCC compiler source code to learn how the GCC handles these directives and clauses. Finally, we use these information to development the conditions of the data sharing attribute classification and the procedure of OpenMP directives insertion.Acknowledge ii文摘要 iiibstract ivable of Contents vist of Figures viiiist of Tables xhapter 1 Introduction 1.1 Motivation 1.2 Related Research 2.3 Thesis Organization 3hapter 2 OpenMP Overview 5.1 Shared-Memory Parallel Processor 5.2 Thread-Level Parallelism 6.3 OpenMP Overview 7.4 OpenMP Directives 8.4.1 Parallel Construct 9.4.2 Loop Construct 10.4.3 Parallel Loop Construct (Combined Parallel Work-sharing Construct) 12.5 OpenMP Clauses 13.5.1 Default Clause 13.5.2 Shared Clause 14.5.3 Private Clause 17.5.4 Firstprivate Clause 19.5.5 Lastprivate Clause 21.5.6 Reduction Clause 23hapter 3 GCC Overview 27.1 GCC Introduction 27.2 Structure of GCC Compiler 27.2.1 Front-End 28.2.2 Middle-End 29.2.3 Back-End 30.3 Intermediate Representation 30.4 OpenMP Implementation in GCC 32hapter 4 System Design 34.1 Loop Type Identification 34.2 Default Clause Setting 38.3 Private Clause Classification 38.4 Reduction Clause Classification 39.5 Firstprivate Clause Classification 42.6 Lastprivate Clause Classification 45.7 OpenMP Pragma Insertion 47hapter 5 Implementation 51.1 Development Platform 51.2 System Architecture 51.3 Add Option –faddomp 54.4 Create omp-add.c 56.5 Statements Traverse 57.6 Loop Identification 59.7 The Variable Classification in Loop Block 61.8 Parallel Loop Pragma Addition 62hapter 6 Program Test 64.1 Test Program for Reduction Clause 64.2 Test Program for Firstprivate and Lastprivate Clause 66.3 Test Program for Both Reduction and Firstprivate and Lastprivate Clause 68hapter 7 Conclusion 71.1 Summary 71.2 Future Works 71eferences 74761683 bytesapplication/pdfen-US編譯器平行化程式設計程式轉換OpenMPCompilerParallel programmingProgram Transformation一個加入OpenMP編譯指示的程式轉換機制A Program Transformation to Insert OpenMP Pragmasthesishttp://ntur.lib.ntu.edu.tw/bitstream/246246/185367/1/ntu-98-P95922001-1.pdf