MATLAB Answers

RB
0

Help with Multithreading!

RB
さんによって質問されました 2019 年 5 月 15 日
最新アクティビティ Jan
さんによって 回答されました 2019 年 5 月 15 日
I have a for loop that runs through .tif files. Within the for loop there are more for loops. I want to speed up this code because it takes a very VERY long time to run on even one .tif file. I wanted to use multithreading or parallel threading, however the parfor command that comes with the parallel toolbox in matlab cannot be used on my for loops. Parfor cannot be used because we iterate through files in the first loop, and the following loops are order dependent. We need it to go consecutively, so parallel threading is not going to work. Is there any other way to use multithreading in these scenarios? Even a way to use mutlithreading in the first for loop (the one that runs through images - parfor won't work because the for loop is not an increasing integer) would speed it up by doing multiple images at once.
Any help is greatly appreciated, thank you!

  0 件のコメント

サインイン to comment.

1 件の回答

Jan
回答者: Jan
2019 年 5 月 15 日

If the data must be processed sequentially, you cannot run the task in a parallel way and therefor multi-threading will not help, because each thread would have to wait until the former one is ready. Multi-threading is useful only, if the data can be processed in parallel.
I suggest to post your code. The forum usually finds a way to accelerate it. In addition it would clarify statements like "the for loop is not an increasing integer".

  0 件のコメント

サインイン to comment.



Translated by