CodeXL cannot run GPU profile - opencl

I write an OpenCL program and want to profile it with codeXL.But the GPU : Performance Counters didn't work. The program is a very easy vector-add example and it runs properly on visual studio 2017. The codeXL displays cannot open vecAdd.cl, failed to create CL program from source. It is strange, who can give me some advice? The operating system is windows 10 x64 pro, codeXL 2.5.67, AMD FirePro w7100, amd app sdk 3.0 x86.
The vecAdd.cl is as follows:
__kernel void vector_add(global const float *a, global const float *b,
global float *result)
{
int gid = get_global_id(0);
result[gid] = a[gid] + b[gid];
}

OK,I have solved it. Because I set the wrong categories and codeXL cannot find the vecAdd.cl.

Related

Debian Sid, All Qt GUI software give Segmentation fault at launch

Here very strange situation.
Fresh install Debian Sid, XFCE4, nvidia proprietary driver 340.108 from Sid repo(maybe this proprietary driver have bug?)
c2d, gf9800gtx, 4gb ram, hdd
Now when i try start [b]any Qt software almost all[/b] give here Segmentation fault
Example Doomseeker, it crashes at start, BUT! working good through
gdb ./doomseeker
strace ./doomseeker
Same is with Qbittorrent
https://imgur.com/a/SYgqHZD
and 2048-Qt
https://imgur.com/SUefK7P
Only one Qt application starting normally - CMake GUI
Segmentation fault
#include <QApplication>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
return 0;
}
Please, can you give answer why it happens?
And if its possible solve this?

clCreateFromGLTexture() returns CL_INVALID_CONTEXT on certain platforms only

After positive creation of the shared context between OpenGL and OpenCL using following:
cl_context_properties cps[] = {
CL_GL_CONTEXT_KHR,
(cl_context_properties)glXGetCurrentContext(),
CL_GLX_DISPLAY_KHR,
(cl_context_properties)glXGetCurrentDisplay(),
CL_CONTEXT_PLATFORM,
(cl_context_properties)platform_id,
0
};
// Create an OpenCL context
m_contextCL = clCreateContext( cps, 1, &device_id, NULL, NULL, &err);
I try to create a shared texture:
cl_mem mem = clCreateFromGLTexture(
m_contextCL ,
CL_MEM_READ_ONLY ,
GL_TEXTURE_2D ,
0 ,
qt_fbo->texture() ,
&err
);
Now the call is successful only on xubuntu 16.04 with NVIDIA Quadro K620 using proprietary driver version 387.26 and OpenCL delivered with CUDA implementation package.
However when trying it on Toshiba laptop with Intel HD Graphics 520 on Manjaro OS and Beignet OpenCL implementation. The clCreateFromGLTexture(...) is failing by returning CL_INVALID_CONTEXT,
Additionally I tried another platform with Ubuntu 16.04 and Intel Iris IGP (Integrated Graphics Processor) using both Intel SDK and Beignet OpenCL. It fails at the same point of shared texture creation.
I created minimum working example for comparison two GPU techniques (OpenGL and OpenCL) and its interoperability with Qt:
https://github.com/pietrzakmat/opengl-opencl-qt-interop.
All the steps are derived from two tutorials:
1. https://www.codeproject.com/Articles/685281/OpenGL-OpenCL-Interoperability-A-Case-Study-Using
2. https://software.intel.com/en-us/articles/opencl-and-opengl-interoperability-tutorial
Anyone could point out what am I doing wrong and why the creation of shared texture fails on the platforms with integrated graphics or IGP Intel cpu? Is this some problem with drivers or OpenCL implementations? I managed to build and run the samples included in Beignet or intel_ocl_examples so I think the installation is correct.
1) is supported cl_khr_gl_sharing extension? Did you try to use this code on Windows Platform/macOS for Intel GPU ?
2) Did you try to use texture without attached to FBO ?
any way, i think this is problem in OpenCL implementation on Linux platform.

qDebug()<<qstring no longer compiling

I have built a QWidgets application in Qt 5.3.1 and in some places have used
qDebug() << msg;
where msg is a QString.
I had had this compiling and running for a few years, but tonight I decided to recompile it and I got the message:
D:\devt\myapp\extcoder.cpp:29: error: no matching function for call to 'QMessageLogger::debug()'
qDebug()<<msg;
^
In fact I got a similar problem in another app I wrote the other day, and by experimenting I thought I had fixed it by replacing such calls by qDebug(msg).
But it looks as if some kind of software rot is setting in!
Any ideas? Of course the file starts with
#include <QDebug>
To test this problem I built a barebones QWidgets application (of a QMainWindow kind), and the only code I wrote, was (apart from the #include)
qDebug()<<"Hello world";
in the MainWindow constructor. I get exactly the same compilation error.
Reinstallation of Qt made qDebug()<<s work again.
It was indeed a kind of "software rot": I reinstalled qt 5.3.1 after making a copy of the original so I could compare the new with the old.
Using Winmerge I was able to uncover the error:
I dont know exactly how it happened but the file qlogging.h got corrupted.
Here's what happened: at lines 118 and 120 the declarations of two versions of debug got rewritten to NBIS_debug.
Now I have worked trying to port free software from the NBIS. At some stage I must have renamed a debug function from debug to NBIS_debug, and this modification must have been propagated all the way to qlogging.h.
QDebug &QDebug::operator<<(const QString &s) is supported in Qt.
Output example:
QString s;
s = "a";
qDebug().noquote() << s; // prints: a
qDebug() << s; // prints: "a"
Your Qt environment must be broken. Please, check your environment and re-install Qt if needed.
I had to reinstall Ubuntu and Qt. The reinstall only Qt did not help.

How to do OpenCL programming in the newest Xilinx Vivado (2014.2)?

I used a simple "Hello, world." OpenCL program in the version 2014.2 Xilinx Vivado IDE, which declared its OpenCL support. One of the code snippets is as follows:
#include <CL/opencl.h>
...
// Connect to a compute device
//
int gpu = 1;
err = clGetDeviceIDs(NULL, gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU, 1, &device_id, NULL);
if (err != CL_SUCCESS)
{
printf("Error: Failed to create a device group!\n");
return EXIT_FAILURE;
}
However, it seems that this Vivado couldn't recognize the header "CL/opencl.h" and the cl related functions. I resolved the header problem by manually put a external CL directory (derived from CUDA SDK) in my current Vivado HLS project, but it still reported errors like "function 'clGetDeviceIDs' has no function body".
#include <CL/opencl.h> is how it's done on Mac OS X, but on Windows it is usually #include <CL/cl.h>. Have you located your CL include folder? Have you told the IDE where it is? It sounds like your second problem (after you worked around the first) is that you're not linking against OpenCL.lib (or whatever the library extension is on your platform). You need to locate that too and link to it. On an ICD-supporting platform, the Khronos lib can be used and it dynamically locates the installed drivers, but on your platform it is probably be different, so consult the Xilinx instructions.
It seems that including clc.h in my Vivado 2015.2 did the trick.

using square root function (sqrt) with doubles in OpenCL

I've got a kernel which uses the OpenCL builtin square root function (sqrt) but when I try to run the kernel on the GPU I get a unrecognized command error when building, it works fine if i use floats but when using doubles it does not work. I'm running on a Mac OS X 10.7.5 and my Graphics Card is a ATI Radeon HD 6750 card.
Does anyone know what the problem could be?
Apparently your gpu doesn't support double precision floats:
http://clbenchmark.com/device-environment.jsp?config=12011396
AMD cards that do support double report extension: cl_khr_fp64 (or cl_amd_fp64).
You could check at openCL compile time this way:
#ifdef cl_khr_fp64
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
#elif defined(cl_amd_fp64)
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
#else
#error "Double precision floating point not supported by OpenCL implementation."
#endif
Or you could check without running the opencl compile this way:
status = clGetDeviceInfo (oclInfo->device, CL_DEVICE_DOUBLE_FP_CONFIG, sizeof configFp64, &configFp64, NULL);

Resources