• Stars
    star
    226
  • Rank 176,514 (Top 4 %)
  • Language
    C
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The OpenCL ICD Loader project.

OpenCLTM ICD Loader

This repo contains the source code and tests for the Khronos official OpenCL ICD Loader.

CI Build Status

Windows Build Status Linux Build Status MacOS Build Status

Introduction

OpenCL defines an Installable Client Driver (ICD) mechanism to allow developers to build applications against an Installable Client Driver loader (ICD loader) rather than linking their applications against a specific OpenCL implementation. The ICD Loader is responsible for:

  • Exporting OpenCL API entry points
  • Enumerating OpenCL implementations
  • Forwarding OpenCL API calls to the correct implementation

This repo contains the source code and tests for the Khronos official OpenCL ICD Loader.

Note that this repo does not contain an OpenCL implementation (ICD). You will need to obtain and install an OpenCL implementation for your OpenCL device that supports the OpenCL ICD extension cl_khr_icd to run an application using the OpenCL ICD Loader.

The OpenCL Installable Client Driver extension (cl_khr_icd) is described in the OpenCL extensions specification, which may be found on the Khronos OpenCL Registry.

Build Instructions

While the ICD Loader can be built and installed in isolation, it is part of the OpenCL SDK. If looking for streamlined build experience and a complete development package, refer to the SDK build instructions instead of the following guide.

Dependencies

The OpenCL ICD Loader requires:

  • the OpenCL Headers.
    • It is recommended to install the headers via CMake, however a convenience shorthand is provided. Providing OPENCL_ICD_LOADER_HEADERS_DIR to CMake, one may specify the location of OpenCL Headers. By default, the OpenCL ICD Loader will look for OpenCL Headers in the inc directory.
  • The OpenCL ICD Loader uses CMake for its build system. If CMake is not provided by your build system or OS package manager, please consult the CMake website.

Example Build

For most Windows and Linux usages, the following steps are sufficient to build the OpenCL ICD Loader:

  1. Clone this repo and the OpenCL Headers:

     git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
     git clone https://github.com/KhronosGroup/OpenCL-Headers
    
  2. Install OpenCL Headers CMake package

     cmake -D CMAKE_INSTALL_PREFIX=./OpenCL-Headers/install -S ./OpenCL-Headers -B ./OpenCL-Headers/build 
     cmake --build ./OpenCL-Headers/build --target install
    
  3. Build and install OpenCL ICD Loader CMake package. (Note that CMAKE_PREFIX_PATH need to be an absolute path. Update as needed.)

     cmake -D CMAKE_PREFIX_PATH=/absolute/path/to/OpenCL-Headers/install -D CMAKE_INSTALL_PREFIX=./OpenCL-ICD-Loader/install -S ./OpenCL-ICD-Loader -B ./OpenCL-ICD-Loader/build 
     cmake --build ./OpenCL-ICD-Loader/build --target install
    

Notes:

  • For x64 Windows builds, you need to instruct the default Visual Studio generator by adding -A x64 to all your command-lines.

  • Some users may prefer to use a CMake GUI frontend, such as cmake-gui or ccmake, vs. the command-line CMake.

Example Use

Example CMake invocation

cmake -D CMAKE_PREFIX_PATH="/chosen/install/prefix/of/headers;/chosen/install/prefix/of/loader" /path/to/opencl/app

and sample CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0...3.18.4)
project(proj)
add_executable(app main.cpp)
find_package(OpenCLHeaders REQUIRED)
find_package(OpenCLICDLoader REQUIRED)
target_link_libraries(app PRIVATE OpenCL::Headers OpenCL::OpenCL)

OpenCL ICD Loader Tests

OpenCL ICD Loader Tests can be run using ctest from the build directory. CTest which is a companion to CMake. The OpenCL ICD Loader Tests can also be run directly by executing icd_loader_test[.exe] executable from the bin folder.

(Note that running the tests manually requires setting up it's env manually, by setting OCL_ICD_FILENAMES to the full path of libOpenCLDriverStub.so/OpenCLDriverStub.dll, something otherwise done by CTest.)

Registering ICDs

The method to installing an ICD is operating system dependent.

Registering an ICD on Linux

Install your ICD by creating a file with the full path to the library of your implementation in /etc/OpenCL/vendors for eg.:

echo full/path/to/libOpenCLDriverStub.so > /etc/OpenCL/vendors/test.icd

Registering an ICD on Windows

Install your ICD by adding a REG_DWORD value to the registry keys:

// For 32-bit operating systems, or 64-bit tests on a 64-bit operating system:
HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenCL\Vendors

// For 32-bit tests on a 64-bit operating system:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Khronos\OpenCL\Vendors

// The name of the REG_DWORD value should be the full path to the library of your implementation, for eg.
// OpenCLDriverStub.dll, and the data for this value should be 0.

About Layers

Layers have been added as an experimental feature in the OpenCL ICD Loader. We do not expect the API or ABI to change significantly, but the OpenCL Working Group reserves the right to do so. The layer support can also be completely deactivated during configuration by using the ENABLE_OPENCL_LAYERS (ON by default) cmake variable:

cmake -DENABLE_OPENCL_LAYERS=OFF

For now, runtime configuration of layers is done using the OPENCL_LAYERS environment variable. A colon (Linux) or semicolon (Windows) list of layers to use can be provided through this environment variable.

We are looking for feedback.

Support

Please create a GitHub issue to report an issue or ask questions.

Contributing

Contributions to the OpenCL ICD Loader are welcomed and encouraged. You will be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request or other contribution to GitHub.

Table of Debug Environment Variables

The following debug environment variables are available for use with the OpenCL ICD loader:

Environment Variable Behavior Example Format
OCL_ICD_FILENAMES Specifies a list of additional ICDs to load. The ICDs will be enumerated first, before any ICDs discovered via default mechanisms. export OCL_ICD_FILENAMES=libVendorA.so:libVendorB.so

set OCL_ICD_FILENAMES=vendor_a.dll;vendor_b.dll
OCL_ICD_VENDORS On Linux and Android, specifies a directory to scan for ICDs to enumerate in place of the default `/etc/OpenCL/vendors'. export OCL_ICD_VENDORS=/my/local/icd/search/path
OPENCL_LAYERS Specifies a list of layers to load. export OPENCL_LAYERS=libLayerA.so:libLayerB.so

set OPENCL_LAYERS=libLayerA.dll;libLayerB.dll
OPENCL_LAYER_PATH On Linux and Android, specifies a directory to scan for layers to enumerate in place of the default `/etc/OpenCL/layers'. export OPENCL_LAYER_PATH=/my/local/layers/search/path
OCL_ICD_ENABLE_TRACE Enable the trace mechanism export OCL_ICD_ENABLE_TRACE=True

set OCL_ICD_ENABLE_TRACE=True
true, T, 1 can also be used here.

More Repositories

1

glTF

glTF – Runtime 3D Asset Delivery
HTML
7,152
star
2

MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Objective-C++
4,788
star
3

Vulkan-Samples

One stop solution for all Vulkan samples
C++
4,176
star
4

glslang

Khronos-reference front end for GLSL/ESSL, partial front end for HLSL, and a SPIR-V generator.
C++
3,009
star
5

Vulkan-Hpp

Open-Source Vulkan C++ API
C++
2,691
star
6

WebGL

The Official Khronos WebGL Repository
HTML
2,637
star
7

glTF-Sample-Models

glTF Sample Models
Mathematica
2,593
star
8

Vulkan-Docs

The Vulkan API Specification and related tools
JavaScript
2,527
star
9

UnityGLTF

Runtime glTF 2.0 Loader for Unity3D
C#
1,818
star
10

SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
GLSL
1,748
star
11

Vulkan-Guide

One stop shop for getting started with the Vulkan API
Makefile
1,586
star
12

glTF-Blender-IO

Blender glTF 2.0 importer and exporter
Python
1,488
star
13

glTF-Sample-Viewer

Physically-Based Rendering in glTF 2.0 using WebGL
JavaScript
1,084
star
14

SPIRV-Tools

C++
1,071
star
15

glTF-Tutorials

glTF Tutorials
Python
951
star
16

KTX-Software

KTX (Khronos Texture) Library and Tools
C++
866
star
17

Vulkan-Headers

Vulkan header files and API registry
C++
838
star
18

glTF-Blender-Exporter

Moved to https://github.com/KhronosGroup/glTF-Blender-IO.
Python
836
star
19

Vulkan-ValidationLayers

Vulkan Validation Layers (VVL)
C++
739
star
20

Khronosdotorg

Website resource pages for Khronos.org. Community is encouraged to help keep up-to-date
HTML
716
star
21

OpenXR-SDK

Generated headers and sources for OpenXR loader.
C++
688
star
22

OpenGL-Registry

OpenGL, OpenGL ES, and OpenGL ES-SC API and Extension Registry
C
683
star
23

SPIRV-Reflect

SPIRV-Reflect is a lightweight library that provides a C/C++ reflection API for SPIR-V shader bytecode in Vulkan applications.
C
665
star
24

OpenCOLLADA

C++
652
star
25

OpenCL-Headers

Khronos OpenCL-Headers
C
620
star
26

OpenCL-SDK

OpenCL SDK
C++
539
star
27

OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
Python
518
star
28

SyclParallelSTL

Open Source Parallel STL implementation
C++
515
star
29

Vulkan-Loader

Vulkan Loader
C
508
star
30

COLLADA2GLTF

COLLADA to glTF converter
C++
499
star
31

VK-GL-CTS

Khronos Vulkan, OpenGL, and OpenGL ES Conformance Tests
C++
464
star
32

Vulkan-Samples-Deprecated

Vulkan sample code
454
star
33

SPIRV-LLVM-Translator

A tool and a library for bi-directional translation between SPIR-V and LLVM IR
LLVM
422
star
34

Vulkan-LoaderAndValidationLayers

**Deprecated repository** for Vulkan loader and validation layers
C++
414
star
35

OpenGL-Refpages

OpenGL and OpenGL ES reference page sources, and generated HTML used as backing store for khronos.org
HTML
392
star
36

OpenCL-CLHPP

Khronos OpenCL-CLHPP
C++
329
star
37

glTF-Validator

Tool to validate glTF assets.
Dart
321
star
38

OpenCL-Docs

OpenCL API, OpenCL C, Extensions, SPIR-V Environment Specs, Ref page, and C++ for OpenCL doc sources.
Python
296
star
39

OpenCL-Guide

A guide to help developers get up and running quickly with the OpenCL programming framework
CMake
295
star
40

GLSL

GLSL Shading Language Issue Tracker
282
star
41

Vulkan-Tools

Vulkan Utilities and Tools
C++
270
star
42

SPIRV-LLVM

This project is no longer active. Please join us at
C++
259
star
43

SPIRV-Headers

SPIRV-Headers
C++
229
star
44

NNEF-Tools

The NNEF Tools repository contains tools to generate and consume NNEF documents
Python
220
star
45

ANARI-SDK

ANARI Software Development Kit (SDK)
C++
207
star
46

WebGLDeveloperTools

JavaScript
200
star
47

glTF-CSharp-Loader

C# Reference Loader for glTF
C#
193
star
48

SPIR

C++
178
star
49

glTF-Asset-Generator

Tool for generating various glTF assets for importer validation
C#
160
star
50

OpenCL-CTS

The OpenCL Conformance Tests
C++
149
star
51

Vulkan-Ecosystem

Public repository for Vulkan Ecosystem issues
134
star
52

WebGLNext-Proposals

Proposals for the design of the WebGL Next API.
WebIDL
132
star
53

OpenXR-Docs

OpenXR Specification sources and related material
Python
128
star
54

Vulkan-ExtensionLayer

Layer providing Vulkan features when native support is unavailable
C
128
star
55

SYCL-Docs

SYCL Open Source Specification
JavaScript
114
star
56

libclcxx

OpenCL specific C++ libraries implemented in C++ for OpenCL kernel language published in releases of OpenCL-Docs
109
star
57

SPIRV-Registry

SPIR-V specs
HTML
108
star
58

SPIRV-Guide

One stop shop for getting started with SPIR-V.
104
star
59

OpenCL-Registry

OpenCL API and Extension Registry.
HTML
100
star
60

openvx-samples

OpenVX Samples to use with any conformant implementation of OpenVX
C++
99
star
61

Vulkan-MemoryModel

Vulkan Memory Model
C++
98
star
62

3D-Formats-Guidelines

Guidelines for artists and developers using Khronos Group 3D formats.
98
star
63

EGL-Registry

EGL API and Extension Registry
HTML
98
star
64

glTF-IBL-Sampler

Sampler to create the glTF sample environments
C++
89
star
65

LLVM-SPIRV-Backend

An LLVM backend generating SPIR-V binary.
86
star
66

Vulkan-Profiles

Vulkan Profiles Tools
C++
84
star
67

glTF-External-Reference

glTF Experience Format (glXF)
73
star
68

Basis-Universal-Transcoders

A collection of optimized WebAssembly transcoders for Basis Universal compressed GPU texture formats.
WebAssembly
72
star
69

Vulkan-Samples-Assets

Vulkan Samples Assets
72
star
70

KTX-Specification

KTX file format source
CSS
70
star
71

OpenXR-Registry

Registry of OpenXR Specifications and related material
HTML
70
star
72

glTF-Sample-Environments

glTF sample environments for the glTF Sample Viewer
Batchfile
68
star
73

glTF-Project-Explorer

Tool to provide a filterable registry of glTF community projects.
TypeScript
67
star
74

3DC-Asset-Creation

Asset creation guidelines and workflows to streamline the creation of 3D digital content for use in e-commerce
Shell
66
star
75

SYCL-CTS

SYCL Conformance Tests
C++
61
star
76

OpenXR-CTS

Conformance test suite for OpenXR
C++
56
star
77

Vulkan-Utility-Libraries

Utility libraries for Vulkan developers
C++
55
star
78

siggraph2012course

Presentations for SIGGRAPH 2012 course "Graphics Programming on the Web" covering HTML5 technologies (Canvas, CSS, etc.), WebGL and WebCL
HTML
53
star
79

WebCL

The Official Khronos WebCL Repository
HTML
50
star
80

ToneMapping

A collection of tone mappers for the display of 3D graphics
JavaScript
47
star
81

OpenVX-Registry

OpenVX API and Extension Registry.
HTML
44
star
82

SPIR-Tools

SPIR-Tools
C
44
star
83

Vulkan-Portability

40
star
84

OpenXR-Hpp

Open-Source OpenXR C++ language projection
C++
40
star
85

OpenCL-CXX

OpenCL C++ Kernel Language Spec sources.
TeX
39
star
86

webcl-validator

WebCL Validator
C++
38
star
87

DataFormat

Khronos Data Format Specification
C
36
star
88

OpenCL-TTL

Tensor Tiling Library
C
33
star
89

OpenXR-Tutorials

OpenXR Tutorials [Work in progress, do not use to study OpenXR yet]
C++
32
star
90

WebGLPerf

WebGL performance regression tests
HTML
32
star
91

COLLADA-CTS

Welcome to the COLLADA Conformance Test Suite
Python
32
star
92

ANARI-Docs

ANARI Documentation
JavaScript
30
star
93

glTF-Compressonator

Fork of AMD GPUOpen Compressonator tool , for the purpose of further enhancing glTF support. and prototyping for ETC1S CRN, CTTF_128 Universal Formats, Transcoders, and Supercompression
C++
30
star
94

Education-Forum

content to support educators developing courses on Khronos technologies
29
star
95

khronosgroup.github.io

Visit https://github.khronos.org for a directory of all our GitHub Repositories
HTML
27
star
96

SPIRV-Visualizer

Client side only Javascript to visualize a SPIR-V Module binary
JavaScript
26
star
97

OpenVG-Docs

OpenVG Specification source
C
25
star
98

Vulkan-Site

Vulkan Documentation Project framework for integrated documentation site with spec, proposals, guide, and more
JavaScript
25
star
99

glTF-Generator-Registry

An open registry of tools that create glTF assets.
25
star
100

SYCL_Reference

SYCL Reference Manual
C++
25
star