Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt + OpenCL does not recognise GPU
Forum Update on Monday, May 27th 2025

Qt + OpenCL does not recognise GPU

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 779 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Izzy88
    wrote on last edited by Izzy88
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Izzy88
        wrote on last edited by Izzy88
        #3

        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: 1

        Platform #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: 1

        Platform #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.

        1 Reply Last reply
        0
        • jiancaiyangJ Offline
          jiancaiyangJ Offline
          jiancaiyang
          wrote on last edited by
          #4

          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.

          我们自己的论坛:http://qtdream.com
          擅长三维角色仿真动画。

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved