Commit f4814175 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Add new option parallel_local_files to model block

Ref #389
parent 9210ad68
......@@ -1629,6 +1629,10 @@ correct solutions or any convergence. The new differentiated variables
have obvious zero terminal conditions (if the terminal condition is a
steady state) and this in many cases helps convergence of simulations.
@item parallel_local_files = ( @var{FILENAME} [, @var{FILENAME}]@dots{} )
Declares a list of extra files that should be transferred to slave
nodes when doing a parallel computation (@pxref{Parallel Configuration}).
@end table
@customhead{Example 1: elementary RBC model}
......
......@@ -118,7 +118,7 @@ class ParsingDriver;
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED
%token PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERFECT_FORESIGHT PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
%token PARALLEL_LOCAL_FILES PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERFECT_FORESIGHT PERIODS PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
%token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_MODE PRIOR_MEAN POSTERIOR_MODE POSTERIOR_MEAN POSTERIOR_MEDIAN PRUNING
%token <string_val> QUOTED_STRING
%token QZ_CRITERIUM FULL DSGE_VAR DSGE_VARLAG DSGE_PRIOR_WEIGHT TRUNCATE
......@@ -571,6 +571,7 @@ model_options : BLOCK { driver.block(); }
| DIFFERENTIATE_FORWARD_VARS { driver.differentiate_forward_vars_all(); }
| DIFFERENTIATE_FORWARD_VARS EQUAL '(' symbol_list ')' { driver.differentiate_forward_vars_some(); }
| o_linear
| PARALLEL_LOCAL_FILES EQUAL '(' parallel_local_filename_list ')'
;
model_options_list : model_options_list COMMA model_options
......@@ -1678,6 +1679,12 @@ filename : symbol
| QUOTED_STRING
;
parallel_local_filename_list : filename
{ driver.add_parallel_local_file($1); }
| parallel_local_filename_list COMMA filename
{ driver.add_parallel_local_file($3); }
;
mc_filename_list : filename
{ driver.add_mc_filename($1); }
| filename '(' non_negative_number ')'
......
......@@ -570,6 +570,7 @@ string eofbuff;
<DYNARE_BLOCK>all_values_required {return token::ALL_VALUES_REQUIRED;}
<DYNARE_BLOCK>no_static {return token::NO_STATIC;}
<DYNARE_BLOCK>differentiate_forward_vars {return token::DIFFERENTIATE_FORWARD_VARS;}
<DYNARE_BLOCK>parallel_local_files {return token::PARALLEL_LOCAL_FILES;}
<DYNARE_STATEMENT,DYNARE_BLOCK>linear {return token::LINEAR;}
......
......@@ -531,6 +531,21 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
<< "options_.bytecode=" << byte_code << ";" << endl
<< "options_.use_dll=" << use_dll << ";" << endl;
if (parallel_local_files.size() > 0)
{
mOutputFile << "options_.parallel_info.local_files = {" << endl;
for (size_t i = 0; i < parallel_local_files.size(); i++)
{
size_t j = parallel_local_files[i].find_last_of("/\\");
if (j == string::npos)
mOutputFile << "'', '" << parallel_local_files[i] << "';" << endl;
else
mOutputFile << "'" << parallel_local_files[i].substr(0, j+1) << "', '"
<< parallel_local_files[i].substr(j+1, string::npos) << "';" << endl;
}
mOutputFile << "};" << endl;
}
config_file.writeCluster(mOutputFile);
if (byte_code)
......
......@@ -94,6 +94,10 @@ public:
//! Stores the original number of equations in the model_block
int ramsey_policy_orig_eqn_nbr;
//! Stores the list of extra files to be transefered during a parallel run
/*! (i.e. option parallel_local_files of model block) */
vector<string> parallel_local_files;
private:
//! List of statements
vector<Statement *> statements;
......
......@@ -2541,3 +2541,11 @@ ParsingDriver::model_diagnostics()
{
mod_file->addStatement(new ModelDiagnosticsStatement());
}
void
ParsingDriver::add_parallel_local_file(string *filename)
{
mod_file->parallel_local_files.push_back(*filename);
delete filename;
}
......@@ -117,7 +117,7 @@ private:
OptionsList options_list;
//! Temporary storage for trend elements
ObservationTrendsStatement::trend_elements_t trend_elements;
//! Temporary storage for filename list of ModelComparison
//! Temporary storage for filename list of ModelComparison (contains weights)
ModelComparisonStatement::filename_list_t filename_list;
//! Temporary storage for list of EstimationParams (from estimated_params* statements)
vector<EstimationParams> estim_params_list;
......@@ -648,6 +648,8 @@ public:
void process_graph_format_option();
//! Model diagnostics
void model_diagnostics();
//! Processing the parallel_local_files option
void add_parallel_local_file(string *filename);
};
#endif // ! PARSING_DRIVER_HH
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment