How save is it to run Matlab in multiple instances at once

9 views (last 30 days)
i use Matlab to simulate and evaluate surface data. The code i use is programmed object orientated and has several thousand lines of code. Calculations need minutes or even hours.
To enhance my productivity, i want to use the same code in multiple matlab instances in parallel to simulate different parameters at once.
Or, i want to run a simualtion and evaluate the results of another simulation in a second matlab instance. In case of the evaluation, loading (and deleting) data and dealing with the same variable-names like in the running simulation of the other instance is normnal.
From time to time i saw strange results in the simulations and i am not sure if this is because of my parallel work
Is it save to do the things described above, or should i be cautious doing so?
Might there be a possible crosstalk between the different instances?
EDIT:
PS.: I'm aware, that changing the code or variables during calculation could change the result. And since the same code is used by the other instances, they are affected too.
The code in every instance is started by loading a configuration file and the corresponding data.
The code itself will not be changed in any instances by user during the calculation, and i want to exclude this error scenario from the discussion
  1 Comment
Jeff Miller
Jeff Miller on 30 Jul 2020
I have often done something very similar to what you are describing and never experienced any problems, with up to 4 separate MATLAB sessions open at once on the same (Windows) computer.
You should also look into using the MATLAB 'batch' command, which provides similar functionality in most situations.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 30 Jul 2020
You could get collisions if they're all accessing the same files on disk. But if they're not and everything is in memory, then I think every instance has it's own private collection of variables in its own private workspace so you should not have a problem. There is probably another reason for the anomalies.

Categories

Find more on Licensing on Cloud Platforms 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!