cf4ocl: A C framework for OpenCL

Abstract OpenCL is an open standard for parallel programming of heterogeneous compute devices, such as GPUs, CPUs, DSPs or FPGAs. However, the verbosity of its C host API can hinder application development. In this paper we present cf4ocl, a software library for rapid development of OpenCL programs in pure C. It aims to reduce the verbosity of the OpenCL API, offering straightforward memory management, integrated profiling of events (e.g., kernel execution and data transfers), simple but extensible device selection mechanism and user-friendly error management. We compare two versions of a conceptual application example, one based on cf4ocl, the other developed directly with the OpenCL host API. Results show that the former is simpler to implement and offers more features, at the cost of an effectively negligible computational overhead. Additionally, the tools provided with cf4ocl allowed for a quick analysis on how to optimize the application.

[1]  Henri Calandra,et al.  hiCL: an OpenCL abstraction layer for scientific computing, application to depth imaging on GPU and APU , 2016, IWOCL.

[2]  Aaftab Munshi,et al.  The OpenCL specification , 2009, 2009 IEEE Hot Chips 21 Symposium (HCS).

[3]  Wayne Luk,et al.  A comparison of CPUs, GPUs, FPGAs, and massively parallel processor arrays for random number generation , 2009, FPGA '09.

[4]  A. Zhmurov,et al.  Generation of random numbers on graphics processors: forced indentation in silico of the bacteriophage HK97. , 2011, The journal of physical chemistry. B.

[5]  Samuel Neves,et al.  Fast and Small Nonlinear Pseudorandom Number Generators for Computer Simulation , 2011, PPAM.

[6]  Shuang Gao,et al.  GASPRNG: GPU accelerated scalable parallel random number generator library , 2013, Comput. Phys. Commun..

[7]  Orion Sky Lawlor Embedding OpenCL in C++ for Expressive GPU Programming , 2011 .

[8]  Nicolas Pinto,et al.  PyCUDA and PyOpenCL: A scripting-based approach to GPU run-time code generation , 2009, Parallel Comput..

[9]  Jason Wittenberg,et al.  Clarify: Software for Interpreting and Presenting Statistical Results , 2003 .

[10]  Basilio B. Fraguela,et al.  Improving OpenCL Programmability with the Heterogeneous Programming Library , 2015, ICCS.

[11]  Paul Coddington,et al.  Random Number Generators for Parallel Computers , 1997 .

[12]  Jakub Szuppe,et al.  Boost.Compute: A parallel computing library for C++ based on OpenCL , 2016, IWOCL.

[13]  Agostinho C. Rosa,et al.  PerfAndPubTools – Tools for Software Performance Analysis and Publishing of Results , 2016 .

[14]  Axel-Tobias Schreiner Object oriented programming with ANSI-C , 1993 .

[15]  Benedict R. Gaster,et al.  Embedding OpenCL in GHC Haskell , 2013 .

[16]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.

[17]  Sergei Gorlatch,et al.  SkelCL - A Portable Skeleton Library for High-Level GPU Programming , 2011, 2011 IEEE International Symposium on Parallel and Distributed Processing Workshops and Phd Forum.

[18]  William B. Langdon,et al.  A fast high quality pseudo random number generator for graphics processing units , 2008, 2008 IEEE Congress on Evolutionary Computation (IEEE World Congress on Computational Intelligence).

[19]  Bil Lewis,et al.  Multithreaded Programming With PThreads , 1997 .