Why does matlab stop "executing" code after a long time?

54 ビュー (過去 30 日間)
C V Ambarish
C V Ambarish 2017 年 6 月 10 日
コメント済み: dpb 2022 年 5 月 18 日
I am using matlab on a Windows 10 machine with 8 gb of ram.
The system I am simulating has a degree of randomness in it which is why I need to make different runs of the same code in a loop and average over all of them. An outline of my code is like:-
% create and initialise variables 'mat' and others
for run=1:20
currMatForRun = includeRandomness(mat)
%processing with currMatForRun
end
One run takes around 2 hours.
The memory consumed seems to be constant at around 70%(I checked with resource monitor) and I don't think there is a memory leak. I am comfortably able to use my computer for browsing etc even when the code is running.
But after running for about 14-15 hrs, the code execution sort of freezes up, I get nothing on the console anymore. (I get an update roughly every two minutes). I tried waiting for 8 more hours but still nothing.
The memory and cpu usage in the resource monitor go down almost to zero and I get no error in the matlab console.
I tried the entire process 5 times, the time of freeze seemed to be similar for each time.
I am using a standalone version of matlab, I can run it without the internet. (So, I don't think there is a license polling problem, not completely sure though).
This is my first post, so not sure if I have given enough information, please tell me if you need anything else.
Edit:- I did another run and it stopped at a similar time. I did monitor resource consumption this time. Attached image. Legend is as follows
The blue is the processor use. Yellow is Working set, Red is private working set, green is page file bytes (virtual memory) and pink/magenta? is IO Data in Bytes per second.
I waited for a while before stopping the recording, and the time where the process stops can be seen clearly from the processor curve dip. If you think monitoring any other parameter might be useful, please tell me.
Things seem to be as I expected them (atleast on the surface), so still not sure what's wrong, ideas/thoughts appreciated!
Edit 2: I did two more things to check.
  • I took out the random part of the code and ran the basic part of the code meaning I was pretty much running the same code over and over again with no changes.Things were completely deterministic. The program still got stuck after a similar amount of time.
  • I ran a 10000 variable equation solving (as suggested by John in the comments) 5400 times which is ~ 15 hours and this ran without a hitch.
Overall the confusion has deepened, but hopefully the night is darkest before dawn.
  15 件のコメント
KiranKumar Makam
KiranKumar Makam 2022 年 5 月 18 日
I too am facing the same issues I have timeline to meet and variables calculated are in the matlab its not responding. I am waiting for the one hour after pressing the pause button this is quite not expected. Is there a place where Matlab saves all the variables which we can access and save before we shut down the matlab forcefully. I am using Mac OS X Big Sur.
dpb
dpb 2022 年 5 月 18 日
Well, MATLAB has memory allocated for everything, yes, but it is not user-accessible from the outside by anything except a system monitor and all that will be is a memory dump...which won't be useful for your purpose.
As the OP of this thread noted, in his case he could write the results of each iteration to an output file during execution(*) and so retrieve what results were available; I'd suggest that would be your option as well -- save what you are computing and need/want periodically to disk.
(*) Which raises a Q? I don't think I recall being asked -- did he monitor that file -- could he have neglected to close file handle on that and that was the resource limit or somesuch?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by