Increase CPU Speed - MAC

37 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2020-4-7
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.

更多回答(1 个)

Yair Altman
Yair Altman 2020-4-7
编辑:Yair Altman 2020-4-7
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 个评论
Alejandro Fernández
Hello, I have the toolbox. The problem is that I cannot use it because none of its functions is useful to me

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by