why does (ga + parallel + global variables + sub2ind) fail?
Ältere Kommentare anzeigen
When optimizing with ga and parallel computing, a sub2ind call using globals fails (subscript vectors must be of same size), but when doing it in serial, it doesn't fail. Why?
Akzeptierte Antwort
Weitere Antworten (2)
Walter Roberson
am 10 Sep. 2016
1 Stimme
Global variables are never copied to parallel workers.
You might be able to take advantage of parallel.pool.Constant or of parfevalOnAll() to initialize the variable on all of the workers.
1 Kommentar
Walter Roberson
am 11 Sep. 2016
If you have especially large shared data, you could also use the File Exchange contribution https://www.mathworks.com/matlabcentral/fileexchange/28572-sharedmatrix to use shared memory. This will only work if the compute nodes are on the same host, though
Jochen Schuettler
am 12 Sep. 2016
0 Stimmen
Kategorien
Mehr zu Parallel Computing Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!