How can I use speed up Matlab?

4 次查看(过去 30 天)
Ayob
Ayob 2013-4-26
I have a large program with a plenty of data and whenever I run Matlab on my program it takes a lot to do it. I checked my CPU usage in windows task bar manager. It never gets over 50 percent and stays something around 50%, sometimes 51 or 49% . I think I can speed up Matlab calculating by let it have 90 or 95 percent of my CPU usage. I don't know how can I set this property on Matlab and my PC.
Note: I'm using windows vista on LG laptop.
  2 个评论
Walter Roberson
Walter Roberson 2013-4-26
Do you happen to have a dual core processor?
What kind of processing are you doing? Are you using vectorization a lot on large matrices? Which MATLAB release are you using?
Ayob
Ayob 2013-4-26
编辑:Ayob 2013-4-26
Yes,I have a Intel dual core processor. I'm making a big matrix from smaller ones what is called matrix assembling but I think it's not important what I'm doing. I just want to have much CPU usage.

请先登录,再进行评论。

回答(2 个)

Jason Ross
Jason Ross 2013-4-26
If your CPU uses hyper-threading, the OS is reporting the number of virtual cores, which are typically twice the number of execution cores. Math operations will require the execution cores and will therefore look as if the system is only half busy.
If you turn off hyper-threading in the BIOS, I bet your CPU utilization climbs to the percentage you want, although the execution time of your code will likely stay the same.

Walter Roberson
Walter Roberson 2013-4-26
Your CPU percentage might reflect that only one of your two cores is engaged in the work. In certain cases, MATLAB will automatically use multiple cores even if the user does not have the Parallel Computing Toolkit, but those cases are based upon doing mathematical operations on large vectors or arrays (usually around 9000 or more elements.)
I cannot determine at the moment whether your task would be suitable for parallel processing even if you had the Parallel Computing Toolkit, but it might be.
You should profile your code to determine where the bottlenecks are. You should ensure that you pre-allocate your matrices when computationally practical. These are unlikely not engage the second core automatically, but they have the potential for improving the efficiency of your single-core computation.

类别

Help CenterFile Exchange 中查找有关 Performance Profiling 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by