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

7 ビュー (過去 30 日間)
Dan Klisiewicz
Dan Klisiewicz 2021 年 2 月 3 日
編集済み: Dan Klisiewicz 2021 年 2 月 4 日
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 件のコメント
Raymond Norris
Raymond Norris 2021 年 2 月 3 日
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 2021 年 2 月 3 日
編集済み: Dan Klisiewicz 2021 年 2 月 4 日
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!

サインインしてコメントする。

回答 (0 件)

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by