Running multiple processes or speed up

  • 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

  • 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.

  • 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?

  • Lifetime Qt Champion

    @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? ...?

  • Moderators

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

  • @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

  • @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.

  • @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.

  • @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.

Log in to reply