Within script function not working in parallel code

4 ビュー (過去 30 日間)
Soumyadipta Sengupta
Soumyadipta Sengupta 2018 年 12 月 22 日
回答済み: Kojiro Saito 2018 年 12 月 26 日
if i have functions within the script, the parallel code is not working in both 2017b and 2018 on a cluster. The workers are not able to locate the functions in the script file. Although , the code works if i save the function separately ?

採用された回答

Kojiro Saito
Kojiro Saito 2018 年 12 月 26 日
>>Although , the code works if i save the function separately?
Yes, if the function is saved as another m file, the file will be sent to a cluster automatically. If not, you can send the file to the cluster by the following codes.
p = parpool; % Use default cluster profile
addAttachedFiles(p, {'myfunc.m'}) % Send one file to the cluster
% addAttachedFiles(p, {'myFun1.m','myFun2.m'}) % Send two files to the cluster
After this, I think you can run your script without an error.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel Computing Fundamentals についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by