Parallel Computing Toolbox - Java object transfer from client to workers
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Stefano C
el 21 de Jul. de 2015
My problem regards the usage of the Parallel Computing Toolbox functions, and in particular the variable transfer from client to workers when the "variable" is a Java object. I have experieced that, without multithreading, passing a Java object from a main script to a function is not a problem, while using (for instance) parfeval to implement multithreading, the object is not passed correctly resulting in the error "Attempt to reference field of non-structure array", because the object structure is lost. Something similar happens to me also trying to implement multithreading exploiting a parfor cycle, therefore I suspect it may be a generalized issue with the usage of Matlab multithreading tools. May I kindly have any clarification with this regards?
0 comentarios
Respuesta aceptada
Edric Ellis
el 21 de Jul. de 2015
When you pass any MATLAB variables (including those that refer to Java objects) into parfor, parfeval, etc., then the contents of those variables need to be transmitted to a separate MATLAB process. The effect is the same as if you saved the variables to a .mat file and then loaded them. Not all MATLAB variables can be saved and loaded successfully - and those same variables will not function correctly with parfor, parfeval etc.
I recommend that you should construct such objects on the workers (i.e. inside parfor, parfeval, ...).
You might wish to use the Worker Object Wrapper to avoid constructing the same object multiple times on the workers.
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!