How can I use speed up Matlab?
11 views (last 30 days)
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.
Jason Ross on 26 Apr 2013
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 on 26 Apr 2013
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.