Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track time during model run #251

Open
MostafaGomaa93 opened this issue Aug 22, 2024 · 3 comments
Open

Track time during model run #251

MostafaGomaa93 opened this issue Aug 22, 2024 · 3 comments

Comments

@MostafaGomaa93
Copy link
Contributor

          Please avoid adding `disp` messages to the main loop of the model. Doing so will increase the size of the command output sometimes to GB, especially when processing long time series for multiple locations on HPC, and can cause issues when running the model in parallel. If you need to capture this information, it should be logged to a separate file with a specific filename. or you can write a test script under directory `tests`.

Originally posted by @SarahAlidoost in #243 (comment)

@MostafaGomaa93
Copy link
Contributor Author

Hi @SarahAlidoost. I would appreciate your suggestion for another way to track the simulation time while the model is running

@SarahAlidoost
Copy link
Member

A log file can be created as:

logFid = fopen(fullfile(OutputPath, 'YourLogFile.txt'), 'a');   % this before the main loop
fprintf(logFid, ...);  % this should be in the main loop to store e.g. KT
fclose(logFid);  % this after the main loop

You can also use diary which is available in both matlab and octave, but I have not tried it.

@Crystal-szj
Copy link
Contributor

Hi @MostafaGomaa93, I used diary to create a log file in Matlab. It may be helpful for you.
You can add this code

diary([Output_dir,'log.txt'])

before this line, here

while KT < endTime

and add diary off at the end of SEMMUS-SCOPE.m.
A log.txt file will be created, and all the output in maltab command line will be saved in this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants