Why QThread cannot speedup my program on Intel core 2 duo Q6700
-
wrote on 20 Aug 2010, 06:33 last edited by
[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.
-
wrote on 20 Aug 2010, 06:56 last edited by
And what times are on Q6700? I can't believe that something that parallels ok at T9300 and i7 strangely breaks at Q6700.
-
wrote on 20 Aug 2010, 07:11 last edited by
[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...
-
wrote on 20 Aug 2010, 07:21 last edited by
How do you actually run the multithreaded code? Are you doing something stupid there that forces a serialization again?
-
wrote on 20 Aug 2010, 10:18 last edited by
@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.
-
wrote on 20 Aug 2010, 13:51 last edited by
mario: Yeap, that is what I would have tried, too. Let's try to help with the current solution though.
-
wrote on 20 Aug 2010, 17:22 last edited by
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.
-
wrote on 20 Aug 2010, 17:49 last edited by
[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.
-
wrote on 21 Aug 2010, 04:51 last edited by
Different processors have different cache size and that may be a problem source.
-
wrote on 24 Aug 2010, 07:24 last edited by
[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.
12/12