• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

contrib/H04-Sep-2020-108,02480,082

doc/H18-Mar-2021-28,35821,692

dynare++/H18-Mar-2021-4,737,3094,715,790

examples/H17-Mar-2021-2,0911,853

m4/H18-Mar-2021-2,5902,235

macOS/H03-May-2022-897588

matlab/H18-Mar-2021-144,095131,695

mex/H18-Mar-2021-94,80181,850

preprocessor/H18-Mar-2021-134,364113,986

scripts/H17-Mar-2021-3,3672,437

tests/H18-Mar-2021-51,91944,548

windows/H03-May-2022-2,0461,512

.dir-locals.elH A D26-Feb-2020284 87

CONTRIBUTING.mdH A D26-Feb-20208.2 KiB10266

COPYINGH A D26-Feb-202034.3 KiB675553

Makefile.amH A D03-May-20221.8 KiB6858

Makefile.inH A D03-May-202227.6 KiB881784

NEWS.mdH A D17-Mar-2021109.1 KiB2,8701,895

README.mdH A D17-Mar-202114.6 KiB353298

VERSION.inH A D26-Feb-202017 11

aclocal.m4H A D18-Mar-202143.9 KiB1,2301,119

ar-libH A D05-Nov-20185.7 KiB271210

compileH A D05-Nov-20187.2 KiB349259

config.guessH A D24-Feb-201843.2 KiB1,4811,288

config.subH A D24-Feb-201835.3 KiB1,8021,661

configureH A D18-Mar-2021322.1 KiB12,1429,980

configure.acH A D18-Mar-20217.6 KiB219183

depcompH A D05-Nov-201823 KiB792502

install-shH A D05-Nov-201815 KiB519337

missingH A D05-Nov-20186.7 KiB216143

README.md

1<a name="logo"/>
2<div align="center">
3<a href="https://www.dynare.org/" target="_blank">
4<img src="https://www.dynare.org/assets/images/logo/dlogo.svg" alt="Dynare Logo"></img>
5</a>
6</div>
7
8# Dynare
9
10Described on the homepage: <https://www.dynare.org/>
11
12Most users should use the precompiled package available for their OS, also
13available via the Dynare homepage: <https://www.dynare.org/download/>.
14
15# Contributions
16
17To contribute to Dynare and participate in the Dynare community, please see: [CONTRIBUTING.md](https://git.dynare.org/Dynare/dynare/blob/master/CONTRIBUTING.md)
18
19# License
20
21Most of the source files are covered by the GNU General Public Licence version
223 or later (there are some exceptions to this, see [license.txt](license.txt) in
23Dynare distribution for specifics).
24
25# Building Dynare From Source
26
27Here, we explain how to build from source:
28- Dynare, including preprocessor and MEX files for MATLAB and Octave
29- Dynare++
30- all the associated documentation (PDF and HTML)
31
32This source can be retrieved in three forms:
33- via git, at <https://git.dynare.org/Dynare/dynare.git>
34- using the stable source archive of the latest Dynare version from <https://www.dynare.org/download/>
35- using a source snapshot of the unstable version, also from <https://www.dynare.org/download/>
36
37Note that if you obtain the source code via git, you will need to install more tools (see below).
38
39The first section of this page gives general instructions, which apply to all platforms. Then some specific platforms are discussed.
40
41**Note:** Here, when we refer to 32-bit or 64-bit, we refer to the type of
42MATLAB or Octave installation, not the type of operating system installation.
43For example, it is perfectly possible to run a 32-bit MATLAB on a 64-bit
44Windows: in that case, instructions for Windows 32-bit should be followed. To
45determine the type of your MATLAB/Octave installation, type:
46```matlab
47>> computer
48```
49at the MATLAB/Octave prompt. Under MATLAB, if it returns `PCWIN64`, `GLNX64` or
50`MACI64`, then it is a 64-bit MATLAB; if it returns `PCWIN`, `MACI` or `GLNX`,
51then it is a 32-bit MATLAB. Under Octave, if it returns a string that begins
52with `x86_64`, it is a 64-bit Octave; if the strings begins with `i686`, it is
53a 32-bit Octave.
54
55**Contents**
56
571. [**General Instructions**](#general-instructions)
581. [**Debian or Ubuntu**](#debian-or-ubuntu)
591. [**Windows**](#windows)
601. [**macOS**](#macos)
61
62## General Instructions
63
64### Prerequisites
65
66A number of tools and libraries are needed in order to recompile everything. You don't necessarily need to install everything, depending on what you want to compile.
67
68- A POSIX compliant shell and an implementation of Make (mandatory)
69- The [GNU Compiler Collection](http://gcc.gnu.org/), version 8 or later, with
70  gcc, g++ and gfortran (mandatory)
71- MATLAB (if you want to compile the MEX for MATLAB)
72- [GNU Octave](http://www.octave.org), with the development headers (if you
73  want to compile the MEX for Octave)
74- [Boost libraries](http://www.boost.org), version 1.36 or later
75- [Bison](http://www.gnu.org/software/bison/), version 3.2 or later (only if you get the source through Git)
76- [Flex](http://flex.sourceforge.net/), version 2.5.4 or later (only if you get the source through Git)
77- [Autoconf](http://www.gnu.org/software/autoconf/), version 2.62 or later (only if you get the source through Git)
78- [Automake](http://www.gnu.org/software/automake/), version 1.11.2 or later (only if you get the source through Git)
79- An implementation of BLAS and LAPACK: either [ATLAS](http://math-atlas.sourceforge.net/), [OpenBLAS](http://xianyi.github.com/OpenBLAS/), Netlib ([BLAS](http://www.netlib.org/blas/), [LAPACK](http://www.netlib.org/lapack/)) or [MKL](http://software.intel.com/en-us/intel-mkl/) (only if you want to build Dynare++)
80- [MAT File I/O library](http://sourceforge.net/projects/matio/), version 1.5 or later (if you want to compile Markov-Switching code, the estimation DLL, k-order DLL and Dynare++)
81- [SLICOT](http://www.slicot.org) (if you want to compile the Kalman steady state DLL)
82- [GSL library](http://www.gnu.org/software/gsl/) (if you want to compile Markov-Switching code)
83- A decent LaTeX distribution (if you want to compile PDF documentation),
84  ideally with Beamer
85- For building the reference manual:
86  - [Sphinx](http://www.sphinx-doc.org/)
87  - [MathJax](https://www.mathjax.org/)
88- [Doxygen](http://www.stack.nl/%7Edimitri/doxygen/) (if you want to build Dynare preprocessor source documentation)
89- For Octave, the development libraries corresponding to the UMFPACK packaged with Octave
90
91### Preparing the sources
92
93If you have downloaded the sources from an official source archive or the source snapshot, just unpack it.
94
95If you want to use Git, do the following from a terminal:
96
97    git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
98    cd dynare
99    autoreconf -si
100
101The last line runs Autoconf and Automake in order to prepare the build environment (this is not necessary if you got the sources from an official source archive or the source snapshot).
102
103### Configuring the build tree
104
105Simply launch the configure script from a terminal:
106```
107./configure
108```
109If you have MATLAB, you need to indicate both the MATLAB location and version. For example, on GNU/Linux:
110```
111./configure --with-matlab=/usr/local/MATLAB/R2019a MATLAB_VERSION=9.6
112```
113Note that the MATLAB version can also be specified via the MATLAB family product release (R2019a, R2018b, …).
114
115Alternatively, you can disable the compilation of MEX files for MATLAB with the `--disable-matlab` flag, and MEX files for Octave with `--disable-octave`.
116
117You may need to specify additional options to the configure script, see the
118output of the `--help` option, and also the platform specific instructions
119below.
120
121Note that if you don't want to compile the C/C++ programs with debugging information, you can specify the `CFLAGS` and `CXXFLAGS` variables to the configure script, such as:
122```
123./configure CFLAGS="-O3" CXXFLAGS="-O3"
124```
125To remove debugging information for MATLAB MEX functions, the analogous call would be:
126```
127./configure MATLAB_MEX_CFLAGS="-O3" MATLAB_MEX_CXXFLAGS="-O3"
128```
129
130If the configuration goes well, the script will tell you which components are
131correctly configured and will be built.
132
133Note that it is possible that some MEX files cannot be compiled, due to missing
134build dependencies. If you find no way of installing the missing dependencies,
135a workaround can be to give up on compiling these MEX files and rather use
136slower implementations (in the MATLAB/Octave language) that are available under
137the `matlab/missing/mex/` subdirectories. For example, if you fail to compile
138the gensylv MEX, you can type the following at the MATLAB/Octave prompt before
139running Dynare:
140```matlab
141addpath <DYNARE_ROOT>/matlab/missing/mex/gensylv
142```
143(where you need to replace `<DYNARE_ROOT>` with the full path to your Dynare copy).
144
145### Building
146
147Binaries and Info documentation are built with:
148```
149make
150```
151PDF and HTML documentation are respectively built with:
152```
153make pdf
154make html
155```
156The testsuites can be run with:
157```
158make check
159```
160
161Note that running the testsuite with Octave requires the additional packages
162`pstoedit`, `epstool`, `xfig`, and `gnuplot`.
163
164### Check
165
166The Git source comes with unit tests (in the MATLAB functions) and integration tests (under the `tests` subfolder). All the tests can be run with:
167```
168make check
169```
170In the `tests` subfolder. If Dynare has been compiled against MATLAB and Octave, the tests will be run with MATLAB and Octave. Depending on
171the performance of your machine, this can take several hours. It is possible to run the tests only with MATLAB:
172```
173make check-matlab
174```
175or only with Octave:
176```
177make check-octave
178```
179A summary of the results is available in `tests/run_test_matlab_output.txt` or `tests/run_test_octave_output.txt`. Often, it does not make sense
180to run the complete testsuite. For instance, if you modify codes only related to the perfect foresight model solver, you can decide to run only a
181subset of the integration tests, with:
182```
183make deterministic_simulations
184```
185This will run all the integration tests in `tests/deterministic_simulations` with MATLAB and Octave. Again, it is possible to do this only with MATLAB:
186```
187make m/deterministic_simulations
188```
189or with Octave:
190```
191make o/deterministic_simulations
192```
193Finally if you want to run a single integration test, e.g. `deterministic_simulations/lbj/rbc.mod` with MATLAB:
194```
195make deterministic_simulations/lbj/rbc.m.trs
196```
197or with Octave:
198```
199make deterministic_simulations/lbj/rbc.o.trs
200```
201The result of the test (`PASSED` or `FAILED`) will be printed in the terminal, the produced log can be displayed with:
202```
203make deterministic_simulations/lbj/rbc.m.drs
204```
205or
206```
207make deterministic_simulations/lbj/rbc.o.drs
208```
209Note that only tests will be executed where the `m.trs/o.trs` does not yet exist. You can run
210```
211make clean
212```
213in the `tests` folder to delete files that were created by the run of the testsuite. You can also manually delete the desired `m.trs/o.trs` file(s).
214
215## Debian or Ubuntu
216
217All the prerequisites are packaged:
218
219- `build-essential` (for gcc, g++ and make)
220- `gfortran`
221- `liboctave-dev`
222- `libboost-graph-dev`
223- `libgsl-dev`
224- `libmatio-dev`
225- `libslicot-dev` and `libslicot-pic`
226- `libsuitesparse-dev`
227- `flex`
228- `bison`
229- `autoconf`
230- `automake`
231- `texlive`
232- `texlive-publishers` (for Econometrica bibliographic style)
233- `texlive-latex-extra` (for fullpage.sty)
234- `texlive-fonts-extra` (for ccicons)
235- `texlive-latex-recommended`
236- `texlive-science` (for amstex)
237- `texlive-plain-generic`
238- `lmodern` (for macroprocessor PDF)
239- `python3-sphinx`
240- `latexmk`
241- `libjs-mathjax`
242- `doxygen`
243
244You can install them all at once with:
245```
246apt install build-essential gfortran liboctave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex bison autoconf automake texlive texlive-publishers texlive-latex-extra texlive-fonts-extra texlive-latex-recommended texlive-science texlive-plain-generic lmodern python3-sphinx latexmk libjs-mathjax doxygen
247```
248
249## Windows
250
251- Install [MSYS2](http://www.msys2.org) (pick the 64-bit version, unless you
252  have a 32-bit Windows, in which case see below)
253- Run a MSYS MinGW 64-bit shell
254- Update the system:
255```
256pacman -Syu
257```
258  You may be asked to close the window at the end of the
259  first upgrade batch, in which case you should rerun the upgrade in a new
260  window to complete the upgrade.
261- Install all needed dependencies:
262```
263pacman -S git autoconf automake-wrapper bison flex make tar texinfo mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-boost mingw-w64-x86_64-gsl mingw-w64-x86_64-matio mingw-w64-x86_64-openblas
264```
265- Compile and install SLICOT, needed for the `kalman_steady_state` MEX file
266```
267wget https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
268tar xf slicot_5.0+20101122.orig.tar.gz
269cd slicot-5.0+20101122
270make FORTRAN=gfortran OPTS="-O2 -fno-underscoring -fdefault-integer-8" LOADER=gfortran lib
271mkdir -p /usr/local/lib
272cp slicot.a /usr/local/lib/libslicot64_pic.a
273cd ..
274```
275- Prepare the Dynare sources, either by unpacking the source tarball, or with:
276```
277git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
278cd dynare
279autoreconf -si
280```
281- Configure Dynare from the source directory:
282```
283./configure --with-slicot=/usr/local --with-matlab=<…> MATLAB_VERSION=<…> --disable-octave --disable-doc
284```
285where the path and version of MATLAB are specified. Note that you should use
286the MSYS2 notation and not put spaces in the MATLAB path, so you probably want
287to use something like `/c/Progra~1/MATLAB/…`. Alternatively, if your filesystem
288does not have short filenames (8dot3), then you can run `mkdir -p
289/usr/local/MATLAB && mount c:/Program\ Files/MATLAB /usr/local/MATLAB`, and
290then pass `/usr/local/MATLAB/…` as MATLAB path to the configure script.
291- Compile:
292```
293make
294```
295- Run the testsuite:
296```
297make -C tests check-matlab
298```
299
300**Note:** The above assumes that you have a 64-bit version of MATLAB. It can be
301adapted to a 32-bit MATLAB with the following modifications:
302
303- run the MSYS MinGW 32-bit shell
304- replace `x86_64` by `i686` in packages names on the `pacman` command-line
305- for SLICOT, remove the `-fdefault-integer-8` option, and instead copy the
306  library into `/usr/local/lib/libslicot_pic.a`
307
308**Note:** Compiling the MEX files for Octave and the documentation under MSYS2 is
309currently not supported.
310
311## macOS
312
313To simply use a snapshot of Dynare, you have two choices. On MATLAB, you can
314use the [snapshot build](https://www.dynare.org/snapshot/macos/) provided by
315Dynare. On Octave, you can simply install [Homebrew](https://brew.sh/) and run
316```brew install dynare --HEAD``` (See the Install Dynare (unstable) section of
317[this webpage](https://archives.dynare.org/DynareWiki/InstallOnMacOSX) for more
318details).
319
320If you do not wish to use the snapshots provided by Dynare or Homebrew, follow
321the directions below to build Dynare on your local machine.
322
323Preparatory work:
324
325- Install the Xcode Command Line Tools:
326    - Open Terminal.app and type `xcode-select --install`
327- Install [Homebrew](https://brew.sh/) by following the instructions on their website
328
329The following commands will install the programs that Dynare needs to
330compile. They should be entered at the command prompt in Terminal.app.
331
332- `brew install automake bison flex boost fftw gcc gsl hdf5 libmatio metis veclibfort`
333- **(Optional)** To compile Dynare mex files for use on Octave:
334    - `brew install octave`
335- **(Optional)** To compile Dynare documentation
336     - Install the latest version of [MacTeX](http://www.tug.org/mactex/), deselecting the option to install Ghostscript
337     - `brew install doxygen latex2html`
338
339The following commands will download the Dynare source code and compile
340it. They should be entered at the command prompt in Terminal.app from the
341folder where you want Dynare installed.
342
343- `git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git`
344- `cd dynare`
345- `PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH"`
346- `autoreconf -si`
347- `CC=gcc-9 CXX=g++-9 ./configure --disable-octave --with-matlab=/Applications/MATLAB_R2019a.app MATLAB_VERSION=R2019a --with-matio=/usr/local --with-gsl=/usr/local --with-slicot=/usr/local`, adjusting the MATLAB path and version to accord with your local installation. If you don't have MATLAB, simply remove `--with-matlab=/Applications/MATLAB_R2019a.app MATLAB_VERSION=R2019a` from the above command
348- `make -j`
349- **(Optional)** To then build mex files for Octave, run
350     - `cd mex/build/octave`
351     - `CC=gcc-9 CXX=g++-9 ./configure --with-matio=/usr/local --with-gsl=/usr/local --with-slicot=/usr/local LDFLAGS=-L/usr/local/lib LEX=/usr/local/opt/flex/bin/flex YACC=/usr/local/opt/bison/bin/bison`
352     - `make -j`
353