Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
77cccdf
Tutorial 1 mos
gcielniak Jan 28, 2019
99e30c2
Tutorial 2 prototype
Jan 31, 2019
102a4ea
Tutorial 2 working draft
Feb 1, 2019
fd28ebd
Tutorial 2 working
Feb 4, 2019
12f5630
Tutorial 3 and 4 (draft)
Feb 4, 2019
8c0f846
Tutorial 4 working on Win
Feb 7, 2019
e2b9efc
Tutorial 2 Max OSX fix
Feb 8, 2019
f98314e
CL2 dependency and improved project structure
gcielniak Feb 9, 2019
ebae00b
Tutorial 4 and CL2 fix
Feb 9, 2019
4d5ebae
macOS CL2 dependency fixed
Feb 9, 2019
5c3d9b2
T3: hs_scan
Feb 19, 2019
f9acaf1
T3: Blelloch scan
gcielniak Feb 19, 2019
bcb12bf
T3: Blelloch fix
Feb 20, 2019
27c9995
T3: scan_hs fix
Feb 20, 2019
cdc733b
Create README.md
gcielniak Jan 6, 2020
1d98c15
Update README.md
gcielniak Jan 7, 2020
4f917c0
Renamed directories and added empty CMake
DreamingRaven Jan 13, 2020
b330910
Renamed tut 4 dir
DreamingRaven Jan 21, 2020
8685ad9
Added basic opencl files
DreamingRaven Jan 21, 2020
7754ba0
Removing these intermediary files
DreamingRaven Jan 21, 2020
d5dc6fc
Changed to whitelist .gitignore
DreamingRaven Jan 21, 2020
2205748
Changed name and minor compiler guard
DreamingRaven Jan 21, 2020
79e71c3
Added cmake version and title
DreamingRaven Jan 26, 2020
d69d0f1
Added automated builder for speed
DreamingRaven Jan 27, 2020
5cb6d3a
Added some helpful vars to CMAKE
DreamingRaven Jan 27, 2020
1e64f0b
Updated tut1 build no fail on exist dir
DreamingRaven Jan 27, 2020
750ee40
Renamed tutorial file to be short and no space
DreamingRaven Jan 27, 2020
1e403de
Adding local version of utils for testing
DreamingRaven Jan 27, 2020
cf06b48
Changing entry point to tutorial file
DreamingRaven Jan 27, 2020
fbfe96f
Added checking for opencl version 2
DreamingRaven Jan 27, 2020
5fb8c0f
Updated cmake build.sh to clean before build
DreamingRaven Jan 27, 2020
efce3cd
Added first experimental dockerfile
DreamingRaven Jan 28, 2020
547ae11
Finalised CMake and build.sh + license
DreamingRaven Jan 28, 2020
fe3f380
Added README for build and use instructions
DreamingRaven Jan 28, 2020
fa3e93d
Fixed docker
DreamingRaven Jan 28, 2020
52cef04
Fixed spelling in tut1 readme
DreamingRaven Jan 28, 2020
2245f89
Added updated instructions for ubuntu
DreamingRaven Jan 29, 2020
7a565da
Added note on docker versions
DreamingRaven Jan 29, 2020
ef812ca
Tutorial 2 fix - to reflect different pixel arrangement in CImg
Feb 10, 2020
a43d45e
Basic renaming and removing VS
DreamingRaven Feb 11, 2020
a8e187d
Working cmake for tut2 linux
DreamingRaven Feb 11, 2020
bb44661
Changed kernel copy to configure_file
DreamingRaven Feb 11, 2020
fe967ea
Working minimal cmake for linux
DreamingRaven Feb 11, 2020
4ae4933
Saving current state during tutorial
DreamingRaven Feb 11, 2020
6e77c9e
Added working CMake for tutorial 3
DreamingRaven Feb 24, 2020
a1e7d22
Added reductions file
DreamingRaven Feb 24, 2020
916a6dc
Changed requirement of X11 to not required
DreamingRaven Feb 24, 2020
50acb28
Making docker nicer to look at when interactive
DreamingRaven Feb 24, 2020
2d85e8c
Propogated fish niceness to other dockers
DreamingRaven Feb 24, 2020
83a67f4
Removed defunkt sln file from origin
DreamingRaven Feb 24, 2020
efd7dea
Added README for tut 2 and 3
DreamingRaven Feb 24, 2020
f00b3c4
ensuring necessary build files are included
DreamingRaven Feb 24, 2020
ef96d81
Added multi tutorial dockerfile
DreamingRaven Feb 24, 2020
d2825df
Overhauled main README
DreamingRaven Feb 24, 2020
92e31e7
Changed to single dockerfile strategy
DreamingRaven Feb 24, 2020
332be58
Fixed formatting of README being huge
DreamingRaven Feb 24, 2020
6de8fbd
Working tutorial 4 implementation
DreamingRaven Feb 24, 2020
dbe99c8
Added boost to dockerfile
DreamingRaven Feb 24, 2020
a0c9ecd
Adding boost libraries
DreamingRaven Feb 24, 2020
613d203
Corrected tutorial 3 naming
DreamingRaven Feb 24, 2020
5363042
Changed indent
DreamingRaven Feb 25, 2020
e21dbed
Added new CL files + renaming
DreamingRaven Feb 15, 2021
2821d97
Added libx11-dev for compilation
DreamingRaven Feb 15, 2021
da79642
Added opencl simulator for experimenting
DreamingRaven May 3, 2021
28777c1
Merge remote-tracking branch 'origin/master' into multi_os
smokhov Jun 22, 2025
cb542e4
[multi_os] sync renames Tutorial X to tutorial_X to avoid spaces
smokhov Jun 23, 2025
9b6ac36
[multi_os] remove duplicates after merge; saving diffs
smokhov Jun 23, 2025
52773ce
[multi_is] temporarily restore the original folder names.
smokhov Jun 23, 2025
04f56b7
Merge branch 'master' of https://github.com/DreamingRaven/OpenCL-Tuto…
smokhov Jun 23, 2025
6f41e34
Merge branch 'DreamingRaven-master' into multi_os
smokhov Jun 23, 2025
ef95d81
[build] fix outer cmake file
smokhov Jun 24, 2025
2f333a1
[build] allow optioncal cmake arguments in build.sh scripts.
smokhov Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ignore everything using whitelist strategy
# *
build/
# you can selectiveley allow files using the ! at the beginning of the line
#!lib/**/*.py # this would allow all python files in subdirectories of lib if enabled
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ desktop.ini
!x64/glut32.dll
!x86/glut32.dll


# Ignore everything that isnt already tracked
# please use "git add -f foo.txt" to force into tracking.
/*
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 2.6)

project("OpenCL Tutorials")

add_subdirectory("tutorial_1")
add_subdirectory("tutorial_2")
add_subdirectory("tutorial_3")
add_subdirectory("tutorial_4")
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# MIT License
# ===========
#
# Copyright (c) 2019 George Onoufriou (GeorgeRaven, archer, DreamingRaven)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

FROM nvidia/opencl

# setting up the place, making sure everything is installed, and getting the
# pesky CL/cl2.hpp
RUN mkdir -p /opencl_tutorials && \
apt update -y && \
apt install -y cmake make gcc git build-essential ocl-icd-opencl-dev \
fish neovim libboost-all-dev libx11-dev && \
git clone https://github.com/KhronosGroup/opencl-clhpp && \
cp opencl-clhpp/include/CL/* /usr/include/CL/ && \
rm -r /opencl-clhpp && \
echo "cd /opencl_tutorials\nexec fish" >> /root/.bashrc

COPY . /opencl_tutorials/
61 changes: 0 additions & 61 deletions OpenCL Tutorials.sln

This file was deleted.

38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# OpenCL Tutorials

## Requirements
Hey guys, each sub-directory containing tutorials is a holistic self inclusive directory, with all the necessary source code needed to run, but not necessarily to build. These tutorials require CL2.hpp but use depreciated features from opencl version 1.2. As such setting up your own system may be a tad strange.

I have included CMake files in each directory that can be run using the build.sh file, or manually. These files are to help you with the requirements, and they are quite strict. However if you have better things to do than worry about dependencies and all their nuances, then simply use docker instead, which will create some lightweight virtualmachines for you to work with instead automatically.

You need only 2 things, docker itself, and nvidia-container-toolkit, the latter is for GPU containers so you can use nvidia GPUs from inside any given container. For further information please see the following two sources:

https://nemesyst.readthedocs.io/en/latest/docker/ while not specifically for these tutorials it gives a good summary of how to use Dockerfiles.

https://wiki.archlinux.org/index.php/Docker the holy bible of linux, which shall endow you with super powers, including usage of docker, and installation of things like nvidia-container-toolkit.

## quick-start:

### create a docker image with all our sources/ everything ready
```sudo docker build -t archer/opencl-tuts .```

### run our docker image with all the GPUs available
```sudo docker run --gpus all -it archer/opencl-tuts bash```

### OR if you dont have nvidia gpus/ you dont want to use GPUs/ don't have nvidia-container-toolkit installed
```sudo docker run -it archer/opencl-tuts bash```

May the force be with you.

# Legacy

The presented tutorials were developed and tested on Windows 10, Visual Studio 2019 and [Intel SDK for OpenCL](https://software.intel.com/en-us/intel-opencl) so that can be run on Windows PCs in the computing labs. Tutorial 4 also depends on the Boost library. If you would like to develop OpenCL programs on your computer you have two options:
- replicate the [Windows setup](#windows-setup) from the computing labs;
Expand All @@ -12,3 +35,16 @@ The presented tutorials were developed and tested on Windows 10, Visual Studio 2
- OpenCL runtime: the runtime drivers are necessary to run the OpenCL code on your hardware. Both NVidia and AMD GPUs have OpenCL runtime included with their card drivers. For CPUs, you will need to install a dedicated driver by [Intel](https://software.intel.com/en-us/articles/opencl-drivers) or APP SDK for older AMD processors. It seems that AMD’s OpenCL support for newer CPU models was dropped unfortunately. You can check the existing OpenCL support on your PC using [GPU Caps Viewer](http://www.ozone3d.net/gpu_caps_viewer/).
- Boost library: install the recent [Boost library Windows binaries](https://sourceforge.net/projects/boost/files/boost-binaries/) (e.g. [boost_1_72_0](https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download) for VS2019). Then, add two environmental variables in the command line specifying the location of the include and lib Boost directories. For example, with boost_1_72_0 the commands would look as follows: `setx BOOST_INCLUDEDIR "C:\local\boost_1_72_0"` and `setx BOOST_LIBRARYDIR "C:\local\boost_1_72_0\lib64-msvc-14.2"`.
- A useful reference if you are struggling to get going: [OpenCL on Windows](http://streamcomputing.eu/blog/2015-03-16/how-to-install-opencl-on-windows/).

## Dependencies

### Ubuntu
- OpenCL development libs: `sudo apt install ocl-icd-opencl-dev`
- OpenCL runtime drivers
- Boost.Compute: from boost-1.61.0, it is part of the library. In particular situations, when you need to keep the older versions of boost (e.g. Ubuntu 16 + ROS Kinetic) you may need to apply the following ugly hack:
```
cd /tmp/
git clone git://github.com/kylelutz/compute.git
sudo mv /tmp/compute/include/boost/compute /usr/include/boost
sudo mv /tmp/compute/include/boost/compute.hpp /usr/include/boost/
```
196 changes: 0 additions & 196 deletions Tutorial 1/Tutorial 1.vcxproj

This file was deleted.

Loading