Class with static variables in parallel global optimization algorithm
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I have a global optimization program dealing with large matrices (several gigabytes of data), so in order to save memory, a class with static variables was implemented similar to the implementation in Static Data, and then one object of this class is created, initialized and passed as an argument to a function handle acting as the objective function of global multistage optimization algorithm (Particle Swarm + Pattern Search). When parallelization in optimoptions is true:
optimoptions( ...
'UseParallel', true);
The optimization always yields false results, but when parallelization is turned off, it works correctly.
Thanks in advance!
댓글 수: 0
답변 (2개)
Walter Roberson
2019년 2월 14일
Look again at the link you provided . Notice the point about static data not being saved with an object . The process of sending variables to parallel workers involves save and load.
댓글 수: 3
Walter Roberson
2019년 3월 21일
However, that saves the matrix once per worker, not "only 1 time in the memory". If you strictly need "only 1 time in the memory" then you should look in the File Exchange for https://www.mathworks.com/matlabcentral/fileexchange/28572-sharedmatrix which uses operating system shared memory.
참고 항목
카테고리
Help Center 및 File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!