Undefined function 'savetofile' for input arguments of type 'sym
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Fede C 2018 London
il 15 Ago 2022
Risposto: Walter Roberson
il 16 Ago 2022
Hi all,
I'm using a co-author's program from a published paper and while running his code with different data, I ran into the following error message:
Error using runDLRsym (line 40)
The source code (C:\Users\nkhoz\Desktop\Wed10Aug\ReplicationFiles_Empirical\BenchmarkModel\PrepWald\runDLRsym.m) for the parfor-loop that is
trying to execute on the worker could not be found.
Error in RunPrep (line 6)
runDLRsym(nv, ng);
Caused by:
Undefined function 'savetofile' for input arguments of type 'sym'.
Error using remoteParallelFunction (line 84)
Worker unable to find file.
Undefined function 'savetofile' for input arguments of type 'sym'.
After I asked him about it, he ran the program and the he got the same error message back (this program used to work just fine). Neither of us has any idea. I was hoping someone would be kind enough to help me work this out? Apparently SaveToFIle was introduced in 2015, but I'm not aware/cannot find any info of it being replaced by something else. I do have the symbolic toolkit add on, so that's not the issue.
For the sake of clarity, here are the lines that Matlab isn't happy with. Line 40 is from this:
function runDLRsym(nv, ng)
...
...
...
...
for row = 1:nv
parfor col = 1:ng-1
name = sprintf('DLRsym%d%d',row,col);
varr = DLRsym(row,col);
savetofile(varr,name);
end
end
toc
Line 6 from the program that calls DLRsym is here:
tic
%parpool(4)
nv= 6;
ng = 3;
runDLRsym(nv, ng);
toc
getjacobDLR(nv, ng);
toc
%4000 seconds to run
2 Commenti
Benjamin Thompson
il 15 Ago 2022
Maybe savetofile is a local function on your system and you are not pushing it to the parallel workers or your MATLAB path is not pushing to the parallel workers? You use parforOptions to add additional files to send to workers, and maybe the automatic dependency analyzer is missing that one.
Risposta accettata
Walter Roberson
il 16 Ago 2022
Source code is posted at https://www.mathworks.com/matlabcentral/answers/215594-saving-within-spmd-or-parfor
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Parallel for-Loops (parfor) in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!