How to reduce the number of workers in the backgroundPool?

조회 수: 2 (최근 30일)
James London
James London 2024년 3월 1일
댓글: Walter Roberson 2024년 3월 2일
I would like to limit the backgroundPool to 2 workers. But when I restart my computer, then open MATLAB, then run the following code I get 10 workers. Is there anyway to reduce the number of backgroundPool workers? Thanks in advance!
Input:
maxNumCompThreads(1)
backgroundPool
Output:
>> maxNumCompThreads(1)
ans =
6
>> backgroundPool
ans =
BackgroundPool with properties:
NumWorkers: 10
Busy: false
  댓글 수: 3
James London
James London 2024년 3월 1일
Good to know! Thanks!
I am using an Intel i5-12600KF processor which I belive has 6 P-cores and 4 E-cores.
I am performing live image processing from a custom microscope. I am doing the image processing on the backgroundPool. This allows a user of the microscope to use a GUI to adjust the movemnt of the microscope in real time while images a being processed. The processing does take up a fair amount of RAM but is very fast. I want to limit the number of backgroundPool workers to prevent all of the RAM from being used by the backgroundPool so that new images can come in and be queued up for processing.
Walter Roberson
Walter Roberson 2024년 3월 1일
If you parfeval() exactly two functions, then the memory will not build up.

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

답변 (1개)

Monisha
Monisha 2024년 3월 2일
delete(gcp('nocreate')); % Delete any existing parallel pool parpool(2); % Create a new parallel pool with 2 workers
This code will delete any existing parallel pool and create a new one with only 2 workers. Place this code at the beginning of your script or function to ensure that it's executed whenever MATLAB starts. This should help you maintain the desired number of workers even after restarting your computer and reopening MATLAB.

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by