cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cf4ocl (C Framework for OpenCL) Documentation

cf4ocl, a C Framework for OpenCL

Introduction

Overview

The C Framework for OpenCL, cf4ocl, is a cross-platform pure C object-oriented framework for developing and benchmarking OpenCL projects. It aims to:

  1. Promote the rapid development of OpenCL programs in C, with support for C++.
  2. Assist in the benchmarking of OpenCL events, such as kernel execution and data transfers.
  3. Simplify the analysis of the OpenCL environment and of kernel requirements.

Features

  • Object-oriented interface to the OpenCL API
    • New/destroy functions, no direct memory alloc/free
    • Easy (and extensible) device selection
    • Simple event dependency mechanism
    • User-friendly error management
  • OpenCL version and platform independent
  • Integrated profiling
  • Advanced device query utility
  • Offline kernel compiler and linker

Documentation

Small example

The example below shows a clean and fast way to create an OpenCL context with a user-selected device:

#include <cf4ocl2.h>
int main() {
/* Variables. */
CCLContext * ctx = NULL;
/* Code. */
if (ctx == NULL) exit(-1);
/* Destroy context wrapper. */
return 0;
}

Not yet integrated

A few OpenCL API calls, most of which introduced with OpenCL 2.1, are not yet integrated with cf4ocl. However, this functionality is still available to client code, because cf4ocl can be used simultaneously with raw OpenCL objects and functions.

License

Library code is licensed under LGPLv3, while the remaining code (utilities, examples and tests) is licensed under GPLv3.

Other useful C/C++ frameworks/utilities for OpenCL

If cf4ocl does not meet your requirements, take a look at the following projects: