Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
06a9071
Initial commit
gcielniak May 31, 2015
bcbccf2
Skeleton code
gcielniak May 31, 2015
6efb39b
MacOS compatibility
May 31, 2015
6fbc3f8
C++ bindings version
gcielniak Aug 25, 2015
c63caf6
Simple Program
gcielniak Aug 26, 2015
d208c4e
Buffer allocation
gcielniak Aug 27, 2015
4af80d4
Visual Studio version
gcielniak Nov 4, 2015
fcf05f1
Code moved to Utilities
gcielniak Nov 4, 2015
8ec55d1
Device/platform selection + simple profiling
gcielniak Nov 5, 2015
27f57d3
32 bit project - easier debugging
gcielniak Dec 11, 2015
72a365c
Basic Tutorial cont.
gcielniak Dec 18, 2015
5ff16d6
Simple profiling added
gcielniak Jan 5, 2016
6f93366
Memory profiling
gcielniak Jan 5, 2016
1042365
Kernels
gcielniak Jan 6, 2016
7f8be30
updated project files
Jan 17, 2019
41fa785
Merge pull request #1 from gcielniak/old_master
gcielniak Jan 17, 2019
45dd37f
workshop 4 updated file names
Jan 17, 2019
1f67549
workshop 4 updated solution file
Jan 17, 2019
a88b1e7
minor fixes in projects and kernels
Jan 23, 2019
e125e3b
VS improvements
gcielniak Jan 27, 2019
c556d31
Tutorial 2 fixes
gcielniak Jan 27, 2019
ccc6234
Final fix
gcielniak Jan 27, 2019
94ccbd5
Merge pull request #2 from gcielniak/porta_fix
gcielniak Jan 27, 2019
dfb0e25
glut bins
gcielniak Jan 27, 2019
d13531a
Merge pull request #3 from gcielniak/porta_fix
gcielniak Jan 27, 2019
c17ea9b
Create README.md
gcielniak Jan 27, 2019
6408427
Update README.md
gcielniak Jan 27, 2019
b2750c3
Update README.md
gcielniak Jan 27, 2019
86a3f28
Tutorial 4 boost fix
Jan 28, 2019
fd2a459
Merge pull request #4 from gcielniak/vs_fix
gcielniak Jan 28, 2019
debad74
Change part numbers based upon workshop
andrewsmith1996 Jan 28, 2019
36baadf
Merge pull request #1 from andrewsmith1996/andrewsmith1996-step-numbe…
andrewsmith1996 Jan 28, 2019
9e8cccd
code documentation fixes
gcielniak Jan 28, 2019
d991d96
Merge pull request #5 from andrewsmith1996/master
gcielniak Jan 28, 2019
6f3ef4b
Merge pull request #6 from gcielniak/docu_fix
gcielniak Jan 28, 2019
fc00453
Correct Spelling and others
Starystars67 Jan 30, 2019
87a7ad0
Merge pull request #7 from Starystars67/patch-1
gcielniak Jan 30, 2019
d5d8984
T3: HS and BL scans added
gcielniak Feb 19, 2019
0ed2924
T3: Blelloch fix
Feb 20, 2019
1a69967
T3: scan_hs fix
Feb 20, 2019
f1e0b90
2019 VS upgrade
gcielniak Jan 10, 2020
dcd406e
VS2019 ready for 2019/20
Jan 13, 2020
868f1b3
Update README.md
gcielniak Jan 13, 2020
92b3df4
Update README.md
gcielniak Jan 13, 2020
da6ad16
Update README.md
gcielniak Jan 13, 2020
7c1c6a8
Update README.md
gcielniak Jan 13, 2020
f0b04a7
Update README.md
gcielniak Jan 13, 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
347df7a
Fixes misnumbering of Tutorial 1 parts in comments
samconran Jan 29, 2020
eb36b32
Merge pull request #9 from samconran/T1_part_numbering
gcielniak Jan 29, 2020
7a565da
Added note on docker versions
DreamingRaven Jan 29, 2020
6cb9ea5
VS project settings changed to prevent the console window from closing.
gcielniak Jan 29, 2020
2d586ad
Tutorial 2 fix - to reflect different pixel arrangement in CImg
Feb 10, 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
6b21c7f
w2 boundary condition handling
gcielniak Feb 20, 2020
8486b31
Merge branch 'master' into w2_fix
gcielniak Feb 20, 2020
fcbe451
Merge pull request #10 from gcielniak/w2_fix
gcielniak Feb 20, 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
91269b5
boundary checking in atomic scan
Mar 11, 2020
b7fb2df
Merge pull request #11 from gcielniak/scan_fix
gcielniak Mar 11, 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
28 changes: 26 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
build/
.vs/
#CMake
build

#Visual Studio
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/*
x86/*
bld/
[Oo]bj/
.vs
desktop.ini

*.opensdf
*.sdf
*.suo
*.user

!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: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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")
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/
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
# Dependencies
# OpenCL Tutorials

## Ubuntu
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;
- use the [multi_os](https://github.com/gcielniak/OpenCL-Tutorials/tree/multi_os) branch, which should allow for running the tutorials on different operating systems, programming environments and OpenCL SDKs. There is limited documentation for this option, however, so you should only choose that option if you are comfortable with installing custom libraries on your specific OS.

## Windows Setup
- OS + IDE: Windows 10, Visual Studio 2019
- OpenCL SDK: the SDK enables you to develop and compile the OpenCL code. In our case, we use [Intel SDK for OpenCL Applications](https://software.intel.com/en-us/intel-opencl). You are not tied to that choice, however, and can use SDKs by NVidia or AMD - just remember to make modifications in the project include paths. Each SDK comes with a range of additional tools which make development of OpenCL programs easier.
- 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:
Expand Down
43 changes: 0 additions & 43 deletions Tutorial 1/CMakeLists.txt

This file was deleted.

62 changes: 0 additions & 62 deletions Tutorial 2/CMakeLists.txt

This file was deleted.

43 changes: 0 additions & 43 deletions Tutorial 3/CMakeLists.txt

This file was deleted.

34 changes: 0 additions & 34 deletions Tutorial 4/CMakeLists.txt

This file was deleted.

Loading