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. Running multiple processes or speed up

Running multiple processes or speed up

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 6 Posters 2.3k 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.
  • S Offline
    S Offline
    s002wjh
    wrote on last edited by
    #1

    Any way to run QT app with multiple processes in Linux. I was gonna use multiple thread but it requires a lot modifications since all the functions are declared within QWidget class. I basically need move various functions into Qobject for multiple thread.

    Basically I need a simple way to speed up the app. Or something I can tell it to run in multiple CPU core

    kshegunovK 1 Reply Last reply
    0
    • W Offline
      W Offline
      wrosecrans
      wrote on last edited by
      #2

      The topic of how to parallelize applications is a large field. Without asking a more specific question, you aren't going to be able to get very specific advice. There's nothing that stops you from running multiple processes, but you'll need to handle moving data between the processes yourself. There are lots of ways to do it, but without any hints about what you are actually trying to do, and what is slow, it's hard to speculate about.

      1 Reply Last reply
      4
      • S Offline
        S Offline
        s002wjh
        wrote on last edited by
        #3

        My main gui can open up several other gui that plot pixels at x-y coordinate in real time. I would like these sub gui operates in parallel. These sub gui don't share data with each other but grab data from same shared place then calculate its own pixels location then plot on pixelmap. Hope this help?

        jsulmJ A 2 Replies Last reply
        0
        • S s002wjh

          My main gui can open up several other gui that plot pixels at x-y coordinate in real time. I would like these sub gui operates in parallel. These sub gui don't share data with each other but grab data from same shared place then calculate its own pixels location then plot on pixelmap. Hope this help?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @s002wjh You should use threads. Using processes will not make it simpler. With processes you have to deal with IPC (Inter Process Communication).
          "same shared place" - what is this place? A database? A device? ...?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          S 1 Reply Last reply
          2
          • S s002wjh

            Any way to run QT app with multiple processes in Linux. I was gonna use multiple thread but it requires a lot modifications since all the functions are declared within QWidget class. I basically need move various functions into Qobject for multiple thread.

            Basically I need a simple way to speed up the app. Or something I can tell it to run in multiple CPU core

            kshegunovK Offline
            kshegunovK Offline
            kshegunov
            Moderators
            wrote on last edited by kshegunov
            #5

            If you're willing to settle with OpenMPI, this might be of interest: https://bitbucket.org/kshegunov/qtmpi
            It's still a work in progress though, so there are few bugs.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            1
            • jsulmJ jsulm

              @s002wjh You should use threads. Using processes will not make it simpler. With processes you have to deal with IPC (Inter Process Communication).
              "same shared place" - what is this place? A database? A device? ...?

              S Offline
              S Offline
              s002wjh
              wrote on last edited by
              #6

              @jsulm
              Sry I mean data that used by all sub gui came from same memory space. Then each sub gui do something with that data and plotted in pixelmap

              JonBJ W 2 Replies Last reply
              0
              • S s002wjh

                @jsulm
                Sry I mean data that used by all sub gui came from same memory space. Then each sub gui do something with that data and plotted in pixelmap

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @s002wjh
                In answer to your original question, and as others have said, threads may be the answer, but running separate processes almost certainly is not.

                1 Reply Last reply
                0
                • S s002wjh

                  @jsulm
                  Sry I mean data that used by all sub gui came from same memory space. Then each sub gui do something with that data and plotted in pixelmap

                  W Offline
                  W Offline
                  wrosecrans
                  wrote on last edited by
                  #8

                  @s002wjh

                  Sry I mean data that used by all sub gui came from same memory space. Then each sub gui do something with that data and plotted in pixelmap

                  By definition, processes are different memory spaces. So you'll either need to do some clever magic with forking, or handle inter process communication if you want to have a child process make a UI based on data from a different process. Neither of those is a small topic or necessarily a simple thing to implement well.

                  1 Reply Last reply
                  0
                  • S s002wjh

                    My main gui can open up several other gui that plot pixels at x-y coordinate in real time. I would like these sub gui operates in parallel. These sub gui don't share data with each other but grab data from same shared place then calculate its own pixels location then plot on pixelmap. Hope this help?

                    A Offline
                    A Offline
                    ambershark
                    wrote on last edited by
                    #9

                    @s002wjh Qt doesn't support multi-threaded GUIs. Your gui can exist in a separate thread but all GUI actions have to be on a single thread.

                    Since you have slowness problems I'm guessing you are doing a lot of calculations on your data points. If that's the case then you can offload those calculations to a new thread (or thread pool) and then signal the point to actually plot to your GUI thread. That part should be very fast.

                    This should help you get started.. but if you get stuck and have actual implementation details I can help you figure out your threading.

                    https://doc.qt.io/qt-5.10/thread-basics.html

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    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