Unsolved Qt + OpenCL does not recognise GPU
-
Hi,
I'm having problems detecting my GPU when I run my code that includes the standard OpenCL library with Qt 5 under Ubuntu 16.04.
I'm using an AMD FirePro W5100 with AMD APP SDK 3.0 and the latest AMD drivers for Ubuntu 16.04. The card is recognized by the OS and by OpenCL when I run "clinfo" on terminal.What's very strange is that when I run the code on Qt, the AMD platform is detected but no AMD devices are detected. When I run the exact same code on another IDE, the GPU is recognized.
Given that I'd like to stick with Qt do you have any ideas of why this is happening? Do I need to grant any particular privileges to Qt? I have no clue why this is happening.
-
Hi and welcome to devnet,
Can you share the code you are using ?
Does it also happen if you start the application from the command line ?
-
Hi @SGaist , thanks for replying.
If I make and run my application via terminal everything works fine and the GPU is recognized.
this is the code I'm using :
vector<cl::Platform> platforms; cl::Platform::get(&platforms); cout << "Platforms found: " << platforms.size() << endl; for(int j = 0; j < platforms.size(); j++){ cout << "\nPlatform #" << j+1 << endl; cout << "Platform vendor: " << platforms[j].getInfo<CL_PLATFORM_VENDOR>() << endl; vector<cl::Device> devices; platforms[j].getDevices(CL_DEVICE_TYPE_ALL, &devices); for (int i = 0; i < devices.size(); i++) { cout << "Device " << i << " - vendor = " << devices[i].getInfo<CL_DEVICE_VENDOR>() << " - Version = " << devices[i].getInfo<CL_DEVICE_VERSION>() << endl; } }
e.g. this is the output i get if i run the code with qt:
Platforms found: 1Platform #1
Platform vendor: Advanced Micro Devices, Inc.
Device 0 - vendor = GenuineIntel - Version = OpenCL 1.2 AMD-APP (1800.8)device 0 is the CPU. While this is what I get with the terminal instead:
Platforms found: 1Platform #1
Platform vendor: Advanced Micro Devices, Inc.
Device 0 - vendor = Advanced Micro Devices, Inc. - Version = OpenCL 1.2 AMD-APP (2482.3)which is what I'm expecting to get.
In addition, if I copy-paste any of the AMD sample projects that are included in the AMD APP SDK 3 on Qt, the GPU is never detected. Again, if I run them with the terminal they all work as expected.
-
As you are writing a Linux application, I suggest you write a basic C program first, then trying to write a dynamic-linked library, which is used by pure C program, to detect problem, then to use Qt with that library.