hyperthreading question
显示 更早的评论
Hi there, I have matlab running on a Quad core I7 processor which has 8 threads. I did a loop of a function test changing the number of labs. These are my results in seconds:
matlabpool 12 21.61s
matlabpool 10 21.96s
matlabpool 8 22.27s
matlabpool 6 23.29s
matlabpool 4 25.54s
I tested it on another loop with another function and also found that using 12 labs is the fastest? How comes this is happening if I only have 8 threads available and 4 cores?
I look forward to a reply.
3 个评论
Richard Brown
2012-5-1
What was your test function?
Ken Atwell
2012-5-2
The timing differences are pretty subtle, all with 20% of each other. I'd be tempted to call this a "tie". :)
Richard Brown
2012-5-2
That was my initial thought too, but the numbers are uniformly decreasing as the number of labs went up ... it would be interesting to know if that always happens
采纳的回答
更多回答(1 个)
Geoff
2012-5-2
1 个投票
I'd like to see the results if you expand your operation to something that takes about 10 minutes. And do it with the utter minimum of background processes running.
You're talking about a few hundred milliseconds, which can easily be eaten up by, say, a piece of software doing some routine background work.
Also, in all fairness, you MUST ensure that the number of iterations in your parfor loop is a multiple of 4, 6, 8, 10 and 12, or some number sufficiently high as to cancel out the effect of some workers finishing the task early, while others have to perform one extra loop (I'm assuming your test function is a constant-time operation).
If would be interesting to see your test code, if you are happy to post it.
At this stage, I'm not open to accepting that 10 workers is faster than 8 on a machine with 8 logical cores. But that could be due to my own ignorance. =)
1 个评论
Geoff
2012-5-2
Just an afterthought about my comment on the number of parfor loops. I would in fact prefer starting with prod([4,6,8,10,12]) iterations, and multiply that by about a million. The goal is that you share out a decent amount of work evenly between all your workers, then set them loose.
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel Computing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!