Parallel Proccesing



  • hay there
    as a project in university, i have to add this feature ( = multi-core/thread processing ) to a program. i just checked the Qt concurrent, but i didnt get much out of it ( i never did this before and there isnt anything about how you should do it or how do the classes/functions work ) i really appreciate if anybody could tell me where i can find a complete description/instruction about it?!
    thanks anyway


  • Moderators



  • Hiii
    thank u for your quick reply and sorry for my late answer ( i'm a hell busy these days :D )
    1st thing 1st, how can someone reduce runtime when the program is only running one task at a time, let me describe it another way, i read about concurrent and it can fulfill some of my needs ( still a little confused about how to use it ) , but as a part of my project i should make the program to use all cores at a time for one function ( i believe that this is done automatically by the system but my dear professor doesnt think so ) , as far as i know in Qt one can only works with threads that he made, is there any way that let you access cpu's cores and threads ?!!!
    thanks anyway ...
    PS : is it always this quite around here ?!!! , only one answer for my recent post :|



  • Hi GoodKat,

    I first of all: I may have some language limitation, but in case of I understand well your problem:

    "1st thing 1st, how can someone reduce runtime when the program is only running one task at a time"

    • During your experience you can faces the following cases:
      ** you have only one processor core: the operation system do a "quasi paralell execution"
      ** the solution of the given task wasn't designed for multi core execution
      ** you cannot design a paralell solution for the given problem
      but most of our systems have more than one processor core so the well
      paralellable problems can be solved by that systems within less time.

    "i should make the program to use all cores at a time for one function ( i believe
    that this is done automatically by the system but my dear professor doesnt think so ) "

    • The operating systems cannot interpret your code. They only execute it. If you didn't use threads or process during the implementation,
      the OS will launch one process / one thread.

    "one can only works with threads that he made, is there any way that let you access cpu’s cores and threads ?!!!"

    • You should use QThread and QProcess classes to create threads or processes but I don't suggest you that you try to get direct acces to the given CPU core. It is the responsibility of the scheduler.

  • Moderators

    Hi GoodKat,

    Could you provide some code to show what you're tying to achieve?

    With parallel processing, you can:

    • Run multiple different functions at the same time on different cores, OR
    • Run multiple copies of the same function at the same time on different cores.

    However, you cannot take one function and split it between cores. Instead, you need to rewrite your big function as a group of smaller functions. Then, run those small functions in parallel.

    [quote author="GoodKat" date="1391885307"]PS : is it always this quite around here ?!!! , only one answer for my recent post :|[/quote]Well, your question was "i really appreciate if anybody could tell me where i can find a complete description/instruction about it?!", and I gave you many links to the complete descriptions/instructions. What else can people add? :)



  • Hi JKSH,

    sorry, but you are wrong: "However, you cannot take one function and split it between cores."
    You can start an instance of same method within different processes.
    Let you considering the image processing: on a large amount of data you must do same operation.

    Regards,
    Norbert


  • Lifetime Qt Champion

    Hi,

    You misunderstood what JKSH wrote. What you are describing sounds like what JKSH wrote there:

    bq.
    Run multiple copies of the same function at the same time on different cores.

    Copies is the important word.

    In image processing what happens is that a function is called several time to work on a different part of the data. Each instance completely ignores what the others do



  • hi everyone
    about what you said, i'm afraid i cant share any code without the professors permission ( he will probably kill me for doing that :D ) , but i'll see him in few days and i'm going to ask him about it.
    will be back in few days.
    thanks again ...
    PS : does anybody knows any book on this field, if so plz let me know its name or a link to download it ( 2nd one is much more appropriate )


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.