International Journal of Innovative Technology and Exploring Engineering (IJITEE) ISSN: 2278-3075, Volume-8 Issue-11, September 2019 4059 Published By: Blue Eyes Intelligence Engineering & Sciences Publication Retrieval Number: K15460981119/2019©BEIESP DOI: 10.35940/ijitee.K1546.0981119 Automatic Parallelization using Open MP Directives Deepika Dash, Anala M R Abstract-With the increase in the advent of parallel computing, it has become necessary to write OpenMP programs to achieve better speedup and to exploit parallel hardware efficiently. However, to achieve this, the programmers are required to understand OpenMP directives and clauses, the dependencies in their code, etc. A small mistake made by them, such as wrongly analysing a dependency or wrong data scoping of a variable, can result in an incorrect or inefficient program. In this paper, we propose a system which can automate the process of parallelization of a serial C code. The system accepts a serial program as input and generates the corresponding parallel code in OpenMP without altering the core logic of the program. The system has used different data scoping and work sharing constructs available in OpenMP platform.The system designed here aims at parallelizing “for” loops, “while” loops, nested “for” loops and recursive structures.The system has parallelized “for” loop by considering the induction variable. And converted “while” loop to “for” loop for parallelization. The system is tested by providing several programs such as matrix addition, quick sort, linear search etc. as input. The execution time of programs before and after parallelization is determined and a graph is plotted to help visualize the decrease in execution time. IndexTermsAutomatic Parallelization Tool, collapse, OpenMP, OpenMP directives and clauses, pragma directives, parallel computing, recursive structures, task, taskwait I. INTRODUCTION Parallel computing has become increasingly popular by virtue of the magnitude of benefits that it offers. Its area of application encompasses several fields of science, medicine and engineering such as web search engines, medical imaging and diagnosis and also multiple areas of mathematics.The High-Performance Computing (HPC) market is estimated to grow from USD 28.08 Billion in 2015 and projected to be of USD 36.62 Billion by 2020, at a high Compound Annual Growth Rate (CAGR) of 5.45% during the forecast period [1]. Parallel computing involves breaking down large problems into smaller sub-problems which may be carried out in parallel.This process of problem solving exploits the parallel hardware architecture of modern day computers and hence enables fastercomputation. While this may not make a difference to simple programs, it helps to save a lot of time, power and cost when dealing with very large, complex problems involving big data or heavy computationsThere are several systems which are implemented as serial programs, converting them to parallel programs will give the product an edge as there are multiple benefits from parallelization. Developing the parallel code for a complex serial program involving numerous dependencies and complexities is not an easy task. Revised Manuscript Received on September 05, 2019. Prof. Anala M R, Dept. of CSE, RVCE, Bengaluru, India Prof. Deepika Dash, Dept. of CSE, RVCE,Bengaluru, India It requires a thorough understanding of OpenMP platform. Manually parallelizing a program is often prone to errors. Debugging the code also becomes tedious. The system developed aims at addressing such problems, by providing a tool which automates the process of parallelization. Automatic parallelization abstracts parallel computing platforms from developers thereby eliminating the knowledge requirement of developer about parallel computing platform [2]. There are several parallel computing platforms such as OpenMP, CUDA, MPI etc. The system developed uses OpenMP as it is easy to use and portable. The primary function of the system is to generate an accurate and efficient OpenMP program for a given sequential C code. To accomplish this, the system is provided with three main modules: Custom Parser, OpenMP Analyzer and Code Generator. The first step deals with parsing of the code. It checks whether the input program is syntactically correct. It returns error messages, if any, to the user. The parser also populates the data structures namely, variable table, statement and function details tables which are used by the OpenMP Analyzer. The OpenMP Analyzer detects blocks of code which have potential for parallelization such as recursions, for loops, while loops, etc. It also generates the dependency graph. The Code Generator adds the directives and clauses to generate parallel program as final output.The generated parallel codes are checked for correctness and speedup. The results obtained are plotted on a graph. The rest of the paper is organized as follows: In section 2, we present a brief description about tasks, data scoping and collapse clause. In section 3 we describe the methodology by providing algorithms for implementing the various modules. In section 4 and 5 we discuss related work and experimental results respectively. Section 6 provides a conclusion to the paper. The last section, section 7 describes the future enhancements. II. BACKGROUND OpenMP specification version 3.0 introduced a new feature called tasking. Tasking facilitates the parallelization of applications where units of work are generated dynamically, as in recursive structures[3]. Data scoping attribute clauses namely, shared and firstprivate are also used. A brief description of these clauses is given below: Shared: The shared clause declares the variables in the list to be shared among all the threads in a team. All threads within a team access the same storage area for shared variables [4].