ComputeCpp CE for Arm®

This guide was created for versions: v0.1.0 - Latest

Pre-Requisites – OpenCL Drivers

In order to use ComputeCpp with our Arm release you first need to obtain OpenCL drivers with SPIR/SPIR-V support for the device you are using.

These need to be obtained from the manufacturer of the hardware. Alternatively, you can contact us to find out about using ComputeAorta, our implementation of OpenCL.

Note: Without an OpenCL driver ComputeCpp will fail to link.

Download ComputeCpp For Arm

You can download the Arm version of ComputeCpp CE from the downloads page.

Getting Started

To start using ComputeCpp on your Arm hardware, copy the downloaded archive onto the device and extract this to "user/local/computecpp".

Now run this command to check if your hardware is supported by ComputeCpp

>./user/local/computecpp/bin/computecpp_info

If the output of this command includes an error about "libOpenCL" then it cannot find the OpenCL drivers required for your device.

If the drivers are successfully installed the output will look something like this.

********************************************************************************
ComputeCpp Info 
********************************************************************************
Toolchain information:

GLIBC version: 2.24
GLIBCXX: 20160609
This version of libstdc++ is supported.
********************************************************************************
Device Info:

Discovered 1 devices matching:
  platform    : <any>
  device type : <any>
--------------------------------------------------------------------------------
Device 0:
  Device is supported                     : NO - Device does not support SPIR
  CL_DEVICE_NAME                          : <Device name>
  CL_DEVICE_VENDOR                        : ARM
  CL_DRIVER_VERSION                       : 2.0
  CL_DEVICE_TYPE                          : CL_DEVICE_TYPE_GPU
********************************************************************************

Although the message suggests that the device is not supported this is actually incorrect and can be used with ComputeCpp.

You can now clone the ComputeCpp package from GitHub that contains the sample code so that it can be built and executed.

Set up the ComputeCpp build environment

The sample code for ComputeCpp is built using CMake (minimum v 3.2.2), you can find out more about CMake here.

Most Linux platforms also offer CMake through a packaging system such as wget or apt-get making it easy to install.

The CMake variable

ComputeCpp_DIR

must be set in order to build with ComputeCpp.

This should be set to the root directory of the ComputeCpp install (i.e the directory with the folders bin, include, lib)

Build a ComputeCpp application

We’ll now build the simple_vector_add sample code, this application adds two vectors of scalar type on a SYCL device.

First in the terminal change to the root directory of the package you cloned from GitHub. This is the folder containing "samples" and "documents"

mkdir build

Now change into that directory

cd build

Then call cmake to build all the sample code in the package

cmake ../samples -DComputeCpp_DIR=/path/to/computecpp
make

This will build the executable for the sample code.

Execute a ComputeCpp application

In the "simple_vector_add" folder simply call the generated file to execute

cd simple_vector_add
./simple_vector_add

When successful you will see an ouput in the terminal window whether the programming executed successfully or not.

Modify a ComputeCpp application

This sample application adds two simple vectors together. These vectors are held in arrays within the code.

The application adds A and B together and puts the sum into C, and also adds D and E together and puts them in F.

Change some of the numbers in the arrays, build again using the make command and then execute again in the same way as in the "Execute a ComputeCpp application"

make

We now recommend that you find out more about how ComputeCpp application are structured in the Anatomy Of A ComputeCpp Application article.

You can also explore the other Sample Code applications and read the ComputeCpp Integration Guide.