Measuring run time

49 views
Skip to first unread message

earlyb...@gmail.com

unread,
Aug 14, 2017, 6:16:57 PM8/14/17
to AMPL Modeling Language
Hello,

I´d like to measure the "wall clock" time it takes AMPL to run my complete .run file. To do so I am using the command "display _ampl_time" at the end of my .run file. Somehow the results vary quite a bit. After measuring the run time with my own stop watch for the same data setting over and over again, I know that i takes around 10 seconds every time. Sometimes the _ampl_time ist correct, sometimes it´s something like 500 seconds. Could someone give me some advice on this?

Thank you so much in advance!

Best regards  

Robert Fourer

unread,
Aug 15, 2017, 10:48:09 AM8/15/17
to am...@googlegroups.com
To get the "wall clock" time, use "_ampl_elapsed_time". This gives the current time on the computer's clock minus the time that was on the clock when AMPL started.

If you have further problems with timing, please include in your posting the platform (Windows, Linux, macOS) that you are running on, and the version of AMPL (output of "option version;") that you are using.

Bob Fourer
am...@googlegroups.com

=======

earlyb...@gmail.com

unread,
Aug 16, 2017, 9:29:31 AM8/16/17
to AMPL Modeling Language, earlyb...@gmail.com
Dear Mr. Fourer,

thank you very much for your answer! Unfortunately _ampl_elapsed_time does not generate the required results, too. Sometimes the measurement of the running time is spot on. But sometimes it is way off (like 300 seconds although the real run time was about 10 seconds). The platform I am using is Windows 7 Professional and the AMPL Version is "AMPL Version 20170412 (Intel icl EMT64 10.1.029, 64-bit)".

Thank you for your efforts and best regards.

Robert Fourer

unread,
Aug 16, 2017, 4:59:39 PM8/16/17
to am...@googlegroups.com
We have no previous reports of this trouble when using _ampl_elapsed_time. Can you provide a little more information? Are you first starting an interactive AMPL session and then executing the .run file with an "include yourfile.run" command typed at an "ampl:" prompt? Or are you are typing "ampl yourfile.run" in a command window to run an AMPL script in "batch" mode? Also, do you get very different timings when you repeat the exact same run, with the same model and data files?

Also if your files are not too large, it will be helpful if you can attach them to your reply.
Reply all
Reply to author
Forward
0 new messages