CPU Time Clarification- Algorithims

29 views
Skip to first unread message

KM

unread,
Apr 23, 2015, 12:00:28 PM4/23/15
to am...@googlegroups.com
I am using AMPL/CPLEX to run a decomposition scheme I created in a run file. The run file iterates through solving a master problem, checking if various metrics are met by iterating through numerous "For" and "If" statements, and then solving a number of subproblems, and checking termination criteria. 

I am currently reporting the Wall Clock time that it takes for the algorithm to run by using: 

param WallClockStartTime;
param WallClockRunTime;

let WallClockStartTime:= time();
  
. . . (Run Algorithm) . . .

let WallClockRunTime:=time()-WallClockStartTime;


How do I report the corresponding CPU time for this algorithm? I am aware of the built in AMPL timing parameters like:

_ampl_elapsed_time := elapsed seconds since the start of the AMPL process
_ampl_system_time  := system CPU seconds used by the AMPL process itself
_ampl_time         := _ampl_system_time + _ampl_user_time

_total_solve_elapsed_time := elapsed seconds used by all solve commands
_total_solve_user_time    := user CPU seconds used by all solve commands
_total_solve_time
         := _total_solve_system_time + _total_solve_user_time

However, I would like to include the CPU time of the "For" and "If" loops in addition to all of the solve commands. 


Robert Fourer

unread,
Apr 24, 2015, 1:52:31 PM4/24/15
to am...@googlegroups.com
_ampl_time gives CPU seconds used by the AMPL process since it began, including the time used to run loops and other scripting commands, generate problem instances and read results, and anything else that AMPL does -- but not including solving, since the solvers run as separate processes.

Note that also _solve_time gives CPU seconds used by the most recent solve, and _total_solve_time gives CPU seconds used by all solves so far. But for solvers that run in parallel on multiple cores or processors, this comes out as the sum of CPU times on all the processors, making it not such a useful measure.

Bob Fourer
4...@googlegroups.com

=======
Reply all
Reply to author
Forward
0 new messages