Giter Club home page Giter Club logo

opencl-examples's Introduction

Simple examples of OpenCL code

Simple examples of OpenCL code, which I am using to learn heterogeneous and GPU computing with OpenCL.

Examples included

  • add_numbers: add a list of numbers together. Includes detailed error handling which makes the code harder to read and understand
  • square_array: computes array^2 (I am playing mostly with this one)
  • sum_array: sums two arrays
  • cf4cl: testing OpenCL C wrapper
  • Hello_World: OpenCL "Hello World" by Apple
  • mandelbrot: my attempt at a simple Mandelbrot set calculation
  • N-BodySimulation: Apple's N-body simulator which clearly illustrates the speedup gained by using the GPU. Requires Xcode
  • RayTraced_Quaternion_Julia-Set_Example: Apple
  • rng: Illustrates how to generate random numbers in the host and in the GPU using the library clRNG
  • auger: generates random cosmic rays on an isotropic sky

The examples that clearly demonstrate the computational advantage of using a GPU for processing are N-BodySimulation, RayTraced_Quaternion_Julia-Set_Example (both developed by Apple programmers) and auger. For auger, I got impressive speedups of >200x compared to a serial code on the CPU.

Info about OpenCL devices

To learn about your OpenCL devices, try:

clinfo

To install clinfo on MacOS:

brew install homebrew/science/clinfo

References

Slides

Code walkthroughs

Courses

  • Hands-on OpenCL
  • AMD OpenCL course
  • Introduction to OpenCL, Manchester

Donate

If you are really happy with these examples, you can buy me a beer. Perhaps I could create a similar repo with CUDA examples?

TODO

opencl-examples's People

Contributors

rsnemmen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencl-examples's Issues

Platform independent build system

Would you mind to add CMake (or alternative platform independent) build scripts?
At the moment, the build procedure is limited to the Apple ecosystem. OpenCL is deprecated in macOS. The Xcode project files might become redundant at some point.

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.