trunk preprocessor: removed LCC_COMPILER and GCC_COMPILER options of SPARSE_DLL mode

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2177 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2008-10-17 17:21:22 +00:00
parent 58358122da
commit d46c423c6e
8 changed files with 506 additions and 1496 deletions

View File

@ -104,9 +104,8 @@ SimulStatement::writeOutput(ostream &output, const string &basename) const
}
SimulSparseStatement::SimulSparseStatement(const OptionsList &options_list_arg,
int compiler_arg, int mode_arg) :
int mode_arg) :
options_list(options_list_arg),
compiler(compiler_arg),
mode(mode_arg)
{
}
@ -130,24 +129,7 @@ SimulSparseStatement::writeOutput(ostream &output, const string &basename) const
output << " end\n";
output << "end\n";
if(mode==eSparseDLLMode)
{
if(compiler!=NO_COMPILE)
{
output << "disp('compiling...');\n";
output << "t0=clock;\n";
if (compiler == 0)
output << "mex " << basename << "_dynamic.c;\n";
else
output << "mex " << basename << "_dynamic.cc;\n";
output << "disp(['compiling time: ' num2str(etime(clock,t0))]);\n";
output << "oo_.endo_simul=" << basename << "_dynamic;\n";
}
else
{
output << "oo_.endo_simul=simulate;\n";
output << "clear simulate.dll;\n";
}
}
output << "oo_.endo_simul=simulate;\n";
else
{
//output << "oo_.endo_simul=" << basename << "_dynamic();\n";

View File

@ -90,19 +90,19 @@ class ParsingDriver;
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS
%token <string_val> FLOAT_NUMBER
%token FORECAST
%token GAMMA_PDF GAUSSIAN_ELIMINATION GCC_COMPILER GMRES GRAPH
%token GAMMA_PDF GAUSSIAN_ELIMINATION GMRES GRAPH
%token HISTVAL HP_FILTER HP_NGRID
%token INITVAL INITVAL_FILE
%token <string_val> INT_NUMBER
%token INV_GAMMA1_PDF INV_GAMMA2_PDF IRF
%token KALMAN_ALGO KALMAN_TOL
%token LAPLACE LCC_COMPILER LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOGLINEAR LU
%token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOGLINEAR LU
%token MARKOWITZ MARGINAL_DENSITY MAX
%token METHOD MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS
%token MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER
%token <string_val> NAME
%token NO_COMPILER NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
%token NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS
%token PARAMETERS PERIODS PLANNER_OBJECTIVE PREFILTER PRESAMPLE
@ -393,27 +393,11 @@ histval_list : histval_list histval_elem
histval_elem : NAME '(' signed_integer ')' EQUAL expression ';' { driver.hist_val($1, $3, $6); };
model_sparse_dll_options_list : model_sparse_dll_options_list COMMA model_sparse_dll_options
| model_sparse_dll_options
model_sparse_options_list : model_sparse_options_list COMMA model_sparse_options
| model_sparse_options
;
model_sparse_options_list : model_sparse_options_list COMMA model_sparse_common_options
| model_sparse_common_options
;
model_sparse_dll_options : model_compiler_options
| model_sparse_common_options
;
model_compiler_options : LCC_COMPILER
{ driver.init_compiler(0); }
| GCC_COMPILER
{ driver.init_compiler(1); }
| NO_COMPILER
{ driver.init_compiler(2); }
;
model_sparse_common_options : o_cutoff
model_sparse_options : o_cutoff
| o_markowitz
;
@ -423,7 +407,7 @@ model : MODEL ';' { driver.begin_model(); }
equation_list END { driver.reset_data_tree(); }
| MODEL '(' USE_DLL ')' ';' { driver.begin_model(); driver.use_dll(); }
equation_list END { driver.reset_data_tree(); }
| MODEL '(' SPARSE_DLL COMMA model_sparse_dll_options_list ')'
| MODEL '(' SPARSE_DLL COMMA model_sparse_options_list ')'
{ driver.begin_model(); driver.sparse_dll(); } ';'
equation_list END { driver.reset_data_tree(); }
| MODEL '(' SPARSE_DLL ')' { driver.begin_model(); driver.sparse_dll(); } ';'

View File

@ -283,9 +283,6 @@ int sigma_e = 0;
<DYNARE_STATEMENT,DYNARE_BLOCK>bicgstab {return token::BICGSTAB;}
<DYNARE_STATEMENT,DYNARE_BLOCK>sparse {return token::SPARSE;}
<DYNARE_STATEMENT,DYNARE_BLOCK>sparse_dll {return token::SPARSE_DLL;}
<DYNARE_STATEMENT,DYNARE_BLOCK>gcc_compiler {return token::GCC_COMPILER;}
<DYNARE_STATEMENT,DYNARE_BLOCK>lcc_compiler {return token::LCC_COMPILER;}
<DYNARE_STATEMENT,DYNARE_BLOCK>no_compiler {return token::NO_COMPILER;}
<DYNARE_STATEMENT,DYNARE_BLOCK>linear {return token::LINEAR;}
<DYNARE_STATEMENT,DYNARE_BLOCK>[,] {return token::COMMA;}
<DYNARE_STATEMENT,DYNARE_BLOCK>[:] {return Dynare::parser::token_type (yytext[0]);}

File diff suppressed because it is too large Load Diff

View File

@ -24,14 +24,6 @@
#include "ParsingDriver.hh"
#include "Statement.hh"
ParsingDriver::ParsingDriver()
{
}
ParsingDriver::~ParsingDriver()
{
}
bool
ParsingDriver::symbol_exists_and_is_not_modfile_local_variable(const char *s)
{
@ -705,16 +697,10 @@ void ParsingDriver::simulate()
void
ParsingDriver::simul_sparse()
{
mod_file->addStatement(new SimulSparseStatement(options_list, mod_file->model_tree.compiler, mod_file->model_tree.mode));
mod_file->addStatement(new SimulSparseStatement(options_list, mod_file->model_tree.mode));
options_list.clear();
}
void
ParsingDriver::init_compiler(int compiler_type)
{
mod_file->model_tree.compiler = compiler_type;
}
void
ParsingDriver::simul()
{

View File

@ -69,9 +69,9 @@ class SimulSparseStatement : public Statement
{
private:
const OptionsList options_list;
const int compiler, mode;
const int mode;
public:
SimulSparseStatement(const OptionsList &options_list_arg, int compiler_arg, int mode_arg);
SimulSparseStatement(const OptionsList &options_list_arg, int mode_arg);
virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const;
};

View File

@ -33,11 +33,6 @@ using namespace std;
#include "BlockTriangular.hh"
#include "SymbolGaussElim.hh"
#define LCC_COMPILE 0
#define GCC_COMPILE 1
#define NO_COMPILE 2
//#define CONDITION
//! The three in which ModelTree can work
enum ModelTreeMode
{
@ -106,13 +101,11 @@ private:
//! Writes the dynamic model equations and its derivatives
/*! \todo add third derivatives handling in C output */
void writeDynamicModel(ostream &DynamicOutput) const;
//! Writes the Block reordred structure of the model in C output
void writeModelEquationsOrdered_C(ostream &output, Model_Block *ModelBlock) const;
//! Writes the Block reordred structure of the model in M output
void writeModelEquationsOrdered_M(ostream &output, Model_Block *ModelBlock, const string &dynamic_basename) const;
//! Writes the Block reordred structure of the static model in M output
void writeModelStaticEquationsOrdered_M(ostream &output, Model_Block *ModelBlock, const string &static_basename) const;
//! Writes the code of the Block reordred structure of the model in C output
//! Writes the code of the Block reordred structure of the model in virtual machine bytecode
void writeModelEquationsCodeOrdered(const string file_name, const Model_Block *ModelBlock, const string bin_basename, ExprNodeOutputType output_type) const;
//! Writes static model file (Matlab version)
void writeStaticMFile(const string &static_basename) const;
@ -125,10 +118,8 @@ private:
//! Writes dynamic model file (C version)
/*! \todo add third derivatives handling */
void writeDynamicCFile(const string &dynamic_basename) const;
//! Writes dynamic model header file when SparseDLL option is on
void writeSparseDLLDynamicHFile(const string &dynamic_basename) const;
//! Writes dynamic model file when SparseDLL option is on
void writeSparseDynamicFileAndBinFile(const string &dynamic_basename, const string &bin_basename, ExprNodeOutputType output_type, const int mode) const;
void writeSparseDynamicMFile(const string &dynamic_basename, const string &basename, const int mode) const;
//! Computes jacobian and prepares for equation normalization
/*! Using values from initval/endval blocks and parameter initializations:
- computes the jacobian for the model w.r. to contemporaneous variables
@ -145,8 +136,6 @@ public:
ModelTree(SymbolTable &symbol_table_arg, NumericalConstants &num_constants);
//! Mode in which the ModelTree is supposed to work (Matlab, DLL or SparseDLL)
ModelTreeMode mode;
//! Type of compiler used in matlab for SPARSE_DLL option: 0 = LCC or 1 = GCC or 2 = NO
int compiler;
//! Absolute value under which a number is considered to be zero
double cutoff;
//! The weight of the Markowitz criteria to determine the pivot in the linear solver (simul_NG1 from simulate.cc)
@ -181,7 +170,7 @@ public:
//! Adds informations for simulation in a binary file
void Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename,
const int &num, int &u_count_int, bool &file_open) const;
//! Returns the number of equations in the model
int equation_number() const;
};

View File

@ -139,11 +139,6 @@ private:
ModFile *mod_file;
public:
//! Constructor
ParsingDriver();
//! Destructor
virtual ~ParsingDriver();
//! Starts parsing, and constructs the MOD file representation
/*! The returned pointer should be deleted after use */
ModFile *parse(istream &in, bool debug);
@ -172,8 +167,6 @@ public:
void sparse_dll();
//! Sets mode of ModelTree class to block decompose the model and triggers the creation of the incidence matrix in Matlab context
void sparse();
//! Sets the compiler type used in conjunction with SPARCE_DLL
void init_compiler(int compiler_type);
//! Sets the FILENAME for the initial value in initval
void initval_file(string *filename);
//! Declares an endogenous variable