Reducing Simulation Time

General advice on speeding up simulations may be found in the GEMPACK manual.

When your model is large, the time taken to run a simulation can be quite long.

  1. To see how long your simulation takes, add a statement CPU = yes ; to your Command file and make a log file of the simulation. Search the log file for "CPU". This will tell you not only how long the whole simulation takes but also which part is slow: eg calculating the formulas and equations at the start, solving the matrix, doing the updates etc.
  2. If solving the matrix is taking a long time, trying changing the sparse linear equation solving routines (MA48, MA28). If you are solving with MA48 (the default), try using MA28 by adding a statement M28 = yes ; to your Command file (details here).
  3. If your solution regularly says it is unable to re-use pivots, you can turn off reusing pivots with a Command file statement NRP = yes ; (details here).
  4. Does your simulation make a few attempts to work out the values of MMNZ and MMNZ1? Once you have run a simulation and you know approximately how big MMNZ will be, you can use a Command file statement such as start with MMNZ= 3000000 ; where you should replace 3000000 by the appropriate value for MMNZ (details here).
  5. One thing which affects the speed of simulations is the condensation. Usually doing more substitutions or backsolves will reduce the solve time. Look in your Information file (.INF) to see how many components there are in the variables left in the condensed model. If you have left in a variable with tens of thousands of components, substitute it out. If you still want to see the values of the endogenous variables substituted out, you can backsolve for them (details here). However it is possible to condense your model too much.
  6. If you are using automatic accuracy and your simulation is failing to reach the required accuracy or some condition on the updated coefficients is not satisfied, the program will reduce the subinterval length in an attempt to increase the accuracy. Sometimes it can never reach the required accuracy and the subinterval length keeps getting smaller and smaller. Try changing some of the accuracy statements (details here).
  7. If your model is too large for your computer's memory, some operating systems will try paging to try to keep the simulation running instead of telling the user that there is insufficient memory. See if you can reduce your memory usage.
  8. If you are using GEMSIM to solve large models, you may reduce your solution time by using a TABLO-generated program. The time taken to solve the matrix is the same in both cases but the time taken for calculating formulas, equations, updates and backsolves is usually much shorter. You need the Source code version of GEMPACK in order to use TABLO-generated programs.


Go back to
GEMPACK FAQ Page