Increase CPU Speed - MAC

조회 수: 33 (최근 30일)
Alejandro Fernández
Alejandro Fernández 2020년 4월 6일
댓글: Alejandro Fernández 2020년 4월 7일
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
Alejandro Fernández
Alejandro Fernández 2020년 4월 7일
Ok, thank you so much for all.

댓글을 달려면 로그인하십시오.

추가 답변 (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
Alejandro Fernández 2020년 4월 7일
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