Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intel OpenCL Vs. Khronos OpenCL

Tags:

opencl

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.

like image 214
mmostajab Avatar asked Nov 15 '14 12:11

mmostajab


People also ask

What is Intel OpenCL?

OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors or hardware accelerators.

Does Intel support OpenCL?

OpenCL ToolsThis version is bundled into Intel® System Studio, and is available for Windows and Linux.

Is OpenCL alive?

opencl by all accounts, is dead. The 6900xt only supports opencl 2.1, and nvidia cards support opencl 2.0.


2 Answers

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.

like image 166
VAndrei Avatar answered Oct 13 '22 10:10

VAndrei


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.

like image 27
burito Avatar answered Oct 13 '22 11:10

burito