Announcement

Collapse
No announcement yet.

Use of parallelism in KDE applications

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Use of parallelism in KDE applications

    Is it possible make some KDE apps use parallelism? In particular K3B (when ripping CDs) and Gwenview (producing contact sheets)? I don't like to wait while my processor barely hits 12% (4 cores + hyperthreading).

    #2
    Linux already does this. However, prioritization of running processes is more likely to be what you are finding 'irritating'. Linux is by design, a multi-tasking OS; it doesn't wait for one process to finish before starting another.
    Windows no longer obstructs my view.
    Using Kubuntu Linux since March 23, 2007.
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      I know... But if the process has only one thread of execution, it will not use more than one core, leaving 7 cores idle.

      Comment


        #4
        Now...THIS is a very interesting thread.

        woodsmoke

        Comment


          #5
          So for instance, let's take K3B. It takes 10 minutes tp re-encode a CD. It does it track by track. Only of CPU is really working. Given the amount of data read and written, it is not I/O bound. If it spawned threads or subprocesses to encode 8 tracks in parallel, the system would dispatch them to the various CPUs, all CPUs would be busy and it would take pretty close to one eighth of the time to rip the CD (OK, I could be optimistic here since hyperthreading isn't exactly a distinct CPU, but I would still expect well over a 4x improvement).

          Comment


            #6
            Here is a comment from a feb 2017 thread at Ask Ubuntu

            A program must be made to use multiple cores. The programmer needs to write a instruction for each core.

            If the program you are running don't use it, it never will without a update/upgrade.

            What can I do to speed up my program?

            You can disable some cores and overclock the one that is left. But first ask yourself if the program needs that speed. Or rewrite the program if possible.
            However the above is just ONE "expert"

            Here is another one which, after some initial discussion describes using an application called "taskset" on an Ubuntu machine.

            http://www.hecticgeek.com/2012/03/as...-ubuntu-linux/

            again, interesting thread.

            woodsmoke
            Last edited by woodsmoke; Jun 09, 2017, 03:42 PM.

            Comment


              #7
              One can use Ksysguard to change the niceness (priority) of an application. Right mouse in the app.
              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
              – John F. Kennedy, February 26, 1962.

              Comment


                #8
                Originally posted by woodsmoke View Post
                Here is a comment from a feb 2017 thread at Ask Ubuntu

                A program must be made to use multiple cores.
                Exactly. And my question is, are K3B and Gwenview written for this? Many application may support this with some obscure and barely documented setting (for instance, Gimp will check GEGL_THREADS in the environment).

                taskset doesn't make a process run on several cores in parallel. It only ensure that a given process will be dispatched on specific cores.

                If the application is written to use only one flow of execution (and therefore run on a single CPU core at a time), which is what happens by default, nothing is going to make it run on several cores. Increasing its priority is only useful when it competes against other processes for CPU.

                Comment


                  #9
                  quite beyond my ken.

                  woodlikesbarbiesmoke

                  Comment


                    #10
                    One thing I haven't heard mentioned is that the default CPU governor in almost all Linux kernels is the ondemand governor, which will not scale up processor frequency until CPU utilization hits 95%. Machines using the intel_pstate driver (third-generation Intel Core and later) default to the powersave governor.

                    Since IMO processor frequency has almost zero impact on power consumption both my laptop and home server are locked at highest frequency by using the performance governor instead of the ondemand (or in the case of my laptop, powersave) governor.

                    Excellent read here - https://wiki.archlinux.org/index.php...quency_scaling

                    You can't make a single-threaded application use more threads but you can increase CPU frequency, which will make all those threads run a little quicker.
                    we see things not as they are, but as we are.
                    -- anais nin

                    Comment


                      #11
                      Originally posted by Ofnuts View Post
                      Exactly. And my question is, are K3B and Gwenview written for this? Many application may support this with some obscure and barely documented setting (for instance, Gimp will check GEGL_THREADS in the environment).
                      K3B is written using threads but the developer said it was difficult to do because he needed the threads to talk to each other. I don't know about Gwenview, although I doubt it. Not very many apps are designed to use threading or multiple processes. That's partly because most applications cannot be broken down into parallel processes that can be threaded simultaneously while allowing the app to continue accepting input from the user for processing. Take indexing, for example. A developer might be tempted to put it on a thread and let the user continue to use the app. It may improve the indexing speed but only testing will determine by how much and if the increase is worth it. But, if the index is then used before the indexing is complete, the results will not be inclusive. That's why apps throw up a modal window and do not allow continued operation until the indexing is complete. Certain classes of problems are a fit for threading and multiple processes but most are not. Programs suitable for multiple threads or processes are usually run on super computers with thousands of cores, or more, to give each thread or process one or more cores. Such programs use matrices or Taylor or McLauren Expansion series with lots of terms to create CGI output.

                      KDE and most of its apps are written using the Qt API. The documentation discusses threading here: http://doc.qt.io/qt-5/thread-basics.html
                      Qt has "Signals and Slots" technology to simplify call-backs and communication between threads and between a thread and its parent. S&S simplifies a lot of things but there are still a lot of things that can go awry and threading apps are very difficult to debug.


                      Originally posted by Ofnuts View Post
                      taskset doesn't make a process run on several cores in parallel. It only ensure that a given process will be dispatched on specific cores.
                      True, but running on more than one core may give better results than running on only one, but it depends on how the app was designed.


                      Originally posted by Ofnuts View Post
                      If the application is written to use only one flow of execution (and therefore run on a single CPU core at a time), which is what happens by default, nothing is going to make it run on several cores. Increasing its priority is only useful when it competes against other processes for CPU.
                      NO app or thread runs on a core alone. If you list the processes that are running in your system you will see that EVERY app/process is competing against THOUSANDS other apps/processes on all your cores. Changing the priority for an app will give it an advantage over apps running with a niceness of 0, or average priority. Niceness varies from -20 to +20 (High to Low Priority). Giving an app a higher priority via Ksysguard lowers its niceness. You can also use the nice command in a Konsole to do the same thing.
                      Last edited by GreyGeek; Jun 10, 2017, 10:04 AM.
                      "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                      – John F. Kennedy, February 26, 1962.

                      Comment


                        #12
                        Originally posted by GreyGeek View Post
                        K3B is written using threads but the developer said it was difficult to do because he needed the threads to talk to each other. I don't know about Gwenview, although I doubt it. Not very many apps are designed to use threading or multiple processes. That's partly because most applications cannot be broken down into parallel processes that can be threaded simultaneously while allowing the app to continue accepting input from the user for processing. [...] Certain classes of problems are a fit for threading and multiple processes but most are not.
                        I would put MP3-encoding a file in that category. It's complicated if you try to use several threads to encode parts of the same file, but it's easy if you are encoding several files in parallel since there is no need for the threads to communicate between themselves since they don't work on the same data.

                        Originally posted by GreyGeek View Post
                        Programs suitable for multiple threads or processes are usually run on super computers with thousands of cores, or more
                        Much closer to home, your garden-variety Java-based web server is multi-threaded these days.

                        Originally posted by GreyGeek View Post
                        Originally posted by Ofnuts
                        True, but running on more than one core may give better results than running on only one, but it depends on how the app was designed.
                        Let rephrase that more explicitly: True, but running on more than one core at a time may give better results than running on only one at a time, but it depends on how the app was designed.

                        Comment


                          #13
                          k3b is just using something like lame behind the scenes . if you want to encode N files just start N encodes using the encoder directly.
                          Mark Your Solved Issues [SOLVED]
                          (top of thread: thread tools)

                          Comment


                            #14
                            soundkonverter is a multithreaded audio conversion application built for KDE that can also apparently rip CDs (didn't know it could do CD ripping or I'd have mentioned it earlier).

                            I use it to convert flac to mp3 since my car doesn't do flac - and I've had it running as many as eight threads at a time.
                            Last edited by wizard10000; Jun 12, 2017, 11:12 AM.
                            we see things not as they are, but as we are.
                            -- anais nin

                            Comment

                            Working...
                            X