Dynare creating too many temporary variables

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Dynare creating too many temporary variables

Postby twin » Wed Nov 25, 2015 7:29 pm

Hi,

I'm currently attempting to do a second order approximation of a relatively large system (around 60 variables, 2500 parameters, and fairly complicated model expressions) and I get the following error message:

"Error using feval
The current workspace already has too many variables; there is no room for "T854468".

Error in stochastic_solvers (line 107)
[junk,jacobia_,hessian1] = feval([M_.fname '_dynamic'],z(iyr0),...

Error in resol (line 141)
[dr,info] = stochastic_solvers(dr,check_flag,M,options,oo);

Error in stoch_simul (line 82)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);

Error in aggregateDynamics (line 8010)
info = stoch_simul(var_list_);

Error in dynare (line 223)
evalin('base',fname) ;

Error in mainFile (line 119)
dynare aggregateDynamics minimal_workspace"

The error comes after the preprocessing is completed and the steady state is computed (using an external _steadystate.m file) without error. So my guess is that the preprocessor creates a lot of temporary terms as part of the differentiation routine (see slide 59 of "preprocessor.pdf" in the doc folder), and when Matlab evaluates the _dynamic.m file it runs out of room in the workspace. I can compute the first order approximation no problem, so the extra terms must be coming from the second order derivatives.

If anyone has any advice for me, I would really appreciate it! Some ideas I had: are there ways to reduce the amount of temporary terms created in the preprocessor? (I think that these temporary terms are created because they are common components in the derivatives) Or, is there a way to write my system to minimize the number of temporary terms created? Or, is there a way to clear the unnecessary terms from Matlab's memory, without messing up the final evaluation of the derivatives? Or, a way to increase the size of Matlab's workspace? I'm already using the minimal_workspace option in the unstable snapshot by invoking "dynare filename.mod minimal_workspace" in Matlab.

As a last resort, I am thinking of feeding in my own derivative matrices, and calling Dynare's functions to do the rest of the model computation and analysis.

Thanks,

Tom
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm

Re: Dynare creating too many temporary variables

Postby HoutanBastani » Thu Nov 26, 2015 9:54 am

Pass the
Code: Select all
notmpterms
argument to the dynare command line. I.e.:
Code: Select all
dynare model.mod notmpterms
You can read more about it and other command line options in the manual.
Best,
Houtan
HoutanBastani
 
Posts: 197
Joined: Fri Jan 22, 2010 4:11 pm
Location: Paris, France

Re: Dynare creating too many temporary variables

Postby twin » Thu Nov 26, 2015 3:21 pm

Thanks Houtan! This is exactly the option I was looking for. Sorry to waste your time, I thought I had looked everywhere for a solution, but apparently missed this entry in the manual.
twin
 
Posts: 9
Joined: Wed Nov 25, 2015 7:10 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 14 guests