Giter Site home page Giter Site logo

ehrhardt / exercises-solutions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from handsonopencl/exercises-solutions

0.0 1.0 0.0 429 KB

C, C++ and Python Code for Exercises and Solutions

License: Other

C 21.95% C++ 68.17% Makefile 2.20% Python 5.48% Cuda 1.30% Shell 0.02% Objective-C 0.88%

exercises-solutions's Introduction

Introduction

This set of freely available OpenCL exercises and solutions, together with the HandsOnOpenCL slides have been created by Simon McIntosh-Smith and Tom Deakin from the University of Bristol in the UK, with financial support from the Khronos Initiative for Training and Education (KITE) to promote the use of open standards.

Simon McIntosh-Smith is one of the foremost OpenCL trainers in the world, having taught the subject since 2009. He has run many OpenCL training courses at conferences such as SuperComputing and HiPEAC, and has provided OpenCL training for the UK's national supercomputing service and for the Barcelona Supercomputing Center. With OpenCL training experience ranging from half day on-site introductions within companies, to two-day intensive hands-on workshops for undergraduates, Simon can provide customized OpenCL training to meet your needs. Get in touch if you'd like to know more: .

For more about the authors, please visit Simon's home page or Tom's home page.

Source Code for the Exercises and Solutions

These examples together with the HandsOnOpenCL slides are released under the "attribution CC BY" creative commons license. In other words, you can use these in any way you see fit, including commercially, but please retain an attribution for the original authors, Simon McIntosh-Smith and Tom Deakin.

Getting started

Please download a tarball from Releases, or checkout the repository using git with the following command:

git clone git://github.com/HandsOnOpenCL/Exercises-Solutions.git

Found any issues or have some comments? Please submit a bug report in the Issue tab.

Pre-requisites

  • OpenCL 1.1 (or greater)
  • Python 2.7 (or greater)
  • C99 compiler (we use gcc) with OpenMP support (used for timing the runs [optional])
  • C++11 compiler (we use g++ or clang, also tested with Intel's icc)

Need help setting up OpenCL? Check out the first section in the lecture slides for information about setting up OpenCL on Linux for AMD (CPU, GPU, APU), Intel CPUs and NVIDIA GPUs.

Building

We assume here that your current working directory is the location of the source code; e.g. /path/to/Exercises-Solutions/Solutions/Exercise04/C

Python

Just run python source.py to run the code.

C

You must first run make to build the binary. We assume that your environment is set up to find the OpenCL library; if you have trouble try export CPATH=/path/to/OpenCL/include and export LD_LIBRARY_PATH=/path/to/OpenCL/lib.

You can also run make in the Examples/ and Solutions/ high-level directory; this calls all the sub-directory make files so all the examples can be built in one command. This also builds all the C++ examples.

Define the variable DEVICE in the Makefiles to be one of the OpenCL device types to vary the device type the C applications use. This can be done easily in the two global Makefiles found in the Exercises and Solutions directories. To use a GPU, for example, change the line DEVICE = CL_DEVICE_TYPE_DEFAULT to DEVICE=CL_DEVICE_TYPE_GPU.

Note: you can also edit each of the source files to use a specific device type, but we would recommend using the global Makefile method above.

Define the variable CC to change the C compiler used. By default, this is set to gcc for all platforms.

C++

You must first run make to build the binary. We assume that your environment is set up to find the OpenCL library.

You can also run make in the Examples/ and Solutions/ high-level directory; this calls all the sub-directory make files so all the examples can be built in one command. This also builds all the C examples.

Define the variable DEVICE in the Makefiles to be one of the OpenCL device types to vary the device type the C++ applications use. This can be done easily in the two global Makefiles found in the Exercises and Solutions directories. To use a GPU, for example, change the line DEVICE = CL_DEVICE_TYPE_DEFAULT to DEVICE=CL_DEVICE_TYPE_GPU.

Note: you can also edit each of the source files to use a specific device type, but we would recommend using the global Makefile method above.

Define the variable CPPC to change the C compiler used. By default, this is set to g++ on Linux, and clang++ on OS X.

Directory structure

The Exercises directory contains all the code needed to be handed out at the start of the tutorial for the exercises to be completed.

The Solutions directory contains sample code providing an example implementation which solves the exercises in the lecture notes.

Within both of the Exercises and Solutions directories, there is one subdirectory per exercise. Within each exercise subdirectory, there are further subdirectories for each implementation: C, C++ and Python.

exercises-solutions's People

Contributors

agitoz avatar benelgar avatar bmerry avatar gallagth avatar jrprice avatar raoulchartreuse avatar simonmcs avatar tomdeakin 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.