function outputs wrong data if run in multiple instances at the same time

Hi,
I am experiencing some problems making different copies of the same matlab function run at the same time on a multiprocessor working station. In details, I made a standalone executable file that I run 4 times and each of them, during its execution, will output some results in matrices then written to files. So different simulations by using the same code realized with an intrinsically serial approach with a duration of about 36 hours (each). The problem arises when trying to open these matrices, and to make some videos. Matlab says that these matrices contain complex data and they should not. If I repeat exactly the same simulation by running only once the executable I obtain the wanted results without any complex expression. I wonder if this can be due to the fact that these tasks use the same names for variables and that they interact between them modifying a portion of memory to which they should not have access. Is there a way to overcome this problem so to force each task to create and to work on its own memory space in spite of the fact that other processes will use the same parameter names with different values??
Thanks for your help

5 comentarios

Is it not just a case that multiple processes are writing to the same files? Depending how you run them they should already have their own independent workspace.
Unfortunately this is not he case. I make each instance write its own files to a different disk. In principle, each instance uses its starting parameters and writes its files. The simulation (the function) is always the same.
You'd probably need to show some code as it is impossible to tell whether things are being shared by workspaces or not otherwise - for example, if you have handle-derived objects these are passed around by reference and so would be shared.
I see, is it possible to force matlab create a new workspace for each instance and make all the others refer only to its own ?
As regards the code, it is related to a reserved project so I cannot show it. Anyway thank you very much for your help
Matlab will already create a new workspace for each of the workers if you are using e.g. parfor, but this still doesn't mean that objects aren't share between those workspaces when they are copied across to them - it depends on the copy semantics of the objects.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Variables en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Sept. de 2016

Comentada:

el 29 de Sept. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by