- You need to know how many cores you really have. If you have a machine with "hyper-threading", you can have two actual cores, but they appear to the OS as four. Therefore, it's possible to have something like a Core2Duo in your laptop and a 2-core processor in your desktop, and have the same number of cores. Look up the spec sheet for your processor to find out.
- Parallel execution can be implicit or explicit. Some MATLAB functions are multithreaded, and will automatically take advantage. Others are not. Other functions (in combination with the Parallel Computing Toolbox) will take advantage of multiple cores, but you must change your code to use parallel computing constructs (parfor, spmd, etc)
- The most valuable thing you can do to search for speedup is to use the profiler to see what's taking up the most time in your code. Otherwise it's just guesswork and pre-optimization. It's possible that you are waiting on something like disk I/O to read a file and parse it, or there is some other bit of code that's written inefficiently, or you aren't preallocating, you could vectorize, etc.
parrallel computation,4-core machine
1 次查看(过去 30 天)
显示 更早的评论
I have got an Intel-4core machine recently ,R2011a installed on it.but,I still don't believe that I am using all of my machine's computation ability.actually I couldn't find any multi-threading option in preferences and when I run BENCH command I get a fast and reasonable response but when I run my program it gets sort of same time as my laptop.
0 个评论
采纳的回答
Jason Ross
2012-5-24
Things to know about performance of code:
3 个评论
Jason Ross
2012-5-29
If you've identified the slow section of code, I'd suggest you start a new question that asks "is there a way to increase the performance of this operation" and post the part that's slow. There have been many such questions asked where meaningful results came out -- but people have to be able to see the code.
更多回答(1 个)
Thomas
2012-5-22
I do not think bench command is not parallelized.
To make use of all the cores you need the Parallel computing toolbox and you need to parallelize your code (If it can be parallelized..) to actually see a speed up..
see
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Performance and Memory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!