Commit Graph

62 Commits (master)

Author SHA1 Message Date
Sébastien Villemot 328e8eef78
Change default location for configuration file
– under Linux and macOS, use the “dynare” subdirectory of the configuration
  directory specified by the XDG specification
– under Windows, use the “dynare” subdirectory of the Application Data folder

The old location is kept for backward compatibility, with a warning.
2023-12-12 12:28:33 +01:00
Sébastien Villemot 4389e5320d
Rename files, classes and variables in relation to the configuration file
In particular, makes clearer the distinction between configuration and
configuration file. The former includes information that is not in the
latter (command-line options.)
2023-12-11 17:17:57 +01:00
Sébastien Villemot e4b23fecb0
Update comments in relation to implicit conversion from std::filesystem::path to std::string
There is actually no bug in MinGW. The different behaviour under Windows is
expected, because the implicit conversion there is only to std::wstring.
2023-12-08 18:39:27 +01:00
Sébastien Villemot d463607e90
Reformat C++ source code using clang-format 15 2023-11-30 15:58:32 +01:00
Sébastien Villemot bff80c0eaf
use_dll: under Windows, append MinGW location to the PATH variable only once
Previously, the MinGW location was appended multiple times to the PATH
variable, which in some cases would make the variable too long and thus
dysfunctional.

The variable is now initialized once when the worker threads are created.

By the way, move the macOS+Octave environment variable initializations to the
same place, for consistency.
2023-03-20 18:27:33 +01:00
Sébastien Villemot 253fbbe7d6
Use std::filesystem::path in more places 2023-01-05 17:21:28 +01:00
Sébastien Villemot 9f96db89ba
use_dll: ensure proper cleanup of thread workers threads in case of early exit (e.g. upon failure) 2022-10-17 14:03:27 +02:00
Sébastien Villemot 781e10c24b
Error out if “use_dll” is specified in Julia mode 2022-10-14 15:40:09 +02:00
Sébastien Villemot fd9902e87b
use_dll: rewrite the parallel compilation engine with a fixed number of threads
The previous system would spawn as many threads as there are object files to be
compiled (which could lead to hundreds of threads for large block-decomposed
models). This could pose a memory usage problem (even when not just waiting,
threads require memory for their own stack).
2022-10-14 15:33:52 +02:00
Sébastien Villemot 5cf4729ab0
use_dll: dynamically limit the number of concurrently running GCC processes to the number of available logical processors
Ref. #41
2022-10-07 18:04:17 +02:00
Sébastien Villemot f6053df754
use_dll: compile MEX files in parallel
Currently two threads are used (one for the dynamic MEX, one for the static
MEX). When the sparse representation is implemented, four threads will be used.

Closes: #41
2022-10-04 16:00:30 +02:00
Sébastien Villemot 41b1e89756
Macro-processor: when a variable is defined without a value, set it to “true”
Previously it was set to 1.

Also do the same change for variable defined on the command-line, for
consistency.

Closes: #43
2022-06-16 16:50:38 +02:00
Sébastien Villemot 2a68f5a3af
Use “follower” instead of “slave” in internal class and variable names 2022-06-15 15:39:20 +02:00
Sébastien Villemot 248dac4bc7
Rename “parallel_slave_open_mode” option to “parallel_follower_open_mode”
But still accept the old name for backward compatibility.

Closes: #86
2022-06-15 15:35:54 +02:00
Sébastien Villemot b42ee40b55
C++20 modernization: use contains() method on containers 2022-05-04 17:37:57 +02:00
Sébastien Villemot c9c36c037a
New preprocessor option “nocommutativity”
This option tells the preprocessor not to use the commutativity of addition and
multiplication when looking for common subexpressions.

As a consequence, when using this option, equations in various outputs (LaTeX,
JSON…) will appear as the user entered them.

There is however a potential performance cost to using this option, yet to be
determined.

Ref. dynare#1788
2021-07-13 14:35:10 +02:00
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
Sébastien Villemot 337b6f469c
New parallel_use_psexec command-line option
Ref. dynare!1843
2021-05-06 16:25:46 +02:00
Sébastien Villemot 7765efe95b
Windows: fix detection of location of MinGW compiler 2021-04-30 15:03:53 +02:00
Sébastien Villemot 07391e0f9f
Remove unused kludge 2021-02-01 12:07:33 +01:00
Sébastien Villemot 8e03f17350
Cleanup the “output” option
— output Julia files as soon as “language=julia” is passed, independently of
  the value of the “output” option
— drop the “dynamic” and “first” values of the “output” option, since they
  actually do nothing
— obey the “output” option even in the deterministic case

Ref. dynare#1600
2021-01-08 18:51:48 +01:00
Sébastien Villemot cd443a6083
Revert to accepting the “nolog” option, but do nothing about it
This is necessary to avoid an “unknown option” error.

Ref. dynare#1743
2021-01-06 15:50:30 +01:00
Sébastien Villemot 78874a01d3
No longer deal with the log file at the preprocessor level
Ref. dynare#1743
2021-01-06 14:19:33 +01:00
Sébastien Villemot 91db87b1cf
Forbid some basenames, since they will cause trouble
Closes: preprocessor#62
2020-12-16 18:21:55 +01:00
Sébastien Villemot 7e1563fdbb
Allow 'use_dll' option to be specified on the command line
Ref. Enteprise/dynare#4
2020-09-18 15:00:00 +02:00
Stéphane Adjemian (Charybdis) 27a8b3b70e
Added preprocessor option: notime.
Do not print the total computing time at the end of the driver.
2020-04-03 11:00:48 +02:00
Houtan Bastani 2813ef2d18
remove unused header 2020-02-21 19:51:04 +01:00
Houtan Bastani 28b98c7c0e
Rework the function that handles the macro-expansion of the .mod file 2020-02-20 15:30:46 +01:00
Houtan Bastani ac4749edf9
add undocumented `gui` option to preprocessor 2020-02-12 12:32:40 +01:00
Houtan Bastani de6ca5cdcc
Combine `DynareMain.cc` and `DynareMain2.cc` 2020-02-05 16:27:40 +01:00
Houtan Bastani 1dbbd87d3d
Remove options `noemptylinemacro` and `nolinemacro`; add option `linemacro`
This only concerns the situation when `savemacro` is also passed.

When `linemacro` is passed, the macro expanded .mod file is the same as before

When `linemacro` is not passed, the macro expanded .mod file is equivalent to what it was before when both `noemptylinemacro` and `nolinemacro` were passed.

closes #44
closes #45
2020-02-05 15:19:01 +01:00
Sébastien Villemot 0f3f6a2332
Add comments and simplify code in function that parses the --+ options: … +-- line 2020-01-23 18:45:02 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Houtan Bastani 0ff7a9d2ab
introduce command line options: `exclude_eqs` and `include_eqs`
Allows for the inclusion/exclusion of a set of equations, specified either on the command line or in a text file.

If the equation has a single endogenous variable on the LHS, then the equation is moved. If not, if the equation has an `endogenous` tag then that variable is removed along with this equation. If not, then an error is thrown.

As a command line argument, `exclude_eqs` can take the form (same syntax for `include_eqs`):
* `exclude_eqs=eq1 to remove all equations declared as `[name=eq1]`
* `exclude_eqs=[eq 1, eq 2]` to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`
* `exclude_eqs=[tagname=X]` to remove all equations declared as `[tagname=X]`
* `exclude_eqs=[tagname=(X, Y)]` to remove all equations declared as `[tagname=X]` or `[tagname=Y]`

When declared in a file, the file should be of the form:
```
eq 1
eq 2
```
to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`.

It should be of the form:
```
tagname=
X
Y
```
to remove all equations declared as `[tagname=X]` or `[tagname=Y]`.
2019-11-26 14:16:00 +01:00
Stéphane Adjemian (Charybdis) 14b6cb6bee Fixed logic for output language. 2019-10-07 09:28:49 +02:00
Houtan Bastani 2ce6e411b4
remove unused headers 2019-10-04 10:57:36 +02:00
Houtan Bastani 2f6f0d8cf6
use filesystem::path instead of string to hold include paths passed on the command line 2019-10-04 10:57:36 +02:00
Houtan Bastani 031bc62f3a
macro processor: use filesystem after move to C++17, closes #31
ancillary to this change is the move of `paths` out of the Driver class into an argument to parsing/evaluation #32
2019-10-03 14:24:47 +02:00
Sébastien Villemot 0c755460b1
Use std::filesystem instead of boost::filesystem
Note that there is no equivalent of boost::filesystem::unique_path(), so I
implemented ModFile::unique_path() which does something similar.
2019-09-11 14:47:48 +02:00
Sébastien Villemot 8cdbdee315
Various cleanups around the “language” option
— allow “language=matlab” for symmetry (this is the default)
— remove the useless “cuda” and “python” values
— give a more meaningful error message when “output” is used in conjunction
  with “language=matlab”
2019-08-22 17:43:34 +02:00
Sébastien Villemot 82cd95a653
Remove some unnecessary headers 2019-05-02 15:30:33 +02:00
Houtan Bastani 21fe0f4bdc
avoid cast warnings when compiling boost headers 2019-04-23 14:57:03 +02:00
Sébastien Villemot b73d554ad2
Use Unicode copyright symbol (in UTF-8 encoding) 2019-04-16 11:35:31 +02:00
Houtan Bastani c6467af814
Read options at top of .mod file as long as they exist on the first *non empty* line
In other words, allow newlines before these options
2019-04-10 14:49:33 +02:00
Houtan Bastani 2a9c4b234a
maintain order of macro variables defined on command line when writing them to the .mod file
Before this commit, a dynare call such as
```
dynare <<mod file>> -Db=“A” -Da=@{b}
```
would not expand the value of `b` in `a` whereas
```
dynare <<mod file>> -Da=“A” -Db=@{a}
```
would expand the value of `a` into `b` because the arguments were stored in a map which printed the `@#define` statements in the .mod file in alphabetic order.
2019-04-10 12:51:45 +02:00
Sébastien Villemot 8a41a75c85
Apply modernize-raw-string-literal from clang-tidy
Use ReplaceShorterLiterals option to enforce replacement of all strings.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
2019-04-03 16:45:52 +02:00
Houtan Bastani a3e7547857
fix bug when defining variable with value on the command line with -D option (problem introduced in ee5fc6b16b) 2019-01-16 11:51:14 +01:00
Sébastien Villemot e7c9c26d2d
More modernizations with clang-tidy 2019-01-15 11:08:47 +01:00
Sébastien Villemot 01385d1f80
Simplify implementation of nopreprocessoroutput option
Simply redirect cout to /dev/null, instead of propagating a boolean
everywhere.
2018-12-20 17:08:45 +01:00
Sébastien Villemot 5784dce1ca
Remove the possibility of passing the mod-file as a string in the first shell argument
This feature is ill-designed and no longer needed by the GUI. And is not very
useful: it is not possible to interact with the preprocessor without using the
filesystem, since the preprocessor creates many files anyways.

If we really need to reimplement such a feature, it should rather be redesigned
by reading the modfile from standard input (cin). That could be triggered by
using "-" as the filename argument (as is already done by several standard Unix
utilities).
2018-12-20 17:08:05 +01:00