Открыта запись на вторую часть курса по анонимности и безопасности в сети интернет » Paranoid II » от команды codeby . Анонимные роутеры, Подъём, настройка и администрирование Tor-ноды, Работа с железом ПК, Удаление аппаратных закладок, Минимизация рисков, Авторские разработки и многое другое. Подробнее .
Напоминаем, что 1 декабря стартует курс » Тестирование Веб-Приложений на проникновение с нуля » от команды codeby . Общая теория, подготовка рабочего окружения, пассивный фаззинг и фингерпринт, активный фаззинг, уязвимости, пост-эксплуатация, инструментальные средства, Social Engeneering и многое другое. Подробнее .
OpenCL ICD Loader
This repo contains the source code and tests for the Khronos official OpenCL ICD Loader.
CI Build Status
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.
The OpenCL ICD Loader requires OpenCL Headers. To use system OpenCL Headers, please specify the OpenCL Header location using the CMake variable OPENCL_ICD_LOADER_HEADERS_DIR . By default, the OpenCL ICD Loader will look for OpenCL Headers in the inc directory.
By default, the OpenCL ICD Loader on Windows requires the Windows Driver Kit (WDK). To build OpenCL ICD Loader with WDK support —
Establish environment variable WDK to include directory. Ex: set WDK=C:Program Files (x86)Windows Kits10include10.0.17763.0
An OpenCL ICD Loader may be built without the Windows Driver Kit using the CMake variable OPENCL_ICD_LOADER_REQUIRE_WDK , however this option should be used with caution since it may prevent the OpenCL ICD Loader from enumerating some OpenCL implementations. This dependency may be removed in the future.
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.
Build and Install Directories
A common convention is to place the build directory in the top directory of the repository and to place the install directory as a child of the build directory. The remainder of these instructions follow this convention, although you may place these directories in any location.
For most Windows and Linux usages, the following steps are sufficient to build the OpenCL ICD Loader:
Clone this repo:
Obtain the OpenCL Headers, if you are not planning to use system OpenCL headers. Headers may be obtained from the Khronos OpenCL Headers repository.
Create a build directory:
Invoke cmake to generate solution files, Makefiles, or files for other build systems.
Build using the CMake-generated files.
For 64-bit Windows builds, you may need to specify a 64-bit generator manually, for example:
Some users may prefer to use a CMake GUI frontend, such as cmake-gui or ccmake , vs. the command-line CMake.
OpenCL ICD Loader Tests
OpenCL ICD Loader Tests can be run using 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.
The OpenCL ICD Loader Tests use a «stub» ICD, which must be set up manually. The OpenCL ICD Loader Tests will «fail» if the «stub» ICD is not set up correctly. The method to install the «stub» ICD is operating system dependent.
On Linux, install the «stub» ICD by creating a file with the full path to the «stub» ICD in /etc/OpenCL/vendors :
On Windows, add the «stub» ICD by adding a REG_DWORD value to the registry keys:
To run the tests, invoke ctest from the build directory. The CMake-generated build files may be able to invoke the OpenCL ICD Loader tests as well.
Manually remove the file or registry keys added during Test Setup.
Please create a GitHub issue to report an issue or ask questions.
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:
Getting your Windows machine ready for OpenCL is rather straightforward. In short, you only need the latest drivers for your OpenCL device(s) and you’re ready to go. Of course, you will need to add an OpenCL SDK in case you want to develop OpenCL applications but that’s equally easy.
Before we start, a few notes:
- The steps described herein have been tested on Windows 8.1 only, but should also apply for Windows 7 and Windows 8.
- We will not discuss how to write an actual OpenCL program or kernel, but focus on how to get everything installed and ready for OpenCL on a Windows machine. This is because writing efficient OpenCL kernels is almost entirely OS independent.
If you want to know more about OpenCL and you are looking for simple examples to get started, check the Tutorials section on this webpage.
If you only need to run an OpenCL application without getting into development stuff then most probably everything already works.
If OpenCL applications fail to launch, then you need to have a closer look to the drivers and hardware installed on your machine:
GPU Caps Viewer
- Check that you have a device that supports OpenCL. All graphics cards and CPUs from 2011 and later support OpenCL. If your computer is from 2010 or before, check this page. You can also find a list with OpenCL conformant products on Khronos webpage .
- Make sure your OpenCL device driver is up to date, especially if you’re not using the latest and greatest hardware. With certain older devices OpenCL support wasn’t initially included in the drivers.
Here is where you can download drivers manually:
- Intel has h > with support for OpenCL 2.0.
- AMD’s GPU-drivers include the OpenCL-drivers for CPUs, APUs and GPUs, version 2.0.
- NV > mention mostly CUDA, but the drivers for OpenCL 1.1 1.2 are there too.
In addition, it is always a good idea to check for any other special requirements that the OpenCL application may have. Look for device type and OpenCL version in particular. For example, the application may run only on OpenCL CPUs, or conversely, on OpenCL GPUs. Or it may require a certain OpenCL version that your device does not support.
A great tool that will allow you to retrieve the details for the OpenCL devices in your system is Caps Viewer .
Now it’s time to put the pedal to the metal and start developing some proper OpenCL applications.
The basic steps would be the following:
- Make sure you have a machine which supports OpenCL, as described above.
- Get the OpenCL headers and libraries included in the OpenCL SDK from your favourite vendor.
- Start writing OpenCL code. That’s the difficult part.
- Tell the compiler where the OpenCL headers are located.
- Tell the linker where to find the OpenCL .lib files.
- Build the fabulous application.
- Run and prepare to be awed in amazement.
Ok, so let’s have a look into each of these.
For OpenCL headers and libraries the main options you can choose from are:
- NV > . You can grab the OpenCL samples here.
- AMD – AMD APP SDK . Also works with Intel’s CPUs.
- Headers and OpenCL.lib are here: https://github.com/GPUOpen-LibrariesAndSDKs/OCL-SDK/releases
- Samples are here: https://github.com/OpenCL/AMD_APP_samples
- Math libraries are here: https://github.com/clMathLibraries
- Intel – the previous Intel SDK for OpenCL is now integrated into Intel’s new tools , such as Intel INDE (which has a free starters edition) or Intel Media Server Studio. Grab any of these in order to have everything ready for building OpenCL code.
As long as you pay attention to the OpenCL version and the OpenCL features supported by your device, you can use the OpenCL headers and libraries from any of these three vendors.
Let’s assume that we are developing a 64bit C/C++ application using Visual Studio 2013. To begin with, we need to check how many OpenCL platforms are available in the system:
We need to specify where the OpenCL headers are located by adding the path to the OpenCL «CL» is in the same location as the other CUDA include files, that is, CUDA_INC_PATH. On a x64 Windows 8.1 machine with CUDA 6.5 the environment variable CUDA_INC_PATH is defined as “C:Program FilesNVIDIA GPU Computing ToolkitCUDAv6.5include”
If you’re using the AMD SDK, you need to replace «$(CUDA_INC_PATH)» with «$(AMDAPPSDKROOT)/include» or, for Intel SDK, with «$(INTELOCLSDKROOT)/include«.
Similarly, we need to let the linker know about the OpenCL libraries. Firstly, add OpenCL.lib to the list of Additional Dependencies:
Secondly, specify the OpenCL.lib location in Additional Library Directories:
As in the case of the includes, If you’re using the AMD SDK, replace «$(CUDA_LIB_PATH)» with «$(AMDAPPSDKROOT)/lib/x86_64» , or in the case of Intel with «$(INTELOCLSDKROOT)/lib/x64«.
And you’re good to go! The application should now build and run. Now, just how difficult was it? Happy OpenCL-coding on Windows!
If you have any question or suggestion, just leave a comment.
An example of real-world, end-user OpenCL usage
. KGaA were so kind to share his experience since he did a OpenCL training with us and we reviewed his code.Enjoy his story on .
OpenCL basics: Multiple OpenCL devices with the ICD.
. systems nowadays have more than just one OpenCL device and often from different vendors. How can they all coexist from a . .
Overview of OpenCL 2.0 hardware support, samples, blogs and drivers
. were too busy lately to tell you about it: OpenCL 2.0 is getting ready for prime time! As it makes use of the more .
Using OpenCL 1.2 with 1.1 devices
. code uses OpenCL 1.2 more and more, which is a problem when wanting to use OpenCL 1.1 . Most times those computers have .
Anca Hamuraru joined StreamComputing in 2014, a collective of performance engineering experts.