I have an Nvidia CUDA support GPU device installed. My requirement is to run an openCL application on my GPU. Can I do it independent from Nvidia Cuda SDK?
You only need NVIDIA GPU drivers installed to run binaries that have OpenCL support. libOpenCL.so is included with the drivers.
In order to compile the applications you will also need OpenCL headers. Those may come from CUDA Toolkit, from a separate package (like opencl-headers for Ubuntu), or you can just download them from the Khronos site (keep in mind that NVIDIA implements version 1.1 of OpenCL specification).
Related
It looks like that Intel provides many OpenCL implementations.ArchWiki describes OpenCL implementations. It says that beignet and intel-opencl are deprecated. Then, what is difference between intel-compute-runtime, intel-opencl-runtime, and intel-opencl-sdk?
I want to use OpenCL on my x86 computer.
The following OpenCL runtimes expose your Intel integrated GPU as an OpenCL device to applications in your PC:
Intel compute runtime (aka Neo) is the new open-source OpenCL implementation for Intel GPUs. It supports integrated GPUs from Broadwell and onward.
Beignet is the old open-source OpenCL implementation for Intel integrated GPUs. It supports integrated GPUs since Ivy Bridge. You should use this if you have an older Intel processor.
Intel OpenCL was a proprietary alternative to Beignet for older processors since Ivy Bridge. In my experience Beignet is preferable if you have an older processor.
The Intel OpenCL runtime exposes your CPU as an OpenCL device to applications in your PC.
An OpenCL ICD loader is vendor-independent and allows you to select which OpenCL device to use at runtime. There are several available, but I suggest ocl-icd, since it's open source and typically up-to-date.
For developing your own OpenCL programs you also need the OpenCL headers, which you can download from here or install from the Arch repositories.
The so called SDKs are simply vendor bundles that generally contain: a) an OpenCL runtime to expose the vendor hardware as an OpenCL device; b) an OpenCL ICD loader, so that various processors can be exposed as OpenCL devices; c) the OpenCL headers; d) code samples on how to best use OpenCL on the vendor hardware; and, e) possibly other vendor related stuff.
Some examples of SDKs include:
AMD APP SDK (discontinued).
Intel® SDK for OpenCL™ Applications.
You don't actually need an SDK to develop OpenCL applications, as long as you have an OpenCL runtime, an OpenCL ICD loader and the OpenCL headers. If developed in C/C++, your applications should include the headers and link against an ICD loader (libOpenCL.so).
I'm trying to build a software from source, OpenCL is a required package. But I'm really confused as to what it is and how to install it.
OpenCL is a framework for parallel computing on GPUs and multi-core CPUs. To use it, you need to install a platform, which may depend on what kind of hardware you have, and what type of device your application wants to use. Here is a list of the main platforms:
AMD APP: for AMD GPUs and Intel/AMD CPUs http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/
NVIDIA CUDA: for NVIDIA GPUs only https://developer.nvidia.com/cuda-downloads
Intel: for Intel CPUs https://software.intel.com/en-us/intel-opencl
I have a general question. im working on a framework and need to know about the opencl kernel compiler What is opencl kernel compiler? Is there any source for detailed study?
It's the compiler that converts OpenCL kernels to binaries that the platform running them can understand.
For example, if you're running OpenCL on Intel HD graphics with the Intel OpenCL SDK, that SDK includes a compiler that compiles the kernels down to binaries using that GPU's instruction set.
What is an example of a target platofrm in OpenCL? is it, for example, an OS like Windows, Android, Mac, or is it the actual chips in a device?
An OpenCL platform is essentially an OpenCL implementation. It is not related to the operating system (if any). It is commonly related to the hardware chip, but not necessarily. For example, the AMD platform also supports Intel CPUs. Another example is the Beignet project, an open-source OpenCL platform which runs on Intel hardware, or Pocl, which runs on ARM and x86.
Some examples of existing OpenCL SDKs/platforms (I don't have their full names at hand so I'll just list the vendor/SDK name):
Proprietary:
Intel® SDK for OpenCL™ Applications
AMD APP SDK
NVIDIA OpenCL
ARM Mali OpenCL SDK
Apple OpenCL
Qualcomm Adreno SDK
Imagination Technologies OpenCL on PowerVR
There are also implementations by IBM, Samsung, Altera, Vivante, Xilinx, MediaTek, STMicroelectronics...
Open Source:
Beignet
Portable Computing Language
This list is not exhaustive.
What is the difference between Intel, AMD and Khronos OpenCLs. I am totally new to OpenCL and want to start with it. I don't know which one is better to install on my operating system.
OpenCL is an "extension" to C and C++ languages that enables parallelization of software on your compute devices: CPU, GPU, etc.
OpenCL is defined by a standard (created by Khronos Group) and implemented by hardware vendors Intel, AMD, nVidia, etc.. So each OpenCL implementation requires a vendor specific OpenCL driver that will enable the usage of the vendor's hardware.
So to conclude, if you have an Intel based system, use the Intel OpenCL because only so you would be able to use all compute devices in your machine. The same goes if you have an AMD system. Also, take note that there is no Khronos OpenCL implementation.
Of course you can have a platform with OpenCL enabled devices from multiple vendors (e.g. Intel CPU+GPU and nVidia discrete card). In this case the OpenCL runtime contains a generic layer (a dynamic loaded library). This layer is an interface which calls the implementations provided in each device driver depending on the selected OpenCL platform.
OpenCL is a standard defined by Kronos. They distribute header files that you have to give to your compiler. They do not distribute binaries to link against. For that, you must get an ICD (Installable Client Driver), on Windows this is in the form of a DLL file. You will get it from installing one or more of...
Nvidia drivers (if you have an Nvidia GPU)
AMD drivers (if you have an AMD GPU or an AMD CPU)
Intel Drivers (if you have an Intel CPU, also some Intel CPU's have built in GPU's).
Do not worry about compiling against one vendor and it not working on another, OpenCL has been carefully designed to work around this. Compile against any version you have, it will work with any other version that is the same or newer, regardless of who made it.
Be Aware, the AMD OpenCL driver will operate as an OpenCL driver for Intel CPU's. If, for example, you have an AMD GPU and an Intel CPU, and have installed the Intel OpenCL driver and the AMD OpenCL driver, the AMD driver will report that it can provide both a GPU device and a CPU device (your CPU), and the Intel driver will report having a CPU device (also your CPU) and most likely also a GPU device (the GPU that is on the Intel CPU die, for example on an i7-3770, this will be a HD4000). If you blindly ask OpenCL for "All CPU's available" you will get the AMD drivers and the Intel drivers offering you the same CPU. Your code will not run very well in this case.
On Windows it is expected that you will download the header files yourself, and then either create a library from the DLL (MSVC), or link directly against the DLL (Mingw & Clang default behavior).
On Linux, you package manager will likely have a library to link against, consult your distributions documentation regarding this. On Ubuntu and Debian this command will work...
sudo apt-get install ocl-icd-opencl-dev
On Mac, there is nothing to install, and trying to install something will likely damage your system. Just install Xcode, and use the framework "OpenCL".
There are other platforms, for example Android. Some FPGA vendors offer OpenCL libraries. Consult your vendors documentation.
Khronos defines OpenCL standard. Each vendor/ open source will implement that standards.
Khronos defines set of conformance tests which need to pass if a vendor claims that his opencl implementation is as per standard.