parfeval diaries sometimes missing

조회 수: 4 (최근 30일)
Ben Wetherill
Ben Wetherill 2018년 2월 2일
편집: Ben Wetherill 2018년 2월 2일
I have a script that runs parfeval on a bunch tasks. The code is below. The code has two outputs:
  1. Results in an Excel file (one row per task)
  2. 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개)

카테고리

Help CenterFile Exchange에서 Background Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by