Blog

Ten Reasons Why We Love OpenCL (and you might too)

As the developer of OpenCL CodeBench, Amdahl Software is obviously a strong believer in the benefits of OpenCL and is betting heavily on the success of the standard. We believe that multi-core and many-core systems provide a viable solution to the ever increasing demand for compute performance within the limitations imposed by heat and power consumption. To users of OpenCL, the strength of the standard and benefits obtained from it are clear. We anticipate that OpenCL will play a leading role in computer software through the next decade and beyond.

Here are the top ten reasons why we feel so strongly about OpenCL:

1 – OpenCL can accelerate code by a factor 10 or more

Many embedded or desktop compute platforms have a GPU on board. This GPU idles much of the time, only working when graphically intensive work is being performed. By tapping into the capabilities of your GPU when it is idle, you can make your code run faster. Much faster if your algorithm is inherently parallel. This is particularly true for applications such as simulation of molecular dynamics or even electronics circuits, real-time video processing, image processing, augmented reality, motion detection, financial analysis, automated trading …

A GPU is however not mandatory to take advantage of OpenCL. If your host platform has multiple CPU cores – and more and more desktop platforms have four cores or more – you can still use OpenCL to leverage this. Depending on the algorithm, the speedup may be less dramatic than what would be achievable on a GPU, but often still scales with increasing number of CPUs.

2 – OpenCL is an open standard

This means everyone wanting to use OpenCL has free and open access to the standard. OpenCL has a complete high-quality set of documentation, including on-line tutorials, programming guides and reference manuals. There are many open source tools and published books available. The internet is littered with use cases and design examples.

3 – OpenCL can help save power

There are many industry examples demonstrating the use of accelerators to reduce system power. Amdahl Software will publish a white paper in the near future, using a straightforward quantitative analysis identifying the opportunities for energy savings using a simplified CPU + GPU model. In the interim, this OpenCL video demo by Imagination Technologies nicely illustrates the point.

4 – OpenCL can save you hardware cost

For digital signal processing, OpenCL provides a relaxed floating point implementation. If your algorithms do not require absolute precision, you may be able to eliminate a DSP in your system and instead use an existing GPGPU.

5 – OpenCL adoption is ramping up rapidly

This is true in both the desktop and embedded world. Semiconductor and IP vendors such as Altera, Apple, AMD, ARM, Freescale, IBM, Imagination, Intel, NVidia, Samsung, STMicroelectronics, Texas Instruments, Vivante, Qualcomm and others have announced their OpenCL compliant devices. The full list of compliant devices and drivers is on the Khronos repository of OpenCL compliant products. With other devices in the testing process, this list is expected to expand rapidly. More and more libraries and end-user applications are being ported to take advantage of GPGPU acceleration through OpenCL. The use of OpenCL correlates to improved application performance, setting a new standard for end user experience and expectations.

6 – OpenCL may be used as the basis for generating custom hardware

The OpenCL programming model inherently expresses parallelism through the definition of kernels, work groups and work items. Within a kernel, even more parallelism may be exposed through the use of small vector data types having a fixed and well-known length. Another important element in efficient data access is also the ability of kernels to synchronize by means of barriers and memory fences. All these elements make OpenCL not only suitable for programming software accelerators, but also for defining the implementation of a custom hardware accelerator. Altera has recognized this and has recently announced an OpenCL program, providing an implementation path from OpenCL to FPGA.

Developers no longer have to fit their application into an existing device. Instead, they can optimize a system to meet their exact requirements (performance, power, size …) using OpenCL to define the specialized “co-processor”. These designers can develop a fully functional and tested parallel application within a known and easy-to-debug environment. Once the program is complete, the performance critical portions can be seamlessly accelerated using an FPGA image generated directly from the kernels involved, a major benefit. This makes for a tightly integrated hardware/software co-design methodology where the same baseline program and tests are used throughout the entire process, resulting in a quicker time-to-market.

7 – The OpenCL C99 language is based on C

This is a factor that should not be underestimated. Creating an entirely new programming language almost always slows down adoption – even if the benefits are overwhelming. C is an industry standard language and is the basis of OpenCL. The OpenCL kernel definition language is an extension of C99 and is straightforward. Engineers who have programmed in C can quickly get up to speed. This allows programmers to focus on the algorithm they want to accelerate rather than the syntax needed to describe it.

8 – OpenCL can be used from a variety of host languages

OpenCL kernels can be called from languages such as C, C++, Java, Python, JavaScript, Haskell, Perl, Ruby, … and the list is growing. This enables portability and reuse of existing OpenCL kernels and results in flexible support for GPGPU computing across a number of development environments.

9 – It is easy to start with OpenCL

Most PCs have an OpenCL compatible graphics card. If you don’t have a GPU in your system (an unlikely scenario), there are drivers available enabling running OpenCL programs directly on the CPU. In the embedded world there are also a myriad of low-cost community development boards supporting OpenCL capabilities. Training videos and tutorials are widely available and application notes and example programs are provided by many GPU vendors. It is inexpensive and easy to start experimenting with OpenCL

10 – OpenCL is platform independent

OpenCL presents a platform independent programming model that enables heterogeneous multi-core software development. Different memory spaces define a memory consistency model. Low-level tasks such as queuing and executing kernels, are shielded from the user by the OpenCL run-time. Primitives such as events, barriers and fences provide synchronization capabilities.

This means that OpenCL code will run without modification across compatible OpenCL platforms. As a consequence, even though performance on different platforms may vary, porting implementations from one platform to another is simplified. OpenCL provides a functional starting point based on a common system model.

Conclusion

We truly believe in the potential of OpenCL. It enables software engineers to efficiently and effectively harness the power of (heterogeneous) multi-core computing. As with any programming environment, productivity and code quality is improved with better tools. With OpenCL CodeBench our goal is to streamline OpenCL code development as we move into the multi-core era. OpenCL CodeBench offers comprehensive host code generation capabilities and a smart Eclipse-based OpenCL kernel editor. Don’t take our word for it. Try OpenCL CodeBench for yourself and learn how quickly and easily you can accelerate your applications with OpenCL.

0