Clear Filters
Clear Filters

Increase CPU Speed - MAC

18 views (last 30 days)
Hi, I have an i9 processor with 8 cores and I am trying to solve an image processing problem in Matlab and I am realizing that it is only using 10% of the CPU capacity to solve the problem.
I can't use the parallel processing toolbox because it doesn't fit my needs.
Is there any possibility to increase the number of cores you use by default?
I'm using macOS as my operating system

Accepted Answer

Walter Roberson
Walter Roberson on 7 Apr 2020
Is there any possibility to increase the number of cores you use by default?
No, there is no such possibility.
MATLAB's execution engine examines the code to be executed and detects some common patterns of operations. When it finds one it recognizes, it examines the size of the input arrays, and if the input arrays are "big enough" then it calls the high performance multi-threaded (multicore) libraries to do the calculations.
Setting up to call those libraries and setting up appropriate computation threads takes time, so if the computation to be done is small enough, then MATLAB does not bother calling the high performance libraries, and instead does the computation in a single thread. If MATLAB thought that there was performance gains to be had by switching to multiple cores, taking into account that is not free then it would have done so.
When MATLAB executes for long periods with only one CPU in use, then that indicates one of three possibilities:
  1. The pattern of computations might not be suitable for high performance acceleration using the facilities in the libraries; or
  2. MATLAB might not be able to recognize the pattern of computations as being able to be done with the high performance libraries due to the way the code is written; or
  3. MATLAB might have recognized the pattern but realized that the computation is too small for there to be a net benefit from using multiple cores
  • Generally speaking, vectorizing operations with larger arrays can often be recognized as something that can be done with the high performance libraries.
  • Generally speaking, loops accessing individual elements of arrays are not always recognized as something that can be accelerated, especially if the part that can be accelerated is buried in a bunch of other computations.
  • Generally speaking, if there are a lot of if/else then acceleration would not be done.
  • Generally speaking, you are advised to code image processing in terms of imfilter() or conv2() instead of equivalent loops, as imfilter() and conv2() call upon special libraries that can use tricks like fft() in order to perform filtering.

More Answers (1)

Yair Altman
Yair Altman on 7 Apr 2020
Edited: Yair Altman on 7 Apr 2020
You can separate the problem into separate tasks and launch separate Matlab processes to process them in parallel. This is essentially what the Parallel Computing Toolbox is doing. If you don't want to purchase the toolbox you can do it manually - it's more difficult to do manually, but it doesn't cost any money....
  1 Comment
Alejandro Fernández
Alejandro Fernández on 7 Apr 2020
Hello, I have the toolbox. The problem is that I cannot use it because none of its functions is useful to me

Sign in to comment.


Find more on Image Processing Toolbox in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!