OpenCL - way how to get maximum from your computer

OpenCL (Open Computing Language) enables you to execute programs on heterogeneous platforms consisting of CPUs, GPUs, and other processors. It means that your program can benefit from multi-core CPUs and powerful GPUs. OpenCL provides parallel computing using data-based and task-based parallelism. It has been adopted into graphics card drivers by both AMD/ATI and NVIDIA. OpenCL offers at least equal (in my personal opinion better) choice to its Compute Unified Device Architecture (CUDA).

Where to get OpenCL drivers for your hardware?

When you install drivers try GPU Caps Viewer and check installed drivers in OpenCL tab. GPU Caps Viewer is a graphics card information utility focused on the OpenGL, OpenCL and CUDA API level support of the main graphics card. For OpenCL and CUDA, GPU Caps Viewer details the API support of each capable device.



OpenCL 1.2 for Delphi

  1. Download header files with example project.

To download OpenCL 1.2 header files for Delphi running under Microsoft Windows including example project click here. The package includes translation of OpenCL 1.2 header files (CL.pas = opencl.h, cl_platform.h, cl.h, cl_ext.h; CL_GL.pas = cl_gl.h, cl_gl_ext.h) for Delphi. OpenCL library is loaded manually using LoadOpenCL function and the program will not crash when no OpenCL driver is installed. Example project including header files was tested under Delphi XE4, Delphi XE2 Pro, and Borland Delphi 7 Pro.
The package also includes dglOpenGL.pas a header for OpenGL which was downloaded from Delphi OpenGL Community.

  1. Install OpenCL drivers for you hardware.

  2. Open MyFirstOpenCL.dpr Delphi project and run it.

  3. Click on Read OpenCL couples button. Select the vendor and device couple you want to use for computation and click on Test OpenCL Program button to test computation using OpenCL.

  4. Study more about OpenCL for example here.



Performance with OpenCL

In our Heat Transfer and Fluid Laboratory at Brno University of Technology we are using OpenCL to shorten computational time in our applications. One good example is multilevel data filtration where we increase computational speed approximately 84 times. See performance table below with computational time on various hardware.





Send mail to profipohanka@volny.cz with questions concerning this website.
2013 Michal Pohanka | Last modified: 7-22-2013