Shared memory in parfor genetic algorithm
Show older comments
Hello, community Matlab!
I use gamultiobj with parallelization, since my optimization function takes a lot of time when performing. To accelerate this process, I want to caching repeated data in some array or map, which can be calculated in the optimization function. That is, the functions can come to the input that the data that does not make no sense that it makes no sense to re-consider. All workers must have access to this array, read and write down values.
The problem is that I do not know how to do it, because gamultiobj uses parfor inside himself, in which, as I understand it, not to transmit data between workers. I wanted to use global variables, but they cannot be used in parfor. I would have perfectly suited the implementation of the LabProbe / Labreceive / Labsend, which are unfortunately used in spmd.
Thanks, Alexander.
Accepted Answer
More Answers (1)
Walter Roberson
on 11 May 2022
0 votes
You can use Parallel Data Queue to send results back from the worker to the controller, and another set to distribute results to the worker. It is a bit of a nuisance, and might not be efficient.
You could also do something like hash the arguments to get an index to use into a memory map. This might be a challenge to do efficiently.
1 Comment
Alexander Kobyzhev
on 12 May 2022
Categories
Find more on Parallel Computing Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!