A portable C compiler for OpenMP V.2.0 Vassilios V. Dimakopoulos Dept. of Computer Science University of Ioannina, Greece E-mail: dimako@cs.uoi.gr Elias Leontiadis Dept. of Computer Science University of Ioannina, Greece E-mail: ilias@cs.uoi.gr George Tzoumas Dept. of Informatics and Telecommunications University of Athens, Greece E-mail: grad0491@di.uoa.gr Abstract This paper presents an overview of OMPi, a portable implementation of the OpenMP API for C, adhering to the recently released version 2.0 of the standard. OMPi is a C-to-C translator which takes C code with OpenMP directives and produces equivalent C code which uses POSIX threads, similarly to other publicly available implementations. However, in contrast to the latter, OMPi is written entirely in C and, more importantly, implements fully version 2.0 of the OpenMP C API. We present major aspects of the implementation, along with performance results. 1. Introduction Multiprocessor systems are becoming increasingly popular even for the desktop; workstations with two to four processors are commonplace nowadays. The majority of such systems support shared memory by utilizing either symmetric multiprocessor (SMP) or dis- tributed shared memory (DSM) organizations. Shared memory is even supported in clustered multiprocessors and networks of workstations through software DSM (SDSM). Shared memory programming is one of the most popular parallel programming paradigms. Until re- cently, however, writing a shared-memory parallel pro- gram required the use of vendor-specific constructs which raised a lot of portability issues. This problem was solved by OpenMP [10, 11], a standard API for C, C++ and Fortran which has been endorsed by all major software and hardware vendors. In contrast to other APIs such as the POSIX threads (pthreads for short), OpenMP is a higher level API which allows the programmer to parallelize a serial program in a con- trolled and incremental way. The OpenMP API consists of a set of compiler di- rectives for expressing parallelism, work sharing, data environment and synchronization. These directives are added to an existing serial program in such a way that they can be safely discarded by compilers that do not understand the API (thus leaving the original serial program unchanged). That is to say, OpenMP extends but does not change the base language (C/Fortran). This paper presents OMPi, our implementation of an experimental C compiler for OpenMP version 2.0 and is organized as follows: after reviewing some re- lated implementations in Subsection 1.1, we give an overview of our implementation in Section 2. In Sec- tion 3 we evaluate OMPi’s performance and compare it to other implementations. We conclude the paper in Section 4 with a summary and a discussion of the project’s current status. 1.1. Related work Most of the compilers that understand the OpenMP directives are vendor proprietary or commercial. How- ever, some non-commercial implementations have re- cently become available, such as the OdinMP/CCp and the Omni compilers. OdinMP/CCp [3] supports OpenMP for C and is a C-to-C translator that produces C code with pthreads calls. A new version called OdinMP is available as part