Loop crashes

Hi All,

I am running a very large loop in which i change some of the parameters of my model.

However, most of the times this loop crashes with the following error:

[quote]Error: Can’t open file two_country_currency_union_tn_dynamic.m for writing

Error using dynare (line 114)
DYNARE: preprocessing failed

Error in welfare_star_tn (line 49)
dynare two_country_currency_union_tn noclearall;[/quote]

Any hints?



If you only change parameters, you are not supposed to repeatedly call Dynare. Rather, run Dynare only once and then use the commands you want to run in a loop directly. See [Loop over parameters)
Whenever you run dynare itself, you are running the preprocessor, which re-creates all files. It seems that your machine is not quick enough in writing these files so that the previous iteration was not done yet with writing the created files, leading to the crash.

I had similar problems while using Dropbox. I paused syncing and the problem was solved.

Let me reiterate my point. Although e.g. Wouter Den Haan and Eric Sims say so in their Dynare notes, you should always avoid running full Dynare within a loop or optimizer. If anyhow possible, make use of the Dynare rountines without running the preprocessor over and over again. This typically requires only small effort and increases speed by several magnitudes.