How to use Parallel Computing Toolbox to control access to a file?

11 vues (au cours des 30 derniers jours)
Dan Klisiewicz
Dan Klisiewicz le 3 Fév 2021
I have a .mat file that is susceptible to more than one MATLAB client loading in the data, changing the data, and then saving it with the same name. I would ideally like to create a function that will do those operations and then use the Parallel Computing Toolbox (somehow) to run this function. Based on my limited understanding, you can create a job (or future?) to run this function and assign it to one worker. Is it also possible to block it from other workers, or to have other workers check for existing jobs, specifically across different matlab clients?
I essentially want to create a queue to access a file, but I don't have a good enough understanding of the PCT to formulate the best way to accomplish the above.
  2 commentaires
Raymond Norris
Raymond Norris le 3 Fév 2021
To clarify, you want to create a queue of tasks, processed by workers, but they need to be processed one worker at a time, correct? If so, what value is there to have multitude of workers if only one can run at a time as they're all working on the same MAT-file?
Or are you in essence looking to offload the work to another MATLAB process (i.e. worker) to free up your main execution thread?
Dan Klisiewicz
Dan Klisiewicz le 3 Fév 2021
Modifié(e) : Dan Klisiewicz le 4 Fév 2021
So, the idea to use multiple workers was spawned from an original search to create a semaphore concept in matlab, which led me to this page:
The OP and responders float the idea of using PCT to block workers to achieve something of the sort.
I really don't need to offload work for the purpose of speed, computing power, or effiiciency. I'm really looking for a solution to having two matlab clients safely accessing the same file in a queue fashion. If you have any suggestions that aren't related to PCT, I'm open to those. If, however, you have an explanation to the original question (regardless of whether it makes sense efficiency wise), it would help my understanding of PCT for future use!
Thanks!

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by