parfeval diaries sometimes missing
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a script that runs parfeval on a bunch tasks. The code is below. The code has two outputs:
- Results in an Excel file (one row per task)
- A log file which gets appended with the diary from each worker.
Once all tasks have been completed, I have a complete set of results in the Excel file, but I'm missing some logs. The attached file is the list of tests reported in the log. There should be 59 rows, but there are only 50. Any idea why some diaries aren't being written to the file? My understanding is that it shouldn't be a file access issue because the second for loop is not executed in parallel. So the log file is opened, appended and closed as each worker finishes a task. Could it be a flushing issue?
Edit: I should add that if I run the job in single tasking mode everything is fine. All logs are present.
Code:
for i = casesToRun
f(i) = parfeval(p, @doStuff, 2, i, j, test_cases, HitsToAutoTRFile, FailureType, Standard, ModelAssembley);
end
for i = casesToRun
[completedIdx, status, xlRow] = fetchNext(f);
writeWorkerLog(f(i).Diary, logFileName);
xlswrite(TestCasesFile,status,'Sheet1',xlRow);
end
function writeWorkerLog(logData, fName)
% create the file if it doesn't exist, then close it
fid=fopen(fName, 'a+');
fprintf(fid, logData);
fclose(fid);
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown 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!