Font Size: a A A

The Design And Implementation Of An OpenMP-to-OpenCL Code Automatic Conversion Tool

Posted on:2016-10-22Degree:MasterType:Thesis
Country:ChinaCandidate:Y Y WangFull Text:PDF
GTID:2298330467994065Subject:Computer software and theory
Abstract/Summary:PDF Full Text Request
Due to the physical structure design, the traditional single-core system structure has beendifficult to meet people’s demand for performance, the multi-core system structure has graduallybecome today’s main computer system architecture. So as the current most popular parallelprograming standards and as the first open free parallel programming standards forheterogeneous system structure platform, the OpenCL has been concerned by more and morepeople. But the OpenCL is usually very difficult and complex, and OpenCL programdevelopment is also very hard. So we designed and realized an automatic code conversion toolfor OpenCL to resolve this problem.The main contributions of this paper can be divided into three points:First, we analysis the language design feature, the model feature and then study theoptimization method of the parallel code of the OpenMP and the OpenCL parallel programingstandards, and then we summed up the relationship between the OpenCL code and OpenMP codein semantic and the the technical difficulties needed to solve in the process of transformation.Secondly, we carried detailed analysis and research for the design frame structure, theinternal function of library function and the interior of the abstract syntax tree of intermediaterepresentation the clang compiler. Then on the strength of the complier Clang-omp, we designedand realized an automatic code conversion tool which can transform the OpenMP code toOpenCl code using the source to source compilation techniques and program analysis techniquesby increasing-omp2gpu compiler options without changing the original compiler function at thesame time.Lastly, by using source to source compilation techniques and program analysis technology,we realized the code conversion from OpenMP code to OpenCL code. The core idea of thesource to source compilation is to map the OpenMP for loop to become the OpenCL Kernelfunction’s executed code and map the for loop variable to the Kernel function index variablethread, etc. Then in real implementation process, through the technology of the applicationanalysis, we complete the OpenCL kernel function parameter and OpenCL code memory transferfunction parts, etc. In addition, in order to improve the performance of the automatic generatedOpenCL code, we can determine the corresponding data in the CPU and GPU memory direct data transfer properties by the analysis about value of the code snippet variables related to theproperty. According to this properties, we can reduce unnecessary memory transfer codegeneration, so as to make the generation of high-performance OpenCL code.At the end of the paper, we tested the OpenCL code of multiple examples whichautomatically generates by the code conversion tool on the three different GPU computingplatform of NVIDIA Tesla C2050GPU and GeForce GTX TITAN GPU and AMD Pitcairn GPU.Then we analyzed the test result from the aspects of the functionality of the code conversion tool,and the execution performance of the generated OpenCL code and the portability throughmulti-platform. The experiment results show that the tool can not only correct converts OpenMPcode to OpenCL code, but also the readability of the generated code is higher, and can achievehigh parallel speedup on many GPU device.Therefore, the OpenMP-to-OpenCL code tool conversion designed in this paper can notonly resolve the problems of write OpenCL code hardly, but alse can generate high efficiencycode which is readability. At the same time, it can greatly reduce the programmer’s workload,and help the programmers who can not get by on their own ability to complete conversion fromOpenMP code to OpenCL code, and provide a feasible method for the conversion problem of thelegacy OpenMP code.
Keywords/Search Tags:OpenMP, OpenCL, Clang compiler, Program analysis techniques, Source to sourcetransform techniques
PDF Full Text Request
Related items