Why QThread cannot speedup my program on Intel core 2 duo Q6700
-
[quote author="Franzk" date="1282279430"]Please update your code with code tags (@) so it becomes readable.[/quote]
Thanks for your remind. it's my first time starting a discussion.
i tried it in another i7 920 computer currently. It works well and four threads made up 2.82x speedup. So i think it's Q6700's problem.
-
And what times are on Q6700? I can't believe that something that parallels ok at T9300 and i7 strangely breaks at Q6700.
-
[quote author="Denis Kormalev" date="1282287379"]And what times are on Q6700? I can't believe that something that parallels ok at T9300 and i7 strangely breaks at Q6700.[/quote]
Serial code cost 23s, while parallel code cost 32s. I tried it many times.
But when i increase p from 4 to 32 or 64 on Q6700, it will speedup 3.7x...
-
How do you actually run the multithreaded code? Are you doing something stupid there that forces a serialization again?
-
@PigiRoN: Little OT, but just out of curiosity...
Would it be possible to use "QtConcurrent::mappedReduced":http://doc.qt.nokia.com/4.6/qtconcurrentmap.html#mappedReduced instead of almost all the code you have written?
I think that the "QtConcurrent":http://doc.qt.nokia.com/4.6/threads-qtconcurrent.html module contains a lot of goodies for doing this kind of stuff.
-
mario: Yeap, that is what I would have tried, too. Let's try to help with the current solution though.
-
There are can be really many causes for this behaviour. It should be investigated by yourself which one you have encountered. It can be bind with the cache related issues(missing, races etc.) and it can be just an overhead of using thread. The best answer you can get from the thorough profiling of your code.
-
[quote author="ixSci" date="1282324950"]There are can be really many causes for this behaviour. It should be investigated by yourself which one you have encountered. It can be bind with the cache related issues(missing, races etc.) and it can be just an overhead of using thread. The best answer you can get from the thorough profiling of your code.
[/quote]More strange that it works ok for author at another multicore processors. So source architecture problems and possible race conditions are hardly the reason.
-
[quote author="Denis Kormalev" date="1282326556"][quote author="ixSci" date="1282324950"]There are can be really many causes for this behaviour. It should be investigated by yourself which one you have encountered. It can be bind with the cache related issues(missing, races etc.) and it can be just an overhead of using thread. The best answer you can get from the thorough profiling of your code.
[/quote]More strange that it works ok for author at another multicore processors. So source architecture problems and possible race conditions are hardly the reason. [/quote]
As long as increasing number of threads to 64, it will speedup 1.98x on dual core cpu or 3.79x on quad core cpu stably.