Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 1.02 KB

README.md

File metadata and controls

28 lines (24 loc) · 1.02 KB

opencl-examples

This repository contains examples of running OpenCL kernels from C/C++. It requires OpenCL to be installed on a machine. To ensure that OpenCL is installed run the following command which will list all the available OpenCL devices in the system:

$ clinfo

The examples in this repository have split the application code to two parts:

  • host.cpp: The host code contains the functionality for the initialization of the OpenCL data structures and the input data as well as the orchestration of the execution on platform <platform_id>.
  • mykernel.cl: The kernel code is the parallel code that can run on a heterogeneous hardware accelerator (e.g. multicore CPU, GPU).

To run the examples, open a terminal and execute:

For Saxpy:

$ cd saxpy
$ make
$ # ./host <platform_id> <elements>
$ ./host 1 1024

For Matrix Multiplication:

To run the MatrixMultiplication example, open a terminal and execute:

$ cd mxm
$ make
$ # ./host <platform_id> <elements>
$ ./host 1 1024