Getting Started with ComputeCpp for ARM®
The following instructions have been tested on HiKey 960 development board. Other hardware may work, but has not been tested and user experience may vary.
Pre-Requisites
- "mali_G71_r16p0-01rel0_linux_wayland_1" 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 from the Arm developer website.
Note: Without the correct 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 : UNTESTED - Untested OS
Bitcode targets : spirv64
CL_DEVICE_NAME : Mali-G71
CL_DEVICE_VENDOR : ARM
CL_DRIVER_VERSION : 2.0
CL_DEVICE_TYPE : CL_DEVICE_TYPE_GPU
********************************************************************************
You can now clone the ComputeCpp project 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.4.3), 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, otherwise the source can be cloned and built on a device.
The CMake variable
ComputCPP_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, ensuring the path you pass is to the root folder of your ComputeCpp release.
cmake ../samples -DComputeCPP_DIR=/path/to/computecp
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 output 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" step.
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.