language-icon Old Web
English
Sign In

OpenMP C to CUDA

2011 
In recent years hardware accelerators have become a full part of the HPC domain as their peak performance has increased steadily. Although their programmability has greatly improved and different tools have been developed to smooth down their learning curve, porting legacy code to the new programming models could reveal itself a cumbersome and time-consuming process. However a large amount of code benefits from the multicore architectures using either a shared memory model or a distributed model. Our goal was to allow developers to benefit from the simplicity of OpenMP code and at the same time permitting their code to be executed on GPUs manycore architectures. Thus we propose a source-to-source compiler able to automatically transform an OpenMP C code into a CUDA code, while maintaining a human readable version of the code that can be further analyzed or optimized. Using the OMPi compiler as a base ground, we implemented the "pragma omp parallel for" transformation along with data visibility clauses. The generated code is fully NVIDIA CUDA compliant and can be compiled using the nvcc compiler. In this paper we present the entire transformation process, starting from the pragma split-up and kernel generation, passing through the data visibility clauses management and ending with the device memory management and kernel launch system. Index Terms—compiler, code transformation, CUDA, OpenMP older than GPU computing and billions of lines of legacy code are using older parallel programming models like OpenMP or MPI. With this aspect in mind several solutions, both open- source and commercial, emerged in the ecosystem with the aim to allow porting legacy applications to GPU-enabled systems with a minimal effort. Following the same idea we present in this paper a source- to-source compiler capable of transforming an OpenMP anno- tated code into a fully compatible CUDA C application. We wanted the entire process to be as transparent as possible and the generated code to be in a human readable format. Having a user-friendly code in the end allows the developer to further analyze and tweak the application as needed. The structure of the paper is the following. We start by briefly introducing the OpenMP programming paradigm and the CUDA programming framework with their particularities. Further on, we compare some major approaches that allow us to generate GPU-enabled code from a standard code. The main part of our paper details our approach to transform an OpenMP annotated code into a fully human readable CUDA C compliant code. Finally we conclude and present the main directions for future work.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    11
    References
    0
    Citations
    NaN
    KQI
    []