COPRTHR SDK v1.6 Updated for Parallella


The COPRTHR® SDK provides libraries and tools for developers targeting accelerators and co-processors. The SDK is freely available under the open-source GPLv3 license. COPRTHR version 1.6 has been updated to support Parallella. In this blog post I present a quick overview of the support for Parallella provided by the SDK.

API Support

The SDK provides several APIs for programming Parallella allowing developers to choose the approach that best meets the needs of their project.

STDCL® is a powerful API for targeting accelerators such as GPUs and Intel MIC processors. For Parallella, STDCL provides a simple API for targeting the Epiphany co-processor using a compute offload programming model. The STDCL implementation leverages OpenCL for portability while providing simpler and more intuitive semantics. STDCL greatly reduces the amount of code required for a particular application and may be used directly in C, C++ and Fortran applications. The STDCL API is recommended for programmers looking for an intuitive API that is easy to use and integrated with a standard compilation model and work flow.

Basic OpenCL support is provided for both the ARM CPU and Epiphany co-processor. The OpenCL implementations are not conformant or complete, but neverthreless provide a practical means of programming Parallella for those familiar with OpenCL. When using the OpenCL API it is important to remember that the Epiphany RISC array is not a GPU and simply recycling OpenCL code written for a GPU is not likely to exhibit the best performance. A portable API does not imply portable performance.

The new low-level COPRTHR API exports the low-level code used to implement STDCL and OpenCL for programmers interested in a more direct and precise API for the Epiphany co-processor. The low-level API supports malloc(2) based device memory allocation, immediate operations, and scheduled stream and thread programming models. The thread model is a direct extension of Pthreads for co-processors.

Standard Compilation Model

The SDK provides a set of compiler tools that support a standard compilation model and workflow familiar to most programmers. The clcc compiler tool may be used to pre-compile kernels for a range of architectures including Parallella, allowing co-processor device code to be directly linked with host code in single executable or shared library. The embedded kernels are directly accessible using the STDCL API. The following tools are provided:

  • clcc – compiler front-end for pre-compiling kernels targeting one or more co-processor devices.
  • clld – linker allowing recursive linking of individual object files with pre-compiled kernels as well as other binary object manipulation.
  • clnm – displays embedded kernel symbol information similar to the UNIX nm command.

As an example of how easy it is to build applications for Parallella using these tools, the following commands are all that are necessary to build and run a heterogeneous application that uses both the ARM and Epiphany processors:

] clcc -k -o my_kernels.o
] gcc -o my_program.x my_host_code.c my_kernels.o
] ./my_program.x

Additional Libraries

A few additional libraries are provided by the SDK, including and, and both may be of interest to Parallella programmers. The library is a direct replacement for the conventional OpenCL loader with support for more precise platform configuration, call intercept hooks, and CLRPC server support. The library provides supported for networked devices using a Remote Procedure Call (RPC) implementation of OpenCL.

More Information

The following resources may be helpful in providing more information:


  • Hamid says:

    In chapter 8, the onPause haldning is done by a while (true) {try { gameloop.join(); } catch } construction, which does not work when tried for real. The game hangs upon any event. Accordingly, the construction has been commented out in the chapter 15 game library.Bewildered, I consulted the thicker book by Zechner, and noticed that the first timea SurfaceView based game is described, his construction is identical to yours. However,when he constructs his corresponding game library in a later chapter, he has added abreak; statement to break the while (true). This works like a charm!The new construction would be while (true) { try { gameloop.join(); break; } catch }It works! Now I can break and resume the game, tilt the phone to change orientation etc.

  • Pieris Hadjianastasi says:

    Good evening,

    I would like to ask if there is a manual explaining how to create threads (C++ Programming language) on the parallella board.

    Thank you in advance,

  • I’ve been looking for a post like this for an age

Leave a Reply