Compiling OpenCL 1.2 codes on nvidia gpus - opencl

I am going to compile a chunk of codes which needs OpenCL 1.2. As I understood, nVIDIA has released OpenCL 1.2 driver. I have installed the latest CUDA Toolkit which is version 7.0. But when I compiled then code, I got errors like:
Error 9 error LNK2001: unresolved external symbol clReleaseDevice C:\Users\???\Downloads\FireRaysSDK-1.0\FireRaysSDK-1.0\App\CLW64.lib(CLWParallelPrimitives.obj) App
Error 7 error LNK2001: unresolved external symbol clRetainDevice C:\Users\???\Downloads\FireRaysSDK-1.0\FireRaysSDK-1.0\App\CLW64.lib(CLWContext.obj) App
After that I download the header files from khronos website for OpenCL 1.2. Now, it compiles but I am getting unresolved external link to these functions as their implementation is not in OpenCL.lib.
Is there any OpenCL.lib that I can use to compile OpenCL 1.2 codes? Is there any way to get their implementation from DLL files? Because as I know nvidia has added the opencl 1.2 support to its driver.

You are correct that NVIDIA now provide OpenCL 1.2 support in their latest drivers, but the CUDA 7.0 SDK was released sometime before these drivers were shipped, and so may not contain OpenCL 1.2 headers or libraries. I've just checked the CUDA 7.5 Release Candidate and it appears to ship with the OpenCL 1.2 library that you need.
You can link against any OpenCL 1.2 library, and it should work with NVIDA's drivers. You should just be able to install an SDK from AMD or Intel, or just download and build the OpenCL 1.2 Installable Client Driver (ICD) Loader directly from Khronos.

Related

How do I use the OpenCL C++/C++ for OpenCL kernel languages?

I have only tried compiling kernels using pyopencl, but I can only seem to be able to use OpenCl C. Looking at clinfo, I only see support for CLC listed, heres some truncated output from my pc:
Platform Name AMD Accelerated Parallel Processing
Platform Vendor Advanced Micro Devices, Inc.
Platform Version OpenCL 2.1 AMD-APP (3423.0)
Platform Profile FULL_PROFILE
Platform Extensions cl_khr_icd cl_amd_event_callback
Platform Extensions function suffix AMD
Platform Host timer resolution 1ns
Platform Name AMD Accelerated Parallel Processing
Number of devices 1
Device Name gfx1031
Device Vendor Advanced Micro Devices, Inc.
Device Vendor ID 0x1002
Device Version OpenCL 2.0
Driver Version 3423.0 (HSA1.1,LC)
Device OpenCL C Version OpenCL C 2.0
Device Type GPU
Device Board Name (AMD) AMD Radeon RX 6700 XT
Device PCI-e ID (AMD) 0x73df
Device Topology (AMD) PCI-E, 0000:2f:00.0
Device Profile FULL_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 20
I am using a rocm driver compiled from the AUR, I tried to also install the mesa driver alongside but could not do so (perhaps I need to uninstall the other, but I dread having to recompile it if mesa fails).
My laptop (intel hd graphics) seems to support OpenCL 3.0 but also only lists CLC support. What am I missing, is this not implemented yet? I saw something somewhere about "offline compilation" and maybe using a "clc++" option with clang but can someone elaborate?
C++ for OpenCL can be used in two ways:
Online compilation
If OpenCL device supports cl_ext_cxx_for_opencl, it is possible to compile a program written using the C++ for OpenCL kernel language in runtime. Applications may pass -cl-std=CLC++ to clCompileProgram and clBuildProgram for programs created using clCreateProgramFromSource to request the program be built as C++ for OpenCL.
Offline compilation
If OpenCL device allows to create the program with SPIR-V, then it is possible to compile C++ for OpenCL source into intermediate LLVM IR:
clang -c -cl-std=clc++ -target spir64 -O3 -emit-llvm -o test.ll test.clcpp
Next, LLVM IR can be translated into SPIR-V using llvm-spirv:
llvm-spirv test.ll -o test.spv
Finally, OpenCL program can be created using clCreateProgramWithIL call:
std::ifstream il_file("test.spv", std::ios::binary);
std::vector<char> il_buffer;
std::copy(std::istreambuf_iterator<char>(il_file),
std::istreambuf_iterator<char>(),
std::back_inserter(il_buffer));
cl_program program =
clCreateProgramWithIL(context, il_buffer.data(), il_buffer.size(), &ret);
For PyOpenCL:
with open('test.spv', 'rb') as il_file:
il_buffer = bytes(il_file.read())
prg = cl.Program(ctx, il_buffer)
To check that OpenCL device supports SPIR-V modules, you need to use CL_DEVICE_IL_VERSION query in OpenCL 2.1 or newer and the CL_DEVICE_ILS_WITH_VERSION query in OpenCL 3.0 or newer.
For additional information about offline compilation please see Offline Compilation of OpenCL Kernels into SPIR-V Using Open Source Tooling article.

can't compile Qt qextserialport library

I'm trying to use qextserialport Library:
Download:
git clone https://code.google.com/p/qextserialport/
Open qextserialport.pro with Qt
Compile... (debug mode)
I got no errors, but window appears:
Couldn't find Executable, please choose one.
Which one should I choose?
N.B.: I'm on MacOSX 10.6 using Qt 3.1.1
Since at least Qt 5.2 QSerialport is integrated and readily available in your code. I would recommend to switch to Qt 5.3 for new designs, if you are not already using it.

CL/cl.h not found in windows intel opencl sdk?

I have installed intel opencl sdk in windows 8. All the files are located as they have to according to user guide but whenever I am trying to compile any code it is showing error that Cl/cl.h not found. Also, the user manual says that application needs to be linked to the libraries , but that option is nowhere to be found in the IDE.
This is the error I am getting at console
Setting target instruction set architecture to: Default (Advanced Vector Extension (AVX))
OpenCL Intel CPU device was found!
Device name: Intel(R) Core(TM) i5-3210M CPU # 2.50GHz
Device version: OpenCL 1.2 (Build 82248)
Device vendor: Intel(R) Corporation
Device profile: FULL_PROFILE
Compilation started
1:2:9: fatal error: 'CL/cl.h' file not found
Compilation failed
Build failed!
Any help would be welcomed...Thanks
I guess you have not configured your visual studio for OpenCL.
Check whether INTELOCLSDKROOT is got added in environment variable if not add it or else
configure visual studio to find header file and openCL library files.
Configuring visual studio ->
CL Header file
Properties -> All Configurations -> Configuration Properties-> C/C++ -> General -> Additional Include Directories -> SPECIFY_THE_PATH_OF_CL_INCLUDE_DIRECTORY
Linking CL Library
Properties -> All Configurations -> Configuration Properties-> C/C++ -> Linker -> General -> Additional Dependencies ->SPECIFY_THE_PATH_OF_CL_LIBRARY_BASED_ON_64/32_BIT_MACHINE
in linker -> input -> add OpenCL.lib
you will need to install the OpenCL runtime, it is another file other than the SDK file
This is OpenCL runtime 64-bit link

OpenCL: working with doubles error

The error states:
error: can't enable all OpenCL extensions or unrecognized OpenCL extension
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
System configuration:
Windows 7 on 64 bit
Notebook with ATI Mobility Radeon HD 5400 series
Visual Studio 2010
Drivers installed:
AMD-APP-SDK-v2.8-Windows-64
amd_catalyst_13.5_mobility_beta3
How can i solve this problem because i need to use double type in the kernel?
The directive is declared in the first kernel line.
Your GPU doesn't support double precision. This is why the OpenCL runtime is reporting it cannot enable the cl_khr_fp64 extension. If you really need double precision, try using the CPU as an OpenCL device instead and run your kernel on that.

Cannot initialize EGL display: "Bad alloc (0x3003)" on running a sample app on arm platform

I am trying to run a very simple app using openGLES on the arm platform and I got this problem:
QEgl::display(): Cannot initialize EGL display: "Bad alloc (0x3003)"
QEglContext::chooseConfig(): Could not find a suitable EGL configuration
Requested: "type=es2 rgba=0,0,0,0 surface-type=window"
Available:
Segmentation fault (core dumped)
Any idea how to fix this problem?
I am using QT-4.8.0
I had similar issues with my ARM embedded linux platform.
Check that your SGX drivers are install properly.
Check with hello_gles2 that it works properly.
OpenGL ES need the framebuffer in specific mode.
I used Qt 4.8.3 natively installed from sources.
Once ererything is properly installed, it is nice
to use Qt with openGL ES

Resources