Introduction to Parallella and OpenCL

The following post provides an introduction to the use of OpenCL™ for programming Parallella.

What is OpenCL?

OpenCL is an industry standard API for parallel programming co-processors on heterogeneous platforms.  Designed primarily for computing with general-purpose graphics processing units (GPUs), the API may be used to access the compute capability of other types of devices including multicore CPUs and other accelerators.  OpenCL provides a good API for exposing the compute capability of the Epiphany co-processor on the Parallella platform.

OpenCL consists of a kernel programming API used to program the co-processor device and a run-time host API used to coordinate the execution of these kernels and perform other operations such as memory synchronization.  The OpenCL programming model is based on the parallel execution of a kernel over many threads to exploit SIMD or SIMT architectures.

OpenCL for the Epiphany Processor

Creating an API for architectures not even considered during the creation of a standard is challenging.  This can be seen in the case of Epiphany, which possesses an architecture very different from a GPU, and which supports functionality not yet supported by a GPU. OpenCL as an API for Epiphany is good, but not perfect.

Our focus with the implementation of OpenCL for Epiphany is to leverage the API to support effective parallel programming that takes advantage of the underlying architecture.  For programmers familiar with OpenCL in a GPU context, it will be important to understand the key differences and the algorithm design and extensions that must be employed to take full advantage of the Epiphany co-processor.  A best-practices guide will be provided to help new and experienced OpenCL programmers get started with Parallella.

OpenCL Support for Parallella: Where We Are Today

The OpenCL support for Parallella is provided by the COPRTHR SDK developed by Brown Deer Technology, with version 1.5 providing full support for the Parallella platform, including OpenCL for both the ARM processor and the Epiphany co-processor.  A release candidate is available now, and we are close to locking down the release. As part of an ongoing effort, we will continue to improve the implementation by expanding coverage and optimizing performance.

A few FAQs About OpenCL for Parallella

What version of the OpenCL standard is supported?
The OpenCL implementation for Parallella presently targets the 1.1 standard specification. Programmers should be aware that not all of the standard is implemented at this time and extensions have been added to expose features of the Epiphany architecture not addressed in the standard. The primary objective is to use OpenCL to provide a useful parallel programming model for Parallella programmers.

Why do we use GCC when everyone else uses LLVM?
The choice of compiler is not strongly bound to the COPRTHR SDK – in fact LLVM was once supported by default.  For Parallella we use GCC because GCC 4.7 provides the compiler back-end support for the architecture.

Why isn’t the memory local to an Epiphany core considered OpenCL __local memory?
OpenCL address space qualifiers co-mingle the concepts of locality and visibility.  For the Epiphany architecture, the per-core memory is most accurately viewed as __private in locality and __local in visibility, with non-uniform access from any core using a common address space.

Where To Go For More Information

The Khronos website provides an excellent starting point for more information about the OpenCL API. The COPRTHR SDK can be downloaded as a pre-built package for Parallella or built from source available on github.  A Parallella Quick Start Guide is also available from the download page.

OpenCL™ is a trademark of Apple Inc. used by permission by the Khronos Group which
develops and maintains the OpenCL standard.

6 Comments

  • […] More information about OpenCL on Parallella can be found at this blog post. […]

  • COPRTHR in general, and on Epiphany in particular is not listed as a conformant implementation of OpenCL (and therefore technically, if you respect KHRONOS’s conditions for implementing the standard, cannot claim to be an OpenCL implementation).

    Are there any plans to pass it through the conformance tests on the parallella board?

    Does Adapteva or BrownDeerTech plan to join KHRONOS and the OpenCL workgroup?

    • David Richie says:

      The COPRTHR SDK provides an open-source OpenCL implementation that is not claimed to be conformant or compliant (it says as much on our webpage). This is merely a statement of technical fact. We are respectful of Khronos and do not market OpenCL compliant products nor use the OpenCL logos. Since we provide the SDK under a GPLv3 license at no cost, anyone can port and build the software for any architecture they choose. That was the intent. However, this makes conformance testing difficult since the software is not tied to a specific hardware platform we are trying to market. We are proud to have provided the first (non-conformant) open-source OpenCL implementation to the community in contrast to the numerous closed-source vendor implementations. It has been used to support numerous complex OpenCL codes, e.g., at one point a LAMMPS molecular dynamics benchmark ran faster using COPRTHR than vendor implementations.

      In the context of Parallella, there is nothing unusual about providing OpenCL support prior to passing conformance testing for a specific platform. This has been the case for many (closed-source) vendor implementations. Remember that this is an open-source, open-hardware project. Conformance testing is complicated, but as soon as we have a roadmap to share for Parallella, we will certainly do so. As was stated in the original blog post above, we are working to expand coverage for Parallella, and in a way that best exposes the architecture to the programmer.

      • David, I’m sorry if my observation and question came out complainant in any way – that wasn’t the purpose. I was merely trying to understand where the project and specifically the SDK for OCL development on the Epiphany chip, stand with regards to future conformance.passing with KHRONOS.

        I take it neither Adapteva nor BrownDeerTech plan on joining the OpenCL workshop at KHRONOS?

  • It’s been about a year since this post – what’s the status of OpenCL support on Parallella. Has anyone had experience building clBlas yet? Thanks!

Leave a Reply