Call for Paper - November 2021 Edition
IJCA solicits original research papers for the November 2021 Edition. Last date of manuscript submission is October 20, 2021. Read More

A Methodology for Translating C-Programs to OpenCL

International Journal of Computer Applications
© 2013 by IJCA Journal
Volume 82 - Number 3
Year of Publication: 2013
Krishnahari Thouti
S. R. Sathe

Krishnahari Thouti and S R Sathe. Article: A Methodology for Translating C-Programs to OpenCL. International Journal of Computer Applications 82(3):11-15, November 2013. Full text available. BibTeX

	author = {Krishnahari Thouti and S. R. Sathe},
	title = {Article: A Methodology for Translating C-Programs to OpenCL},
	journal = {International Journal of Computer Applications},
	year = {2013},
	volume = {82},
	number = {3},
	pages = {11-15},
	month = {November},
	note = {Full text available}


Graphics Processing Units (GPUs) is currently a common feature of high performance computing. Languages such as CUDA and Open Computing Language (OpenCL) are such programming models; provide a standard interface for achieving high performance across these GPU devices. However, because of the wide variety of architectural complexities of these GPU devices; often makes difficult to write programs for these platforms. One of the approaches to get rid off this difficulty is to parallelize sequential programs into equivalent parallel programs. In this paper, we present a methodology for parallelization of sequential C-programs with function calls to equivalent OpenCL programs with little assistance from programmer. Our proposed methodology identifies function calls and converts them into 'kernel' to be executed in parallel on GPU devices. To the best of our knowledge, there are no tools dedicated to conversion of C code to equivalent OpenCL code.


  • General-purpose computations using Graphics hardware, http://www. gpgpu. org/
  • I. Buck, T. Foley, D. Horn, J. Sugerman, K. Fathalian, M. Houston and P. Hanrahan, "Brook for GPUs: Stream Computing on Graphics Hardware," ACM Trans. Graph, Vol. 23, No. 3, 2004, pp. 777-786
  • NVIDIA CUDA, http://developer. nvidia. com/cuda/
  • OpenCL, http://www. khronos. org/registry/cl/
  • Lee, S. , Min, S-J. , Eigermann, R. : OpenMP to GPGPU: A compiler framework for automatic translation and optimization. In: PPoPP, pp. 101-110 (2009)
  • Baskaran, M. , Ramanujam, J. , Sadayappan, P. : Automatic C-to-CUDA generation for Affine Programs. Compiler Construction. Lecture Notes in Computer Science, Vol. 6011. pp. 244-263 (2010)
  • CLooG, The Chunky Loop Generator, http://www. cloog. org/
  • Pluto, http://pluto-compiler. sourceforge. net/
  • Cornwall, J. L. T. , Beckmann, O. , Kelly, P. H. . : Automatically translating general purpose C++ image processing library for GPUs. In: POHLL. pp. 381 (2006)
  • Ueng, S-z. , Lathara, M. , Baghsorkhi, S. , Hwu, W-m. : CUDA-Lite: Reducing GPU Programming Complexity, Languages & compilers for parallel computing. Lecture Notes in Computer Science, Vol. 5335. pp. 1-15 (2008)
  • Han, T. D. , Abdelrahman, T. S. : hiCUDA: A high-level directive based language for GPU programming. In: GPGPU -2. pp. 52-61 (2009)
  • Martinex, G. , Gardener, M. , Feng, W-c. : CU2CL: A CUDA-to-OpenCL translator for Multi-and-many-core Architectures. In: IEEE ICPADS. pp. 300-307 (2011)
  • B. Gaster, L. Howes, D. Kaeli, P. Mistry, and D. Schaa, "Heterogeneous Computing with OpenCL", Morgan Kaufmann Publishers, 2011.
  • AMD Accelerated Parallel Processing OpenCL Programming Guide, Advanced Micro Devices, Inc. 2012. http://developer. amd. com/appsdk
  • A. Munshi, B. Gaster, T. Mattson, J. Fung and D. Ginsburg, OpenCL Programming Guide, Addison-Wesley Publishers, 2011.
  • M. Scarpino, "OpenCL in Action," Manning publications, 2011.
  • D. Kirk and W-m. Hwu, Programming Massively Parallel Processors: A Hands-on Approach. Morgan-Kaufmann Publishers, 2010.
  • Banerjee, U. : An introduction to a formal theory of dependence analysis. In: Journal of Supercomputing. Vol. 2, No. 2 pp. 133-149 (1988).