Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
5c225fa
char * cl_sdk_read_file(char * filename)
Melirius Oct 21, 2021
5ab156b
New line
Melirius Oct 21, 2021
cc6cbb9
Error code handling
Melirius Oct 22, 2021
392bf81
Idiomatic OpenCL error handling
Melirius Oct 22, 2021
d0be28b
Samples pick up INTERFACE targets
MathiasMagnus Oct 8, 2021
3706c4c
SDK recurses into all submodules
MathiasMagnus Oct 8, 2021
98e810a
Update submodules
MathiasMagnus Oct 8, 2021
e9e5bb2
Bump OpenCL-CLHPP commit
MathiasMagnus Oct 12, 2021
0fb8972
Initial Utility library
MathiasMagnus Oct 12, 2021
604f214
Added initial C++ saxpy
MathiasMagnus Oct 12, 2021
ddc9f26
Fix index range checks
MathiasMagnus Oct 12, 2021
a71d8aa
Initial kernel file
MathiasMagnus Oct 12, 2021
ca3c698
WIP
MathiasMagnus Oct 12, 2021
8256516
Fix CLI parsing SDK utility
MathiasMagnus Oct 14, 2021
87b6123
Added context to the queue
MathiasMagnus Oct 14, 2021
e23e6d5
Document saxpy sample
MathiasMagnus Oct 19, 2021
3179603
Change to lazy buffer
MathiasMagnus Oct 19, 2021
081135d
Add empty main
MathiasMagnus Oct 19, 2021
cbf5b88
Bump submodule hash
MathiasMagnus Oct 19, 2021
38e5ad7
Separate Util and SDK libs
MathiasMagnus Oct 19, 2021
7df3300
Promote OPENCL_SAMPLE_TEST as option
MathiasMagnus Oct 19, 2021
c685427
Initial CI
MathiasMagnus Oct 19, 2021
89c6321
Map git SSH protocol to HTTPS
MathiasMagnus Oct 19, 2021
ac26453
Disable recurse by runner
MathiasMagnus Oct 19, 2021
94f9711
Bump submodule hashes
MathiasMagnus Oct 21, 2021
f6a8484
Add note on beforescript fragment
MathiasMagnus Oct 21, 2021
b111cb1
Add options to control building & testing samples
MathiasMagnus Oct 21, 2021
45c37ed
Build samples next to ICD loader
MathiasMagnus Oct 21, 2021
83efeb3
Fetch and use TCLAP
MathiasMagnus Oct 21, 2021
005d158
Specify LIBRARY DESTINATION et al
MathiasMagnus Oct 21, 2021
f8bcfa4
Unsupported target_sources INTERFACE on 3.1
MathiasMagnus Oct 21, 2021
c0af945
Fix TCLAP handling
MathiasMagnus Oct 21, 2021
c47fd0f
Fixed build tree installation
MathiasMagnus Oct 22, 2021
378f62f
Add missing includes
MathiasMagnus Oct 22, 2021
391d940
Resolve dependency cycle
MathiasMagnus Oct 22, 2021
6dfa164
Add missing include
MathiasMagnus Oct 22, 2021
92a6663
Backport to C++14
MathiasMagnus Oct 22, 2021
cccdffc
Enable building and testing tests
MathiasMagnus Oct 22, 2021
93ac21b
Clarify config args
MathiasMagnus Oct 22, 2021
72df63c
recursively clone submodules (Mock missing)
MathiasMagnus Oct 22, 2021
4993bd9
Bump submodule hash
MathiasMagnus Oct 22, 2021
5437c05
Descriptive error message
MathiasMagnus Oct 22, 2021
97f4cca
Allow test failure temporarily
MathiasMagnus Oct 22, 2021
b31bd2b
cl_context cl_util_get_context(int plat_id, int dev_id, cl_device_typ…
Melirius Oct 25, 2021
272f5c1
WIP: Saxpy in C
Melirius Oct 28, 2021
82b8767
WIP includes
Melirius Oct 29, 2021
3acd160
WIP more includes
Melirius Oct 29, 2021
ea9a217
WIP cl_utils_build_program
Melirius Oct 29, 2021
7fc8082
Saxpy in C
Melirius Nov 1, 2021
362e196
Math library to link
Melirius Nov 1, 2021
49dc957
C11 for fopen_s and tmpfile_s
Melirius Nov 1, 2021
cbdb44a
Want extension of C lib
Melirius Nov 1, 2021
367f934
CMAKE_C_STANDARD_REQUIRED
Melirius Nov 1, 2021
d852e57
No Annex K funcs
Melirius Nov 2, 2021
71540fc
No inline
Melirius Nov 2, 2021
208bae8
Parse options error handling, std::string cl::util::read_text_file(co…
Melirius Nov 2, 2021
bf10d55
Uuups
Melirius Nov 3, 2021
3dcd43b
Separate Cargs
Melirius Nov 4, 2021
43754b1
Restructure, error handling in cl::util::read_text_file
Melirius Nov 4, 2021
a9c1d9c
Uniform cl_util_ prefix
Melirius Nov 4, 2021
ea73555
Bump CLHPP commit hash
MathiasMagnus Oct 25, 2021
65a016b
OpenCL-Headers track develop_stream
MathiasMagnus Oct 25, 2021
0ba1dc9
OpenCL-ICD-Loader track develop_stream
MathiasMagnus Oct 25, 2021
4e35951
Bump OpenCL-ICD-Loader hash
MathiasMagnus Oct 25, 2021
b8b8c19
Bump CLHPP hash
MathiasMagnus Oct 25, 2021
1cd9447
OpenCL-CLHPP track develop_stream
MathiasMagnus Oct 25, 2021
21e0dca
Bump CLHPP hash
MathiasMagnus Oct 25, 2021
287b416
Added custom device type CLI arg parse
MathiasMagnus Oct 27, 2021
0f1807a
Renamed Triplet to DeviceTriplet
MathiasMagnus Oct 27, 2021
cc771da
Added newline at eof
MathiasMagnus Oct 27, 2021
77b9f59
Minor corrections
MathiasMagnus Oct 27, 2021
e51c50a
WIP
MathiasMagnus Oct 25, 2021
01edd00
Reduce sample feature complete
MathiasMagnus Oct 26, 2021
2ef30ae
Update readme
MathiasMagnus Oct 26, 2021
3a695cd
Added event profiling utility
MathiasMagnus Oct 27, 2021
9736913
Added event profiling
MathiasMagnus Oct 27, 2021
ae9ddd7
Bump CLHPP hash
MathiasMagnus Oct 27, 2021
cc4d879
Simplify index range calculation.
Melirius Nov 3, 2021
4240335
C reduce sample should use 3.0 too
MathiasMagnus Nov 4, 2021
95b24ee
Add copyright notice
MathiasMagnus Nov 4, 2021
2e9ecc1
Add newline at eof
MathiasMagnus Nov 4, 2021
4fdaa5e
Simplify extension selection logic
MathiasMagnus Nov 4, 2021
1bbe93b
Fix size_t handling
MathiasMagnus Nov 4, 2021
1add023
Logically group flush to message
MathiasMagnus Nov 4, 2021
c9b012b
Change precedence of extensions
MathiasMagnus Nov 5, 2021
b27b46e
FMA in cppSaxpy
Melirius Nov 8, 2021
bd026bf
std::logic_error instead of std::exception
Melirius Nov 8, 2021
e87fd9b
C error handling, DeviceTriplet
Melirius Nov 8, 2021
f442d3a
Reduce C working
Melirius Nov 9, 2021
d92c56b
Uniform "OpenCL SDK includes"
Melirius Nov 9, 2021
92a6cbf
Image load/save, compilation options for reduce
Melirius Nov 10, 2021
e93626a
Minimum CMake fix
Melirius Nov 11, 2021
9b315a6
Uuups
Melirius Nov 11, 2021
631b53d
Another cl.h capitalizations
Melirius Nov 11, 2021
0050abe
Definition of size_t
Melirius Nov 11, 2021
60549e8
Nicier loops (by Navid)
Melirius Nov 11, 2021
3374a03
Fix bits overlapping in random ints range
Melirius Nov 11, 2021
4b5eda1
Bump Header hash
MathiasMagnus Nov 4, 2021
c5d6f2d
ROCm exec stub
MathiasMagnus Nov 4, 2021
2fa1b94
Build using Vcpkg
MathiasMagnus Nov 4, 2021
c0c1541
Simplify extension detection
MathiasMagnus Nov 4, 2021
40b0e71
Bump base image version
MathiasMagnus Nov 5, 2021
e82d06a
Install root package config
MathiasMagnus Nov 16, 2021
8a7cf63
Don't download TCLAP in CI
MathiasMagnus Nov 16, 2021
279b4c5
No TCLAP artifact
MathiasMagnus Nov 16, 2021
734f24f
SDK consumption tests
MathiasMagnus Nov 16, 2021
faae073
Fix missing stage name
MathiasMagnus Nov 16, 2021
65cb98d
Fix compiler passing
MathiasMagnus Nov 16, 2021
bdcd26f
Only MSVC should use ISO C secure exts
MathiasMagnus Nov 16, 2021
1096d96
Only use stable ROCm nodes
MathiasMagnus Nov 16, 2021
f0abd79
Fix dual-purpose API usage in C Util lib
MathiasMagnus Nov 16, 2021
2214803
Add histogram C++ example
neon60 Nov 10, 2021
0f6816a
Update readme
neon60 Nov 10, 2021
c16f43f
Merge request findings
neon60 Nov 15, 2021
ddeee88
Remove treshold
neon60 Nov 15, 2021
046fc79
Findings MR II
neon60 Nov 15, 2021
bd3e9b9
Remove barrier
neon60 Nov 15, 2021
51a927c
Add one barrier
neon60 Nov 15, 2021
e2cc406
Removed unused variable
neon60 Nov 15, 2021
acfd8aa
Updated build instructions
MathiasMagnus Nov 15, 2021
71f10f4
InteropWindow stub implementation
MathiasMagnus Oct 29, 2021
eb731b5
WIP
MathiasMagnus Oct 29, 2021
46fa5a3
Feature complete sample
MathiasMagnus Nov 3, 2021
d3d894d
Added generic windowing options
MathiasMagnus Nov 17, 2021
1a78e73
Fix grammar
MathiasMagnus Nov 17, 2021
2e8d7f9
Conditional CMake minimum bump
MathiasMagnus Nov 17, 2021
804d829
Bump image versions
MathiasMagnus Nov 17, 2021
5557039
Bump minimum CMake ver in CI
MathiasMagnus Nov 17, 2021
6ada8a1
Backport IMPT TGT
MathiasMagnus Nov 17, 2021
d76d13b
Remove explicit OpenGL::OpenGL
MathiasMagnus Nov 17, 2021
212bb78
Platform-specific OpenGL
MathiasMagnus Nov 17, 2021
6288873
Update minimum CMake for samples to 3.10
MathiasMagnus Nov 17, 2021
361cbbe
Include X11 headers
MathiasMagnus Nov 17, 2021
feadafa
No explicit CTOR call
MathiasMagnus Nov 19, 2021
c527075
More precise platform header includes
MathiasMagnus Nov 19, 2021
389bdb8
Install GLU in CI
MathiasMagnus Nov 19, 2021
829ddec
Refine dependency detection
MathiasMagnus Nov 19, 2021
e231240
Add deps to Util lib
MathiasMagnus Nov 19, 2021
33ad12a
GCC warning: expression result unused
MathiasMagnus Nov 19, 2021
5a255e0
MSVC warning: unreachable code
MathiasMagnus Nov 19, 2021
99c8046
Fix error variable
MathiasMagnus Nov 19, 2021
71dcc4a
Don't test GUI sample
MathiasMagnus Nov 19, 2021
5695872
Bump image versions
MathiasMagnus Nov 19, 2021
acdce5f
Take dep from image
MathiasMagnus Nov 19, 2021
48f5fdc
Declare tests only if both user and sample allows
MathiasMagnus Nov 22, 2021
c3cc6cf
WIP
MathiasMagnus Nov 22, 2021
85cac55
WIP
MathiasMagnus Nov 22, 2021
b26e5de
Utils and SDK lib separation cleanup
MathiasMagnus Nov 23, 2021
080eae0
Fix Linux linkage
MathiasMagnus Nov 23, 2021
90758db
Add missing source from unity build
MathiasMagnus Nov 23, 2021
091f69e
NOMINMAX
MathiasMagnus Nov 23, 2021
728a631
Don't export cl::Error
MathiasMagnus Nov 23, 2021
eed2cea
Update readme
MathiasMagnus Nov 23, 2021
36c3750
remove extra space
MathiasMagnus Nov 23, 2021
5c2b0dd
Remove dead code
MathiasMagnus Nov 23, 2021
07b6d8f
Print errors to cerr
MathiasMagnus Nov 23, 2021
33f4ff5
Working Blur C
Melirius Nov 15, 2021
bcf9e59
Bug in Intel CPU runtime?
Melirius Nov 15, 2021
582b431
Dual-pass blur
Melirius Nov 15, 2021
92db64b
Box blur in one and two passes
Melirius Nov 16, 2021
b3eabd7
WIP subgroup exchange
Melirius Nov 17, 2021
a89c35f
Fixing GCC compilation
Melirius Nov 17, 2021
a7169e2
No max defined in GCC
Melirius Nov 17, 2021
978a438
And link m here also
Melirius Nov 17, 2021
64ef158
Variant for review
Melirius Nov 17, 2021
732e091
WIP Gaussian blur
Melirius Nov 17, 2021
177cb27
Gauss dual-pass: simple and subgroup excahnge
Melirius Nov 18, 2021
fbccfa1
Pi fix
Melirius Nov 18, 2021
35c7887
Gauss local memory exchange
Melirius Nov 24, 2021
b35fdf1
Docs
Melirius Nov 26, 2021
b87003e
Docs
Melirius Nov 26, 2021
1d74bf4
File utils, stb fixed, some code cleaning
Melirius Nov 26, 2021
4401909
Correct naming restored
Melirius Nov 26, 2021
8781063
More consistent cl_uint for plat_id and dev_id
Melirius Nov 26, 2021
169b1ef
snprintf for Linux
Melirius Nov 26, 2021
88b62e2
Blur standard image added, error handling in image SDK improved, blur…
Melirius Nov 26, 2021
7428f5e
More cl_uint
Melirius Nov 26, 2021
0c96032
Even more cl_uint
Melirius Nov 29, 2021
c19c353
Bug in check_use_work_group_reduce fixed, macros for CLI added
Melirius Nov 29, 2021
184c5de
Error handling rewrite, `const`s
Melirius Nov 29, 2021
8c01a8e
Remove blanks, shift for Collatz
Melirius Nov 30, 2021
e31e95c
Integer limits header
Melirius Nov 30, 2021
1b3899a
Execution step added
Melirius Nov 30, 2021
574bfa9
Format and minor CI update (#2)
MathiasMagnus Dec 14, 2021
0812c13
Update README.md
MathiasMagnus Dec 15, 2021
b70488f
Update README.md
MathiasMagnus Dec 15, 2021
061a288
Fix RPATH
MathiasMagnus Dec 15, 2021
887655c
Copy kernels into build tree
MathiasMagnus Dec 15, 2021
25d51c5
Fix RPATH for build and install trees
MathiasMagnus Dec 16, 2021
4bbaa82
Handle warnings
MathiasMagnus Dec 16, 2021
901201c
Trigger CI
MathiasMagnus Dec 16, 2021
dc1060b
Apply clang format
MathiasMagnus Dec 16, 2021
5eea822
Bump submodule hashes to latest develop_stream
MathiasMagnus Dec 16, 2021
0f53986
Get MacOs same-build include dir fix
MathiasMagnus Dec 16, 2021
cade1f3
histogram declare kernel file
MathiasMagnus Dec 17, 2021
6d4e9e4
Bump subproject hashes
MathiasMagnus Dec 17, 2021
2d9d893
Exemplify 64-bit Windows build
MathiasMagnus Dec 17, 2021
036f98b
Add note on DLLs in install tree on Windows
MathiasMagnus Dec 17, 2021
7b99e06
Bump header hash
MathiasMagnus Dec 17, 2021
7bf2436
Cleaner command-line output
MathiasMagnus Jan 4, 2022
3b7fbe4
Remove GitLab CI
MathiasMagnus Jan 25, 2022
19d372c
Remove temporary redirection to Stream HPC repos
MathiasMagnus Jan 25, 2022
87e1d9d
Bump submodule hashes to have SDK base changes
MathiasMagnus Jan 25, 2022
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
25 changes: 17 additions & 8 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,25 @@ jobs:
submodules: recursive
- name: Build
run: |
mkdir build
cd build
if [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then
sudo apt update
sudo apt install -y libtclap-dev libglm-dev libglew-dev libsfml-dev libstb-dev libidn11 libx11-dev libxrandr-dev libxi-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libudev-dev
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know Ubuntu isn't universal, but it might be helpful to put this in the readme. Or at least the ones that aren't there by default on a desktop install.

I had to install these to get the SDK to build:

sudo apt install libtclap-dev libstb-dev libglew-dev libsfml-dev libglm-dev

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These packages are mentioned in the OpenCL-Guide in the Linux guide here. These are only required if one builds the samples and not otherwise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is only needed if the package dependencies aren't satisfied via vcpkg?

Regardless, I agree it would be worth including this as an alternative in the README. Installing via the OS package manager will likely be smoother than vcpkg (getting it working on Ubuntu wasn't trivial) and this is the mechanism we're testing in CI.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One can install them either way. It's user preference.

elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
brew install tclap glm glew sfml mesa-glu
git clone https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg install stb
TOOLCHAIN_ARG="-D CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake"
fi
if [[ "${{ matrix.compiler }}" == "gcc" ]]; then
CC=gcc
CXX=g++
elif [[ "${{ matrix.compiler }}" == "clang" ]]; then
CC=clang
CXX=clang++
fi
cmake -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX ../
make -j2 VERBOSE=1
cmake -D CMAKE_C_COMPILER=$CC -D CMAKE_CXX_COMPILER=$CXX $TOOLCHAIN_ARG -S . -B build
cmake --build ./build --verbose --parallel 2
buildwin:
needs: format
name: Build Windows
Expand All @@ -50,10 +58,11 @@ jobs:
submodules: recursive
- name: Build
run: |
mkdir build
cd build
cmake ../
cmake --build .
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg.exe --triplet=x64-windows install sfml tclap glm glew stb
cmake -D CMAKE_TOOLCHAIN_FILE=.\vcpkg\scripts\buildsystems\vcpkg.cmake -S . -B build
cmake --build ./build -- /verbosity:minimal /maxCpuCount /noLogo

python:
name: Exercise Python examples on ${{matrix.os}}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ install/
# vim
*~
.*.sw[op]
.vscode
10 changes: 10 additions & 0 deletions .gitlab/ubuntu-18.04-rocm.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM streamhpc/opencl-sdk-base:ubuntu-18.04-20211119
RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive ; \
# Register ROCm APT repo
wget --quiet --recursive --no-directories --no-parent "https://repo.radeon.com/amdgpu-install/latest/ubuntu/bionic/" --accept "amdgpu-install-*_all.deb" ; \
apt install -y -qq ./amdgpu-install-*_all.deb libnuma-dev initramfs-tools ; \
apt update -qq; \
rm ./amdgpu-install-*_all.deb ; \
# Install OpenCL package only (and dependency)
amdgpu-install -y --usecase=opencl
45 changes: 45 additions & 0 deletions .gitlab/ubuntu-18.04.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:18.04 AS apt-installs
RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive ; \
apt update -qq; \
# install wget to download repository keys and CMake tarballs
# install software-properties-common for the apt-add-repository command
apt install -y -qq wget software-properties-common ; \
# Canonical hosts recent GCC compilers in ubuntu-toolchain-r/test
apt-add-repository -y ppa:ubuntu-toolchain-r/test ; \
# LLVM hosts most toolchain in separate repos. We only register those absent from ubuntu-toolchain-r/test
wget -q -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - ; \
apt-add-repository -y 'deb [arch=amd64] https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main' ; \
apt-add-repository -y 'deb [arch=amd64] https://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main' ; \
apt-add-repository -y 'deb [arch=amd64] https://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main' ; \
# install ninja, GCC 7-10, LLVM 8-13 and build-essential to get linkers, etc.
# install git to download dependencies
# install ruby to run CMock
# install libidn11 which CMake 3.1.3 only depends on
# install ca-certificates to `git clone` via HTTPS
# install SFML dependencies
# libx11-dev libxrandr-dev libxi-dev
# mesa-common-dev for gl.h
# libgl1-mesa-dev for libGL.so
# libglu1-mesa-dev for glu.h
# libudev-dev
# install Vcpkg dependencies
# curl zip unzip tar
apt install -y -qq build-essential g++-7 g++-8 g++-9 g++-10 clang-8 clang-9 clang-10 clang-11 clang-12 clang-13 ninja-build git ruby libidn11 ca-certificates libx11-dev libxrandr-dev libxi-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libudev-dev curl zip unzip tar

# install CMake minimum (3.0.2 (Headers, ICD Loader), 3.1.3 (CLHPP), 3.10.3 (SDK)) and latest (3.21.2)
RUN mkdir -p /opt/Kitware/CMake ; \
wget -c https://github.com/Kitware/CMake/releases/download/v3.0.2/cmake-3.0.2-Linux-i386.tar.gz -O - | tar -xz --directory /opt/Kitware/CMake ; \
mv /opt/Kitware/CMake/cmake-3.0.2-Linux-i386 /opt/Kitware/CMake/3.0.2 ; \
wget -c https://github.com/Kitware/CMake/releases/download/v3.1.3/cmake-3.1.3-Linux-x86_64.tar.gz -O - | tar -xz --directory /opt/Kitware/CMake ; \
mv /opt/Kitware/CMake/cmake-3.1.3-Linux-x86_64 /opt/Kitware/CMake/3.1.3 ; \
wget -c https://github.com/Kitware/CMake/releases/download/v3.10.3/cmake-3.10.3-Linux-x86_64.tar.gz -O - | tar -xz --directory /opt/Kitware/CMake ; \
mv /opt/Kitware/CMake/cmake-3.10.3-Linux-x86_64 /opt/Kitware/CMake/3.10.3 ; \
wget -c https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2-linux-x86_64.tar.gz -O - | tar -xz --directory /opt/Kitware/CMake ; \
mv /opt/Kitware/CMake/cmake-3.21.2-linux-x86_64 /opt/Kitware/CMake/3.21.2

# install Vcpkg
RUN git clone --depth 1 https://github.com/Microsoft/vcpkg.git /opt/Microsoft/vcpkg ; \
/opt/Microsoft/vcpkg/bootstrap-vcpkg.sh ; \
# install SFML, TCLAP, GLM
/opt/Microsoft/vcpkg/vcpkg install sfml tclap glm glew
88 changes: 75 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,91 @@

cmake_minimum_required(VERSION 3.0)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)

project(OpenCL-SDK)
project(OpenCL-SDK
VERSION 1.0
LANGUAGES
C CXX
)

include(CMakeDependentOption)
option(OPENCL_SDK_BUILD_SAMPLES "Build sample code" ON)
cmake_dependent_option(OPENCL_SDK_BUILD_OPENGL_SAMPLES "Build OpenCL-OpenGL interop sample code" ON OPENCL_SDK_BUILD_SAMPLES OFF)
cmake_dependent_option(OPENCL_SDK_TEST_SAMPLES "Add CTest to samples (where applicable)" ON OPENCL_SDK_BUILD_SAMPLES OFF)

include(CTest)

if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release" CACHE PATH "Build Type" FORCE)
endif()

set(OPENCL_ICD_LOADER_HEADERS_DIR
"${PROJECT_SOURCE_DIR}/external/OpenCL-Headers" CACHE PATH "Path to OpenCL
Headers")

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/install" CACHE PATH "Install Path" FORCE)
endif()

set(OPENCL_SDK_INCLUDE_DIRS
"${PROJECT_SOURCE_DIR}/external/OpenCL-Headers"
"${PROJECT_SOURCE_DIR}/external/OpenCL-CLHPP/include")
add_subdirectory(external/OpenCL-Headers)
add_subdirectory(external/OpenCL-ICD-Loader)
add_subdirectory(external/OpenCL-CLHPP)

if(OPENCL_SDK_BUILD_SAMPLES)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
add_subdirectory(third_party/cargs)
find_package(TCLAP REQUIRED)
find_package(Stb REQUIRED)
if(OPENCL_SDK_BUILD_OPENGL_SAMPLES)
cmake_minimum_required(VERSION 3.10) # SFML 2 won't find Freetype::Freetype under 3.10
find_package(OpenGL REQUIRED)
if(CMAKE_SYSTEM_NAME MATCHES Linux) # TODO: Add EGL support
# OpenGL doesn't explicitly depend on X11 (as of CMake v3.2) but we'll need it
find_package(X11 REQUIRED)
endif()
find_package(GLEW REQUIRED)
if(NOT TARGET OpenGL::GLU)
# GLU is a dependency of GLEW but it's not advertized as an OpenGL COMPONENT
message(FATAL_ERROR "GLEW depends on GLU but was not found.")
endif()
find_package(SFML 2
REQUIRED
COMPONENTS window graphics
)
find_package(GLEW REQUIRED)
find_package(glm CONFIG REQUIRED)
endif(OPENCL_SDK_BUILD_OPENGL_SAMPLES)
endif(OPENCL_SDK_BUILD_SAMPLES)

add_subdirectory(lib)
if(OPENCL_SDK_BUILD_SAMPLES)
add_subdirectory(samples)
endif()

add_subdirectory(${PROJECT_SOURCE_DIR}/external/OpenCL-ICD-Loader)
add_subdirectory(${PROJECT_SOURCE_DIR}/samples)
include(GNUInstallDirs)
file(
WRITE ${PROJECT_BINARY_DIR}/OpenCL/OpenCLConfig.cmake
[[
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_LIST_DIR} PATH)
include("${PARENT_DIR}/OpenCLHeaders/OpenCLHeadersConfig.cmake")
include("${PARENT_DIR}/OpenCLICDLoader/OpenCLICDLoaderConfig.cmake")
include("${PARENT_DIR}/OpenCLHeadersCpp/OpenCLHeadersCppConfig.cmake")
include("${PARENT_DIR}/OpenCLUtils/OpenCLUtilsConfig.cmake")
include("${PARENT_DIR}/OpenCLUtilsCpp/OpenCLUtilsCppConfig.cmake")
]]
)
set(config_package_location ${CMAKE_INSTALL_DATADIR}/cmake/OpenCL)
install(
FILES ${PROJECT_BINARY_DIR}/OpenCL/OpenCLConfig.cmake
DESTINATION ${config_package_location}
)

set_target_properties(OpenCL PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
unset(CMAKE_SIZEOF_VOID_P)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/OpenCL/OpenCLConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenCL/OpenCLConfigVersion.cmake
DESTINATION ${config_package_location}
)
69 changes: 43 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# OpenCL-SDK (in development)
# OpenCL<sup>TM</sup> SDK (in development)

This is the Khronos OpenCL SDK. It brings together all the components needed to
develop OpenCL applications:
Expand All @@ -13,40 +13,57 @@ It also contains resources useful to OpenCL developers:
- Code samples (`samples/`)
- Documentation (`docs/`)

## Setting Up the SDK
## Build Instructions

This repository uses sub-modules for the OpenCL Headers, OpenCL C++ bindings, and OpenCL ICD Loader.
### Dependencies

To clone a new repository with all sub-modules included, use the `--recursive` option.
Note that this option clones all sub-modules and their dependencies, which are not required for the OpenCL SDK:
- This repository uses sub-modules for the OpenCL Headers, OpenCL C++ bindings, and OpenCL ICD Loader and some of their transitive dependencies.

```sh
$ git clone --recursive https://github.com/KhronosGroup/OpenCL-SDK.git
```
- To clone a new repository with all sub-modules included, use the `--recursive` option. Note that this option clones all sub-modules and their dependencies, which are not strictly required for the OpenCL SDK:

Alternatively, to clone only the sub-modules for the OpenCL SDK, first clone this repository without sub-modules included:
git clone --recursive https://github.com/KhronosGroup/OpenCL-SDK.git

```sh
$ git clone https://github.com/KhronosGroup/OpenCL-SDK.git
```
- Alternatively, to clone only the sub-modules for the OpenCL SDK, first clone this repository without sub-modules included then setup submodules non-recursively:

Then setup sub-modules:
git clone https://github.com/KhronosGroup/OpenCL-SDK.git
git submodule init
git submodule update

```sh
$ git submodule init
$ git submodule update
```
- The SDK uses CMake for its build system.
If CMake is not provided by your build system or OS package manager, please consult the [CMake website](https://cmake.org).

## Building the Samples
- The SDK samples depend on

This repository uses CMake as its build system.
The suggested build directory is `build`.
- [Templatized C++ Command Line Parser Library](http://tclap.sourceforge.net/) (aka. TCLAP)
- [Simple and Fast Multimedia Library](https://www.sfml-dev.org/) (aka. SFML)
- [OpenGL Mathematics](https://glm.g-truc.net/0.9.9/index.html) (aka. GLM)

To generate build files, use for example:
### Example Build

```sh
$ mkdir build && cd build
$ cmake ..
```
> The example build guide uses [Vcpkg](https://vcpkg.io/en/index.html) to fetch all dependencies. Note that Vcpkg is _not_ a requirement and is only used for convenience. One may provide dependencies through any other CMake mechanism. For details on how to install Vcpkg, refer to it's [Getting Started Guide](https://vcpkg.io/en/getting-started.html). The example build assumes targeting 64-bit Windows.

Then build with the generated build files.
1. Clone this repo with the rest of the OpenCL SDK components:

git clone https://github.com/KhronosGroup/OpenCL-SDK.git
git submodule init
git submodule update

1. Install dependencies

vcpkg --triplet x64-windows install sfml tclap glm

1. Build and install SDK with samples and no downstream unit tests

cmake -A x64 `
-D BUILD_TESTING=OFF `
-D BUILD_DOCS=OFF `
-D BUILD_EXAMPLES=OFF `
-D BUILD_TESTS=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=ON `
-D OPENCL_SDK_TEST_SAMPLES=OFF `
-D CMAKE_TOOLCHAIN_FILE=/vcpkg/install/root/scripts/buildsystems/vcpkg.cmake `
-D VCPKG_TARGET_TRIPLET=x64-windows
-B ./OpenCL-SDK/build -S ./OpenCL-SDK
cmake --build ./OpenCL-SDK/build --target install

_(Note: on Linux paths to dependent libraries are automatically handled by RPATH in both the build and install tree. On Windows all DLLs have to be on the `PATH`. Vcpkg copies dependent DLLs to the build tree, but in order to do the same in the install tree, sufficiently new CMake version is required. CMake 3.21 instroduces `install(IMPORTED_RUNTIME_ARTIFACTS)`.)_
30 changes: 30 additions & 0 deletions cmake/Modules/FindStb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# - Find Stb
# Find the Stb headers
#
# Stb_INCLUDE_DIR - where to find the TCLAP headers
# Stb_FOUND - True if TCLAP is found

if (Stb_INCLUDE_DIR)
# already in cache, be silent
set (Stb_FIND_QUIETLY TRUE)
endif (Stb_INCLUDE_DIR)

# find the headers
find_path (Stb_INCLUDE_PATH stb_image.h
PATHS
${Stb_DIR}
PATH_SUFFIXES
include
include/stb
)

# handle the QUIETLY and REQUIRED arguments and set Stb_FOUND to
# TRUE if all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (Stb "Stb (https://github.com/nothings/stb) could not be found. Set Stb_INCLUDE_PATH to point to the headers adding '-D Stb_INCLUDE_PATH=/path/to/stb' to the cmake command." Stb_INCLUDE_PATH)

if (Stb_FOUND)
set (Stb_INCLUDE_DIR ${Stb_INCLUDE_PATH})
endif (Stb_FOUND)

mark_as_advanced(Stb_INCLUDE_PATH)
28 changes: 28 additions & 0 deletions cmake/Modules/FindTCLAP.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# - Find TCLAP
# Find the TCLAP headers
#
# TCLAP_INCLUDE_DIR - where to find the TCLAP headers
# TCLAP_FOUND - True if TCLAP is found

if (TCLAP_INCLUDE_DIR)
# already in cache, be silent
set (TCLAP_FIND_QUIETLY TRUE)
endif (TCLAP_INCLUDE_DIR)

# find the headers
find_path (TCLAP_INCLUDE_PATH tclap/CmdLine.h
PATHS
${CMAKE_SOURCE_DIR}/include
${CMAKE_INSTALL_PREFIX}/include
)

# handle the QUIETLY and REQUIRED arguments and set TCLAP_FOUND to
# TRUE if all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (TCLAP "TCLAP (http://tclap.sourceforge.net/) could not be found. Set TCLAP_INCLUDE_PATH to point to the headers adding '-DTCLAP_INCLUDE_PATH=/path/to/tclap' to the cmake command." TCLAP_INCLUDE_PATH)

if (TCLAP_FOUND)
set (TCLAP_INCLUDE_DIR ${TCLAP_INCLUDE_PATH})
endif (TCLAP_FOUND)

mark_as_advanced(TCLAP_INCLUDE_PATH)
2 changes: 1 addition & 1 deletion external/OpenCL-Headers
Submodule OpenCL-Headers updated 3 files
+13 −0 CL/cl_ext.h
+31 −8 CMakeLists.txt
+17 −4 README.md
Loading