Standalone Application Crash with infinite timer

조회 수: 10 (최근 30일)
Giovanna Scaramuzzino
Giovanna Scaramuzzino 2021년 11월 17일
댓글: Giovanna Scaramuzzino 2021년 11월 24일
HI,
i tried to create a standalone application with the code below. This code run in matlab ide, but when i start the .exe file created by application compiler tool this crash.
If i put a pause() function after parfeval() (into for) this crash after the execution of the pause function.
How can I solve the problem and what is it due to?
Thank you
delete(gcp('nocreate'));
p = parpool('local');
for i = 1:5
futures(i) = parfeval(@provatimer,0,i);
end
function provatimer(i)
tic
t = timer('TimerFcn',@(~,~)f('timer_parfeval_' + string(i)));
t.ExecutionMode = 'fixedspacing';
t.Period = 4;
start(t);
end
function f(i)
fileID = fopen( i + '.txt','at');
fprintf(fileID,'%f \n',toc);
fclose(fileID);
end
  댓글 수: 3
Giovanna Scaramuzzino
Giovanna Scaramuzzino 2021년 11월 22일
편집: Giovanna Scaramuzzino 2021년 11월 22일
The code run without error in Matlab, (writes endlessly in the files created) .
Using the file .exe this code crashes: files are created and the first value is written, after it crashes. I cant' post the .exe file but I create this with the Standalone Application tool of Matlab.
writing the code with pause(inf) :
for i = 1:5
futures(i) = parfeval(@provatimer,0,i);
end
pause(inf)
the code run also in .exe mode. This practise (use Pause(inf)) i don't think is correct.
Giovanna Scaramuzzino
Giovanna Scaramuzzino 2021년 11월 24일
Before terminate the execution on the Windows Command shell the last phrase is : parallel pool using the local profile is shutting down (this appear only when execute the same code using the file .exe) and then the process terminate.
Why is possible?
I also tried to use parpool('local', 'IdleTimeout',Inf)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by