How to have multiple instances of MATLAB save the same file simultaneously -
I am currently writing a code to run a series of time consuming experiments using nodes on a Unix cluster. Each of these experiments takes 3 days to a 12-core machine. When every experiment is done, I hope that it has to save some data in a normal file.
I have a minor issue that I submit all my experiments at the same time to the cluster and therefore they can save the same file at the same time.
I am wondering what will happen when many examples of MATLAB try to save the same file at the same time (error / crash / none). Whatever the outcome, I can work around it using a Try / Grip Loop:
n_tries = 0; While n_tries & lt; Try saving 10 ('common_file', data) n_tries = 10; Hold wait_time = 60 * rand; How to stop (wait_time); N_tries = n_tries + 1; End and End
No.
All Matlab functions are clearly not safe to use in multi-threading / processing environments if you write together in a matte file from multiple matab sessions simultaneously There are possibilities that either many variables are unavailable (because 2 matlab files are attached in this stage) or the whole file is corrupted.
Save individual files and merge them into the post-processing step.
Comments
Post a Comment