user3034939
user3034939

Reputation: 13

Matlab code taking a long time to run

I have a Matlab code (from a journal paper) and I'm trying to re-simulate their data. I executed the code one week ago. I think the code is taking so long time to run. Matlab is still busy and taking 50% of my cpu. I was wondering if the process has ended with some errors somewhere in the code. My question is: When I see no errors, can I be sure that everything is fine with this running process? And I can wait until it is finished? Is there any way to check which part of code is being run now ( without stopping the execution)? Or I should stop the program and try something else? Actually I don't want to loose this 1 week and if you think everything is fine, I would wait until the code stops. (The authors of the paper didn't reply to my question and I don't know how long should it naturally take... They just mentioned it may take a long time to simulate the data).

Upvotes: 1

Views: 2587

Answers (1)

LowPolyCorgi
LowPolyCorgi

Reputation: 5170

Unfortunately, there is little we can do for you.

  • When I see no errors, can I be sure that everything is fine with this running process?

That's pretty much the definition of an error. If no error is raised, then it means that the program is still running.

  • Is there any way to check which part of code is being run now (without stopping the execution)?

Unfortunately no. For long-lasting execution times like that, a good developing practice is to display some information from time to time to inform the end user of the execution status.

However, if the programs produces files all along the way (like for instance at every step in an iterative simulation) you can check on your computer that the files are well-produced, and the production rate will more or less inform you on the total execution time.

For all your other questions, well, it's up to you to decide what to do (stop it or let it run). Be aware that the execution time can differ significantly from one machine to another, so the time it took on the author's machine may not be really informative to you.

In the future, I would advise you to react faster than within a week. When you launch a code that has a long execution time and see that there is no display within the first hour, you should stop it, modify it such that it regulatly displays information, and re-run it. It's better to loose one hour than one week.

Best,

Upvotes: 3

Related Questions