Skip to content

Commit 4343e26

Browse files
committed
Merge branch 'main' into nv-subgroup-emu
2 parents caa5cea + d79c921 commit 4343e26

File tree

152 files changed

+2346
-630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+2346
-630
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
check:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2222

2323
- name: Check Tabs
2424
run: |
@@ -39,7 +39,7 @@ jobs:
3939
runs-on: ${{matrix.os}}
4040

4141
steps:
42-
- uses: actions/checkout@v4
42+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4343

4444
- name: Get Ubuntu OpenGL Dependencies
4545
if: matrix.os == 'ubuntu-latest'
@@ -48,24 +48,31 @@ jobs:
4848
sudo apt-get install -y libglfw3-dev
4949
5050
- name: Get OpenCL Headers
51-
uses: actions/checkout@v4
51+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5252
with:
5353
repository: KhronosGroup/OpenCL-Headers
5454
path: external/OpenCL-Headers
5555

5656
- name: Get OpenCL ICD Loader
57-
uses: actions/checkout@v4
57+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5858
with:
5959
repository: KhronosGroup/OpenCL-ICD-Loader
6060
path: external/opencl-icd-loader
6161

6262
- name: Get OpenCL Extension Loader
6363
if: matrix.ext == 'YES'
64-
uses: actions/checkout@v4
64+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6565
with:
6666
repository: bashbaug/opencl-extension-loader
6767
path: external/opencl-extension-loader
6868

69+
- name: Get SPIR-V Headers
70+
if: matrix.ext == 'YES'
71+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
72+
with:
73+
repository: KhronosGroup/SPIRV-Headers
74+
path: external/SPIRV-Headers
75+
6976
- name: Create Build Directory
7077
run: cmake -E make_directory ${{runner.workspace}}/build
7178

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Copyright (c) 2019-2024 Ben Ashbaugh
1+
# Copyright (c) 2019-2025 Ben Ashbaugh
22
#
33
# SPDX-License-Identifier: MIT
44

5-
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
5+
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
66

77
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
88
set(CMAKE_CXX_STANDARD 14)
@@ -36,6 +36,12 @@ else()
3636
message(STATUS "OpenCL Extension Loader is not found.")
3737
endif()
3838

39+
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/external/SPIRV-Headers)
40+
add_subdirectory(external/SPIRV-Headers)
41+
else()
42+
message(STATUS "SPIR-V Headers are not found.")
43+
endif()
44+
3945
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
4046
enable_testing()
4147
endif()

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2024 Ben Ashbaugh
3+
Copyright (c) 2019-2025 Ben Ashbaugh
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Simple OpenCL<sup>TM</sup> Samples
22

3-
[![build](https://github.com/bashbaug/SimpleOpenCLSamples/workflows/build/badge.svg?branch=main)](https://github.com/bashbaug/SimpleOpenCLSamples/actions?query=workflow%3Abuild+branch%3Amain)
3+
[![build](https://github.com/bashbaug/SimpleOpenCLSamples/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/bashbaug/SimpleOpenCLSamples/actions?query=workflow%3Abuild+branch%3Amain)
44

55
This repo contains simple OpenCL samples that demonstrate how to build
66
OpenCL applications using only the Khronos-provided headers and libs.
@@ -39,6 +39,10 @@ Many samples that use extensions additionally require the OpenCL Extension Loade
3939

4040
git clone https://github.com/bashbaug/opencl-extension-loader external/opencl-extension-loader
4141

42+
Several samples that interact with SPIR-V require the SPIR-V headres:
43+
44+
git clone https://github.com/KhronosGroup/SPIRV-Headers external/SPIRV-Headers
45+
4246
After satisfying the external dependencies create build files using CMake. For example:
4347

4448
mkdir build && cd build

docs/env/ubuntu/24.04.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Ubuntu 24.04 Setup Instructions
2+
3+
## Verify Hardware Support
4+
5+
Most modern GPUs support OpenCL. For integrated graphics devices (iGPUs), use `lscpu` to get the processor SKU. Detailed information for Intel SKUs is available from [ark.intel.com](ark.intel.com). Detailed information for AMD processors is available from [AMD's product page](https://www.amd.com/en/products/specifications/processors).
6+
7+
## Build Dependencies
8+
9+
OCL Headers:
10+
11+
```bash
12+
sudo apt install opencl-c-headers opencl-clhpp-headers
13+
```
14+
15+
The OpenCL API has its own set of header files; the above command installs both C and C++ headers files. The C header can be found in `<CL/cl.h>`; the C++ header is in `<CL/opencl.hpp>`.
16+
17+
OCL ICD Loader:
18+
19+
```bash
20+
sudo apt install ocl-icd-opencl-dev
21+
```
22+
23+
OpenCL applications generally link against an OpenCL Installable Compute Device (ICD) loader instead of a specific OpenCL implementation; see [https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc](https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc) for more information about this system.
24+
25+
## Runtime Dependencies
26+
27+
OpenCL requires a compute runtime to manage the interaction between the OpenCL API and the GPU.
28+
29+
### OCL ICD Loader
30+
31+
```bash
32+
sudo apt install ocl-icd-libopencl1
33+
```
34+
35+
OpenCL applications generally link against an OpenCL Installable Compute Device (ICD) loader instead of a specific OpenCL implementation; see [https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc](https://github.com/bashbaug/OpenCLPapers/blob/master/OpenCLOnLinux.asciidoc) for more information about this system.
36+
37+
### AMD Compute Runtime
38+
39+
AMD supports OpenCL through their ROCm platform. Installation instructions are [here](https://rocmdocs.amd.com/en/latest/Installation_Guide/Installation-Guide.html#ubuntu).
40+
41+
### Intel Compute Runtime
42+
43+
Intel's OpenCL support is provided through the NEO compute runtime. Download packages from the project's [GitHub releases page](https://github.com/intel/compute-runtime/releases).
44+
45+
### Nvidia Compute Runtime
46+
47+
Nvidia provides OpenCL support through their proprietary driver, available from the [graphics-drivers PPA](https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa).
48+
49+
```bash
50+
sudo add-apt-repository ppa:graphics-drivers/ppa
51+
sudo apt update
52+
sudo apt install nvidia-graphics-drivers-<version>
53+
```
54+
55+
### Configure Permissions
56+
57+
```bash
58+
sudo usermod -a -G video $USER
59+
sudo usermod -a -G render $USER
60+
```
61+
62+
Users running OpenCL applications on a GPU require additional permissions granted by the groups above.
63+
64+
## Verification
65+
66+
The `clinfo` utility can be used to verify the environment has been properly configured.
67+
68+
```bash
69+
$ sudo apt install clinfo
70+
$ clinfo
71+
<platform information should show here>
72+
```
73+
74+
## Troubleshooting
75+
76+
If `clinfo` indicates there are 0 supported platforms:
77+
78+
1. Verify your host has OpenCL-capable hardware attached
79+
2. Verify clinfo is running as a user with appropriate group membership
80+
3. Verify new group membership has been applied (this may require logout or reboot)
81+
4. Verify the correct compute runtime is installed
82+
5. Check the kernel log (`sudo dmesg`) for related errors

0 commit comments

Comments
 (0)