Code Monkey home page Code Monkey logo

simpleopenclsamples's Introduction

Simple OpenCLTM Samples

build

This repo contains simple OpenCL samples that demonstrate how to build OpenCL applications using only the Khronos-provided headers and libs. All samples have been tested on Windows and Linux.

Most of the samples are written in C and C++ using the OpenCL C++ bindings. A few of the samples have been ported to Python using PyOpenCL.

Code Structure

README.md               This file
LICENSE                 License information
CMakeLists.txt          Top-level CMakefile
external/               External Projects (headers and libs)
include/                Include Files (OpenCL C++ bindings)
samples/                Samples
tutorials/              Tutorials

How to Build the Samples

The samples require the following external dependencies:

OpenCL Headers:

git clone https://github.com/KhronosGroup/OpenCL-Headers external/OpenCL-Headers

OpenCL ICD Loader:

git clone https://github.com/KhronosGroup/opencl-icd-loader external/opencl-icd-loader

Many samples that use extensions additionally require the OpenCL Extension Loader:

git clone https://github.com/bashbaug/opencl-extension-loader external/opencl-extension-loader

After satisfying the external dependencies create build files using CMake. For example:

mkdir build && cd build
cmake ..

Then, build with the generated build files.

How to Run the Samples

To run the samples, you will need to obtain and install an ICD loader and an OpenCL implementation (ICD) that supports the cl_khr_icd extension.

The ICD loader is likely provided by your operating system or an OpenCL implementation. If desired, you may use the ICD loader that is built along with these OpenCL samples. The OpenCL implementation will likely be provided by your OpenCL device vendor. There are several open source OpenCL implementations as well.

Further Reading

A Note About Error Checking

For brevity, most samples do not include error checking. This means that a sample may crash or incorrectly report success if an OpenCL error occurs. By defining the CMake variable SAMPLES_ENABLE_EXCEPTIONS many samples can instead throw an exception if an OpenCL error occurs.

Tools like the OpenCL Intercept Layer can also be useful to detect when an OpenCL error occurs and to identify the cause of the error.

License

These samples are licensed under the MIT License.

Notes:


OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.

* Other names and brands may be claimed as the property of others.

simpleopenclsamples's People

Contributors

bashbaug avatar cqcallaw avatar dependabot[bot] avatar elliottslaughter avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.