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. QtConcurrent -thread not running concurrently
QtWS25 Last Chance

QtConcurrent -thread not running concurrently

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 959 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.
  • M Offline
    M Offline
    meganathan
    wrote on last edited by
    #1

    I am facing the problem on using Qtconcurrent::map() functionality in high core(>16) machine with 128GB RAM.

    The code works in my PC which is 8GB RAM and cores is 4, works is in the sense all the threads running concurrently but in high core machine only one thread is running at a time . I noticed with the help of Task manager.

    In thread, i am running the console application using QProcess.

    Please help me with resolving the issue.

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

      Hi,

      Did you compare the two machines setup ?
      Except hardware, how are they configured ?

      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
      • M Offline
        M Offline
        meganathan
        wrote on last edited by meganathan
        #3

        The machine which is working uses Intel(R) Core i5 8350U CPU
        The machine which is not working uses Intel Xeon Silver 4114 CPU 2 Processors
        What more additional information required?

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

          Well things like OS, special options used. If Linux, type of scheduler, custom kernel, etc.

          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
          • JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on last edited by
            #5

            As a quick check, call this on both PCs:

            qDebug() << QThread::idealThreadCount();
            qDebug() << QThreadPool::globalInstance->maxThreadCount();
            

            What values do you get?

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            M 1 Reply Last reply
            1
            • M Offline
              M Offline
              meganathan
              wrote on last edited by
              #6

              Both the machine uses windows 10 Enterprise version 1803. It is organization provided desktops so i can't have information on other specific options used

              1 Reply Last reply
              0
              • JKSHJ JKSH

                As a quick check, call this on both PCs:

                qDebug() << QThread::idealThreadCount();
                qDebug() << QThreadPool::globalInstance->maxThreadCount();
                

                What values do you get?

                M Offline
                M Offline
                meganathan
                wrote on last edited by
                #7

                @jksh both are 40 for the machine that is not working,
                8 for the machine it is working

                JKSHJ 1 Reply Last reply
                0
                • M meganathan

                  @jksh both are 40 for the machine that is not working,
                  8 for the machine it is working

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #8

                  @meganathan said in QtConcurrent -thread not running concurrently:

                  @jksh both are 40 for the machine that is not working,
                  8 for the machine it is working

                  Try setting a lower max thread count before you use QtConcurrent: QThreadPool::globalInstance->setMaxThreadCount(4);

                  Does that help on the Xeon machine? (Try a few different numbers)

                  Also, are you running the same executable on both machines?

                  In thread, i am running the console application using QProcess.

                  Do you mean you use QtConcurrent::map() to launch QProcess?

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    meganathan
                    wrote on last edited by
                    #9

                    i tried setting the maxthreadCount to 8 but still only one executable is running out of 8, it is not running concurrently in Xeon processor machine.

                    I am running the same executable in both the machine .

                    Yes, in mapped function, i use Qprocess to launch and execute the console application

                    JKSHJ 1 Reply Last reply
                    0
                    • M meganathan

                      i tried setting the maxthreadCount to 8 but still only one executable is running out of 8, it is not running concurrently in Xeon processor machine.

                      I am running the same executable in both the machine .

                      Yes, in mapped function, i use Qprocess to launch and execute the console application

                      JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #10

                      @meganathan said in QtConcurrent -thread not running concurrently:

                      i tried setting the maxthreadCount to 8 but still only one executable is running out of 8, it is not running concurrently in Xeon processor machine.

                      I am running the same executable in both the machine .

                      Yes, in mapped function, i use Qprocess to launch and execute the console application

                      I can think of 2 possibilities:

                      1. Only 1 instance of the console application can be run at a time on the Xeon machine, OR
                      2. There is an issue where Qt Concurrent can't use multiple threads in the Xeon machine

                      To check (1), put debug messages at the start and end of your map function:

                      QByteArray mapFunc(const QString& args)
                      {
                          qDebug() << "Starting " + args;
                      
                          QProcess p;
                          // Do expensive task here
                      
                          qDebug() << "Finished " + args;
                      }
                      

                      Do you see many "Starting" messages appear at the same time ("Starting" -> "Starting" -> "Starting" -> "Finished" -> "Finished" -> "Finished")?
                      Or do you get a single-threaded sequence ("Starting" -> "Finished" -> "Starting" -> "Finished" -> "Starting" -> "Finished")?

                      Also, how long does it take to run the console app?

                      To check (2), upgrade to the latest version of Qt (I notice that you're still using Qt 4.8 which reached end-of-life in 2015). If the issue still exists in Qt 5.13, submit a report to https://bugreports.qt.io/

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      2

                      • Login

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