# Condensation and Solution Speed

Condensation can improve the speed of your model. In general you substitute out or backsolve large variables with many components. This reduces the size of the matrix you have to solve at each step. However if you do too much condensation, it can also slow the model down again. This is because in order to do the substitutions and backsolves, the program has to calculate a lot of extra coefficients (C00...) introduced during the condensation process..

To see how long your model takes, add a statement CPU = yes ; to your Command file and save a log file of the simulation.
This will tell you the total CPU time for the simulation.
Search for "CPU" in a log file of the simulation and you will see many statements about the CPU time taken by the different parts of the simulation. These different parts of the simulation are explained here.

For example, the following CPU times appeared in the log file of a 1-step simulation.

[CPU for reads, formulas etc is 0.74218750 seconds.]
[CPU for reads, formulas etc is 7.9687500 seconds.]
[CPU for equations is 23.312500 seconds.]
[CPU for formulas and equations is 32.371094 seconds.]
[CPU time for MA48A is 16.031250 seconds.]
[CPU time for MA48B is 2.2382812 seconds.]
[CPU time for LU decomposition is 18.269531 seconds.]
[CPU time for MA48C/MA28I is 1.1679688 seconds.]
[CPU time for solution accuracy check is 0.17187500 seconds.]
[CPU for simulation is 23.339844 seconds.]
[CPU for backsolve is 0.30859375 seconds.]
[CPU for update is 0.74218750 seconds.]
[CPU for step 1 is 56.832031 seconds.]
[CPU for all of this 1-step calculation is 58.523438 seconds.]
[Total CPU is 61.000000 seconds.]

You can see how long the whole simulation takes (61 seconds) and also which parts are slow: eg calculating the formulas and equations at the start (32 secs), solving the matrix (CPU for LU decomposition 18 secs).

### Too little condensation

If your model is large and you do not do much condensation, you will probably find that the time for calculating the formulas and equations is small and the time for the LU decomposition is very large. In this case you should add some condensations for large variables, as described here.

### Too much condensation

If you find that the formulas and equations are taking most of the time and the LU decomposition is very fast, your model may be faster if you do less condensation. The question is which condensations to leave out. This is a matter of trial and comparing times. Variables which occur in many equations, like basic prices or industry outputs, may be better left in the model not substituted out or backsolved.

### Condensation information file

Include in your CMF file a statement like:

```  condensation information file =  cond.txt ;
```

The Condensation information file is a text file which contains information about the sizes and status (condensed, backsolved, substituted out, omitted) of the variables and equations. It is very useful when you are deciding how to condense a new model or how to fine-tune the condensation for an old model. For example, substitute out or backsolve for the largest variables that are usually endogenous and perhaps omit some of the larger variables that are exogenous and unshocked [see the manual information].

Go back to
GEMPACK FAQ Page