Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QThread + OpenMP



  • I would like to know if is possible to create a new QThread to a function called my_func(), and this new QThread start a OpenMP parallelization (creating another threads...).

    Like:

    #pragma omp parallel for 
    for (int i = 0; i < 10000; i++) {
         // code here...
    }
    

    So, the final result should be something like:
    Main Application: 1 Thread
    my_func(): 1 Thread (QThread)
    OpenMP: 12 Threads

    Total: 1 + 1 + 12 = 14 threads running

    Is this possible?

    Important: This solution must be cross-platform: Windows, Linux and Mac


  • Qt Champions 2019

    I don't see why it should not be possible.


Log in to reply