Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved QtConcurrent -thread not running concurrently

    General and Desktop
    3
    10
    406
    Loading More Posts
    • 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
      meganathan last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • M
          meganathan last edited by meganathan

          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 Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • JKSH
              JKSH Moderators last edited by

              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 Reply Quote 1
              • M
                meganathan last edited by

                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 Reply Quote 0
                • M
                  meganathan @JKSH last edited by

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

                  JKSH 1 Reply Last reply Reply Quote 0
                  • JKSH
                    JKSH Moderators @meganathan last edited by

                    @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 Reply Quote 0
                    • M
                      meganathan last edited by

                      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

                      JKSH 1 Reply Last reply Reply Quote 0
                      • JKSH
                        JKSH Moderators @meganathan last edited by

                        @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 Reply Quote 2
                        • First post
                          Last post