Use the same parallel pool for multiple deployed applications
조회 수: 1 (최근 30일)
이전 댓글 표시
I have compiled my code that is making use of the distributed computing toolbox and it is deployed on a server. Multiple requests are calling the executable at the same time. What i've noticed is that each time a request is calling the executable, a new parallel pool is created to be used within this executable. Is it possible to create a 'global' parallel pool that is shared among the processes to avoid the overhead of creating a new pool each time?
댓글 수: 1
Walter Roberson
2023년 5월 10일
편집: Walter Roberson
2023년 5월 11일
If it can be done at all, you would need the Production Server.
답변 (1개)
Dheeraj
2023년 12월 1일
Hi,
I understand that you are trying to create a global pool of workers to avoid overhead of creating multiple pool each time.
To achieve this, you can set up a persistent parallel pool that is shared among MATLAB sessions.
Here’s a general approach how you could do this:.
% Initialize parallel pool if not already created
poolobj = gcp('nocreate');
if isempty(poolobj)
parpool(); % You can customize pool settings as needed
end
“gcp” or get current pool checks the existence of current pool and utilizes them for the program.
This approach should help you share a parallel pool among multiple requests on your server, reducing the overhead of creating a new pool for each execution.
You could go through the below MATLAB’s documentation to get a better understanding of “gcp”.
Hope this helps!
댓글 수: 1
Walter Roberson
2023년 12월 1일
I do not understand how this would permit multiple sessions to share a pool? The different sessions do not have access to the memory of each other to be able to find the active pool information.
Creating persistent pools that stay active for performance reasons is a service of MATLAB Production Server, not of the Parallel Server Toolbox, as far as I understand.
참고 항목
카테고리
Help Center 및 File Exchange에서 Enterprise Deployment with MATLAB Production Server에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!