Commit 00d887f9 authored by sebastien's avatar sebastien

Various cleanups related to new options "bytecode" and "block"


git-svn-id: https://www.dynare.org/svn/dynare/trunk@2879 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 0b986771
...@@ -27,8 +27,8 @@ using namespace std; ...@@ -27,8 +27,8 @@ using namespace std;
#include "ComputingTasks.hh" #include "ComputingTasks.hh"
#include "Statement.hh" #include "Statement.hh"
SteadyStatement::SteadyStatement(const OptionsList &options_list_arg, StaticDllModel::mode_t mode_arg) : SteadyStatement::SteadyStatement(const OptionsList &options_list_arg) :
options_list(options_list_arg), mode(mode_arg) options_list(options_list_arg)
{ {
} }
...@@ -41,9 +41,6 @@ void ...@@ -41,9 +41,6 @@ void
SteadyStatement::writeOutput(ostream &output, const string &basename) const SteadyStatement::writeOutput(ostream &output, const string &basename) const
{ {
options_list.writeOutput(output); options_list.writeOutput(output);
/*if (mode == StaticDllModel::eSparseDLLMode)
output << "oo_.steady_state=simulate('steady');" << endl;
else*/
output << "steady;\n"; output << "steady;\n";
} }
...@@ -82,8 +79,8 @@ void ModelInfoStatement::writeOutput(ostream &output, const string &basename) co ...@@ -82,8 +79,8 @@ void ModelInfoStatement::writeOutput(ostream &output, const string &basename) co
} }
SimulStatement::SimulStatement(const OptionsList &options_list_arg, DynamicModel::mode_t mode_arg, bool block_arg, bool byte_code_arg) : SimulStatement::SimulStatement(const OptionsList &options_list_arg, bool block_arg, bool byte_code_arg) :
options_list(options_list_arg), mode(mode_arg), byte_code(byte_code_arg), block(block_arg) options_list(options_list_arg), byte_code(byte_code_arg), block(block_arg)
{ {
} }
...@@ -97,7 +94,7 @@ void ...@@ -97,7 +94,7 @@ void
SimulStatement::writeOutput(ostream &output, const string &basename) const SimulStatement::writeOutput(ostream &output, const string &basename) const
{ {
options_list.writeOutput(output); options_list.writeOutput(output);
if ((mode == DynamicModel::eStandardMode || mode == DynamicModel::eDLLMode) && !block) if (!block)
output << "simul(oo_.dr);\n"; output << "simul(oo_.dr);\n";
else else
{ {
...@@ -119,10 +116,10 @@ SimulStatement::writeOutput(ostream &output, const string &basename) const ...@@ -119,10 +116,10 @@ SimulStatement::writeOutput(ostream &output, const string &basename) const
StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg, StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg, const OptionsList &options_list_arg,
DynamicModel::mode_t mode_arg) : bool block_arg) :
symbol_list(symbol_list_arg), symbol_list(symbol_list_arg),
options_list(options_list_arg), options_list(options_list_arg),
mode(mode_arg) block(block_arg)
{ {
} }
...@@ -150,7 +147,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const ...@@ -150,7 +147,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const
{ {
options_list.writeOutput(output); options_list.writeOutput(output);
symbol_list.writeOutput("var_list_", output); symbol_list.writeOutput("var_list_", output);
if (mode == DynamicModel::eStandardMode || mode == DynamicModel::eDLLMode) if (!block)
output << "info = stoch_simul(var_list_);" << endl; output << "info = stoch_simul(var_list_);" << endl;
else else
output << "info = stoch_simul_sparse(var_list_);" << endl; output << "info = stoch_simul_sparse(var_list_);" << endl;
......
...@@ -32,9 +32,8 @@ class SteadyStatement : public Statement ...@@ -32,9 +32,8 @@ class SteadyStatement : public Statement
{ {
private: private:
const OptionsList options_list; const OptionsList options_list;
const StaticDllModel::mode_t mode;
public: public:
SteadyStatement(const OptionsList &options_list_arg, StaticDllModel::mode_t mode_arg); SteadyStatement(const OptionsList &options_list_arg);
virtual void checkPass(ModFileStructure &mod_file_struct); virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const; virtual void writeOutput(ostream &output, const string &basename) const;
}; };
...@@ -53,11 +52,10 @@ class SimulStatement : public Statement ...@@ -53,11 +52,10 @@ class SimulStatement : public Statement
{ {
private: private:
const OptionsList options_list; const OptionsList options_list;
const DynamicModel::mode_t mode;
const bool byte_code; const bool byte_code;
const bool block; const bool block;
public: public:
SimulStatement(const OptionsList &options_list_arg, DynamicModel::mode_t mode_arg, bool block_arg, bool byte_code_arg); SimulStatement(const OptionsList &options_list_arg, bool block_arg, bool byte_code_arg);
virtual void checkPass(ModFileStructure &mod_file_struct); virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const; virtual void writeOutput(ostream &output, const string &basename) const;
}; };
...@@ -77,11 +75,11 @@ class StochSimulStatement : public Statement ...@@ -77,11 +75,11 @@ class StochSimulStatement : public Statement
private: private:
const SymbolList symbol_list; const SymbolList symbol_list;
const OptionsList options_list; const OptionsList options_list;
const DynamicModel::mode_t mode; bool block;
public: public:
StochSimulStatement(const SymbolList &symbol_list_arg, StochSimulStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg, const OptionsList &options_list_arg,
DynamicModel::mode_t mode_arg); bool block_arg);
virtual void checkPass(ModFileStructure &mod_file_struct); virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const; virtual void writeOutput(ostream &output, const string &basename) const;
}; };
......
...@@ -42,7 +42,6 @@ DynamicModel::DynamicModel(SymbolTable &symbol_table_arg, ...@@ -42,7 +42,6 @@ DynamicModel::DynamicModel(SymbolTable &symbol_table_arg,
max_exo_lag(0), max_exo_lead(0), max_exo_lag(0), max_exo_lead(0),
max_exo_det_lag(0), max_exo_det_lead(0), max_exo_det_lag(0), max_exo_det_lead(0),
dynJacobianColsNbr(0), dynJacobianColsNbr(0),
mode(eStandardMode),
cutoff(1e-15), cutoff(1e-15),
markowitz(0.7), markowitz(0.7),
mfs(0), mfs(0),
...@@ -1131,7 +1130,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const ...@@ -1131,7 +1130,7 @@ DynamicModel::writeDynamicMFile(const string &dynamic_basename) const
<< "% Warning : this file is generated automatically by Dynare" << endl << "% Warning : this file is generated automatically by Dynare" << endl
<< "% from model file (.mod)" << endl << endl; << "% from model file (.mod)" << endl << endl;
writeDynamicModel(mDynamicModelFile); writeDynamicModel(mDynamicModelFile, false);
mDynamicModelFile.close(); mDynamicModelFile.close();
} }
...@@ -1159,7 +1158,7 @@ DynamicModel::writeDynamicCFile(const string &dynamic_basename) const ...@@ -1159,7 +1158,7 @@ DynamicModel::writeDynamicCFile(const string &dynamic_basename) const
<< "#include \"mex.h\"" << endl; << "#include \"mex.h\"" << endl;
// Writing the function body // Writing the function body
writeDynamicModel(mDynamicModelFile); writeDynamicModel(mDynamicModelFile, true);
// Writing the gateway routine // Writing the gateway routine
mDynamicModelFile << "/* The gateway routine */" << endl mDynamicModelFile << "/* The gateway routine */" << endl
...@@ -1325,7 +1324,7 @@ DynamicModel::Write_Inf_To_Bin_File(const string &dynamic_basename, const string ...@@ -1325,7 +1324,7 @@ DynamicModel::Write_Inf_To_Bin_File(const string &dynamic_basename, const string
} }
void void
DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const string &basename, const int mode) const DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const string &basename) const
{ {
string sp; string sp;
ofstream mDynamicModelFile; ofstream mDynamicModelFile;
...@@ -1681,14 +1680,14 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri ...@@ -1681,14 +1680,14 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
} }
void void
DynamicModel::writeDynamicModel(ostream &DynamicOutput) const DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const
{ {
ostringstream model_output; // Used for storing model equations ostringstream model_output; // Used for storing model equations
ostringstream jacobian_output; // Used for storing jacobian equations ostringstream jacobian_output; // Used for storing jacobian equations
ostringstream hessian_output; // Used for storing Hessian equations ostringstream hessian_output; // Used for storing Hessian equations
ostringstream third_derivatives_output; ostringstream third_derivatives_output;
ExprNodeOutputType output_type = (mode != eDLLMode ? oMatlabDynamicModel : oCDynamicModel); ExprNodeOutputType output_type = (use_dll ? oCDynamicModel : oMatlabDynamicModel);
writeModelLocalVariables(model_output, output_type); writeModelLocalVariables(model_output, output_type);
...@@ -1810,7 +1809,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput) const ...@@ -1810,7 +1809,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput) const
k += k2; k += k2;
} }
if (mode == eStandardMode) if (!use_dll)
{ {
DynamicOutput << "%" << endl DynamicOutput << "%" << endl
<< "% Model equations" << endl << "% Model equations" << endl
...@@ -1890,22 +1889,8 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput) const ...@@ -1890,22 +1889,8 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput) const
} }
void void
DynamicModel::writeOutput(ostream &output, const string &basename, bool block) const DynamicModel::writeOutput(ostream &output, const string &basename, bool block, bool byte_code, bool use_dll) const
{ {
output << "options_.model_mode = " << mode << ";" << endl;
// Erase possible remnants of previous runs
if (mode != eStandardMode || block)
output << "delete('" << basename << "_dynamic.m');" << endl;
if (mode != eDLLMode)
output << "erase_compiled_function('" + basename + "_dynamic');" << endl;
// Special setup for DLL or Sparse modes
if (mode == eDLLMode)
output << "mex -O LDFLAGS='-pthread -shared -Wl,--no-undefined' " << basename << "_dynamic.c" << endl;
if (block)
output << "addpath " << basename << ";" << endl;
/* Writing initialisation for M_.lead_lag_incidence matrix /* Writing initialisation for M_.lead_lag_incidence matrix
M_.lead_lag_incidence is a matrix with as many columns as there are M_.lead_lag_incidence is a matrix with as many columns as there are
endogenous variables and as many rows as there are periods in the endogenous variables and as many rows as there are periods in the
...@@ -1937,8 +1922,8 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block) c ...@@ -1937,8 +1922,8 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block) c
output << ";"; output << ";";
} }
output << "]';" << endl; output << "]';" << endl;
//In case of sparse model, writes the block structure of the model
//In case of sparse model, writes the block structure of the model
if (block) if (block)
{ {
//int prev_Simulation_Type=-1; //int prev_Simulation_Type=-1;
...@@ -2137,13 +2122,6 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block) c ...@@ -2137,13 +2122,6 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block) c
<< "M_.NNZDerivatives(3) = " << NNZDerivatives[2] << ";" << endl; << "M_.NNZDerivatives(3) = " << NNZDerivatives[2] << ";" << endl;
} }
void
DynamicModel::writeOutputPostComputing(ostream &output, const string &basename, bool block) const
{
if (block)
output << "rmpath " << basename << ";" << endl;
}
void void
DynamicModel::evaluateJacobian(const eval_context_type &eval_context, jacob_map *j_m, bool dynamic) DynamicModel::evaluateJacobian(const eval_context_type &eval_context, jacob_map *j_m, bool dynamic)
{ {
...@@ -2301,7 +2279,7 @@ DynamicModel::collect_first_order_derivatives_endogenous() ...@@ -2301,7 +2279,7 @@ DynamicModel::collect_first_order_derivatives_endogenous()
void void
DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivatives, bool paramsDerivatives, DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivatives, bool paramsDerivatives,
const eval_context_type &eval_context, bool no_tmp_terms, bool block) const eval_context_type &eval_context, bool no_tmp_terms, bool block, bool use_dll)
{ {
assert(jacobianExo || !(hessian || thirdDerivatives || paramsDerivatives)); assert(jacobianExo || !(hessian || thirdDerivatives || paramsDerivatives));
...@@ -2372,11 +2350,11 @@ DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivative ...@@ -2372,11 +2350,11 @@ DynamicModel::computingPass(bool jacobianExo, bool hessian, bool thirdDerivative
} }
else else
if (!no_tmp_terms) if (!no_tmp_terms)
computeTemporaryTerms(mode == eStandardMode); computeTemporaryTerms(!use_dll);
} }
void void
DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode) const DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode, bool use_dll) const
{ {
int r; int r;
if(block && bytecode) if(block && bytecode)
...@@ -2408,57 +2386,15 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode ...@@ -2408,57 +2386,15 @@ DynamicModel::writeDynamicFile(const string &basename, bool block, bool bytecode
perror("ERROR"); perror("ERROR");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
writeSparseDynamicMFile(basename + "_dynamic", basename, mode); writeSparseDynamicMFile(basename + "_dynamic", basename);
block_triangular.Free_Block(block_triangular.ModelBlock); block_triangular.Free_Block(block_triangular.ModelBlock);
block_triangular.incidencematrix.Free_IM(); block_triangular.incidencematrix.Free_IM();
//block_triangular.Free_IM_X(block_triangular.First_IM_X); //block_triangular.Free_IM_X(block_triangular.First_IM_X);
} }
else if (mode == eDLLMode) else if (use_dll)
writeDynamicCFile(basename + "_dynamic"); writeDynamicCFile(basename + "_dynamic");
else if (mode == eStandardMode) else
writeDynamicMFile(basename + "_dynamic"); writeDynamicMFile(basename + "_dynamic");
/*switch (mode)
{
case eStandardMode:
writeDynamicMFile(basename + "_dynamic");
break;
case eSparseMode:
#ifdef _WIN32
r = mkdir(basename.c_str());
#else
r = mkdir(basename.c_str(), 0777);
#endif
if (r < 0 && errno != EEXIST)
{
perror("ERROR");
exit(EXIT_FAILURE);
}
writeSparseDynamicMFile(basename + "_dynamic", basename, mode);
block_triangular.Free_Block(block_triangular.ModelBlock);
block_triangular.incidencematrix.Free_IM();
//block_triangular.Free_IM_X(block_triangular.First_IM_X);
break;
case eDLLMode:
writeDynamicCFile(basename + "_dynamic");
break;
case eSparseDLLMode:
// create a directory to store all the files
#ifdef _WIN32
r = mkdir(basename.c_str());
#else
r = mkdir(basename.c_str(), 0777);
#endif
if (r < 0 && errno != EEXIST)
{
perror("ERROR");
exit(EXIT_FAILURE);
}
writeModelEquationsCodeOrdered(basename + "_dynamic", block_triangular.ModelBlock, basename, map_idx);
block_triangular.Free_Block(block_triangular.ModelBlock);
block_triangular.incidencematrix.Free_IM();
//block_triangular.Free_IM_X(block_triangular.First_IM_X);
break;
}*/
} }
void void
......
...@@ -32,14 +32,6 @@ using namespace std; ...@@ -32,14 +32,6 @@ using namespace std;
class DynamicModel : public ModelTree class DynamicModel : public ModelTree
{ {
public: public:
//! The modes in which DynamicModel can work
enum mode_t
{
eStandardMode, //!< Standard mode (dynamic file in Matlab)
//eSparseMode, //!< Sparse mode (dynamic file in Matlab with block decomposition)
eDLLMode //!< DLL mode (dynamic file in C)
//eSparseDLLMode //!< Sparse DLL mode (dynamic file in C with block decomposition plus a binary file)
};
private: private:
typedef map<pair<int, int>, int> deriv_id_table_t; typedef map<pair<int, int>, int> deriv_id_table_t;
//! Maps a pair (symbol_id, lag) to a deriv ID //! Maps a pair (symbol_id, lag) to a deriv ID
...@@ -88,10 +80,10 @@ private: ...@@ -88,10 +80,10 @@ private:
/*! \todo add third derivatives handling */ /*! \todo add third derivatives handling */
void writeDynamicCFile(const string &dynamic_basename) const; void writeDynamicCFile(const string &dynamic_basename) const;
//! Writes dynamic model file when SparseDLL option is on //! Writes dynamic model file when SparseDLL option is on
void writeSparseDynamicMFile(const string &dynamic_basename, const string &basename, const int mode) const; void writeSparseDynamicMFile(const string &dynamic_basename, const string &basename) const;
//! Writes the dynamic model equations and its derivatives //! Writes the dynamic model equations and its derivatives
/*! \todo add third derivatives handling in C output */ /*! \todo add third derivatives handling in C output */
void writeDynamicModel(ostream &DynamicOutput) const; void writeDynamicModel(ostream &DynamicOutput, bool use_dll) const;
//! Writes the Block reordred structure of the model in M output //! Writes the Block reordred structure of the model in M output
void writeModelEquationsOrdered_M(Model_Block *ModelBlock, const string &dynamic_basename) const; void writeModelEquationsOrdered_M(Model_Block *ModelBlock, const string &dynamic_basename) const;
//! Writes the code of the Block reordred structure of the model in virtual machine bytecode //! Writes the code of the Block reordred structure of the model in virtual machine bytecode
...@@ -146,8 +138,6 @@ private: ...@@ -146,8 +138,6 @@ private:
public: public:
DynamicModel(SymbolTable &symbol_table_arg, NumericalConstants &num_constants); DynamicModel(SymbolTable &symbol_table_arg, NumericalConstants &num_constants);
//! Mode in which the ModelTree is supposed to work (Matlab, DLL or SparseDLL)
mode_t mode;
//! Adds a variable node //! Adds a variable node
/*! This implementation allows for non-zero lag */ /*! This implementation allows for non-zero lag */
virtual NodeID AddVariable(const string &name, int lag = 0); virtual NodeID AddVariable(const string &name, int lag = 0);
...@@ -174,18 +164,17 @@ public: ...@@ -174,18 +164,17 @@ public:
\param no_tmp_terms if true, no temporary terms will be computed in the dynamic files \param no_tmp_terms if true, no temporary terms will be computed in the dynamic files
*/ */
void computingPass(bool jacobianExo, bool hessian, bool thirdDerivatives, bool paramsDerivatives, void computingPass(bool jacobianExo, bool hessian, bool thirdDerivatives, bool paramsDerivatives,
const eval_context_type &eval_context, bool no_tmp_terms, bool block); const eval_context_type &eval_context, bool no_tmp_terms, bool block, bool use_dll);
//! Writes model initialization and lead/lag incidence matrix to output //! Writes model initialization and lead/lag incidence matrix to output
void writeOutput(ostream &output, const string &basename, bool block) const; void writeOutput(ostream &output, const string &basename, bool block, bool byte_code, bool use_dll) const;
//! Write statements to be added to the main M-file, after computational tasks
void writeOutputPostComputing(ostream &output, const string &basename, bool block) const;
//! Complete set to block decompose the model //! Complete set to block decompose the model
BlockTriangular block_triangular; BlockTriangular block_triangular;
//! Adds informations for simulation in a binary file //! Adds informations for simulation in a binary file
void Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename, void Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename,
const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const; const int &num, int &u_count_int, bool &file_open, bool is_two_boundaries) const;
//! Writes dynamic model file //! Writes dynamic model file
void writeDynamicFile(const string &basename, bool block, bool bytecode) const; void writeDynamicFile(const string &basename, bool block, bool bytecode, bool use_dll) const;
//! Writes file containing parameters derivatives //! Writes file containing parameters derivatives
void writeParamsDerivativesFile(const string &basename) const; void writeParamsDerivativesFile(const string &basename) const;
//! Converts to static model (only the equations) //! Converts to static model (only the equations)
......
...@@ -446,19 +446,12 @@ histval_list : histval_list histval_elem ...@@ -446,19 +446,12 @@ histval_list : histval_list histval_elem
histval_elem : symbol '(' signed_integer ')' EQUAL expression ';' { driver.hist_val($1, $3, $6); }; histval_elem : symbol '(' signed_integer ')' EQUAL expression ';' { driver.hist_val($1, $3, $6); };
/*model_block_options_list : model_block_options_list COMMA model_block_options model_options : BLOCK { driver.block(); }
| model_block_options | o_cutoff
;
model_block_options : o_cutoff
| o_mfs
;
*/
model_options : BLOCK {driver.block(); }
| o_cutoff
| o_mfs | o_mfs
| BYTECODE {driver.byte_code();} | BYTECODE { driver.byte_code(); }
| USE_DLL { driver.use_dll(); }
| o_linear
; ;
model_options_list : model_options_list COMMA model_options model_options_list : model_options_list COMMA model_options
...@@ -467,10 +460,6 @@ model_options_list : model_options_list COMMA model_options ...@@ -467,10 +460,6 @@ model_options_list : model_options_list COMMA model_options
model : MODEL ';' { driver.begin_model(); } model : MODEL ';' { driver.begin_model(); }
equation_list END { driver.reset_data_tree(); } equation_list END { driver.reset_data_tree(); }
| MODEL '(' o_linear ')' ';' { 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 '(' model_options_list ')' ';' { driver.begin_model(); } | MODEL '(' model_options_list ')' ';' { driver.begin_model(); }
equation_list END { driver.reset_data_tree(); } equation_list END { driver.reset_data_tree(); }
; ;
......
...@@ -27,10 +27,9 @@ ModFile::ModFile() : expressions_tree(symbol_table, num_constants), ...@@ -27,10 +27,9 @@ ModFile::ModFile() : expressions_tree(symbol_table, num_constants),
static_model(symbol_table, num_constants), static_model(symbol_table, num_constants),
static_dll_model(symbol_table, num_constants), static_dll_model(symbol_table, num_constants),
dynamic_model(symbol_table, num_constants), dynamic_model(symbol_table, num_constants),
linear(false) linear(false), block(false), byte_code(false),
use_dll(false)
{ {
block = false;
byte_code = false;
} }
ModFile::~ModFile() ModFile::~ModFile()
...@@ -119,6 +118,18 @@ ModFile::checkPass() ...@@ -119,6 +118,18 @@ ModFile::checkPass()
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (use_dll && (block || byte_code))
{
cerr << "ERROR: In 'model' block, 'use_dll' option is not compatible with 'block' or 'bytecode'" << endl;
exit(EXIT_FAILURE);
}
if (byte_code && !block)
{
cerr << "ERROR: In 'model' block, can't use option 'bytecode' without option 'block'" << endl;
exit(EXIT_FAILURE);
}
// Freeze the symbol table // Freeze the symbol table
symbol_table.freeze(); symbol_table.freeze();
...@@ -159,7 +170,7 @@ ModFile::computingPass(bool no_tmp_terms) ...@@ -159,7 +170,7 @@ ModFile::computingPass(bool no_tmp_terms)
// Set things to compute for dynamic model // Set things to compute for dynamic model
if (mod_file_struct.simul_present) if (mod_file_struct.simul_present)
dynamic_model.computingPass(false, false, false, false, global_eval_context, no_tmp_terms, block); dynamic_model.computingPass(false, false, false, false, global_eval_context, no_tmp_terms, block, use_dll);
else else
{ {
if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3) if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3)
...@@ -170,7 +181,7 @@ ModFile::computingPass(bool no_tmp_terms) ...@@ -170,7 +181,7 @@ ModFile::computingPass(bool no_tmp_terms)
bool hessian = mod_file_struct.order_option >= 2; bool hessian = mod_file_struct.order_option >= 2;
bool thirdDerivatives = mod_file_struct.order_option == 3; bool thirdDerivatives = mod_file_struct.order_option == 3;
bool paramsDerivatives = mod_file_struct.identification_present; bool paramsDerivatives = mod_file_struct.identification_present;
dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, false); dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, false, use_dll);
} }
} }
...@@ -235,15 +246,31 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const ...@@ -235,15 +246,31 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
if (linear == 1) if (linear == 1)
mOutputFile << "options_.linear = 1;" << endl; mOutputFile << "options_.linear = 1;" << endl;
mOutputFile << "options_.block=" << block << ";" << endl
<< "options_.bytecode=" << byte_code << ";" << endl;
// Erase possible remnants of previous runs
if (block || byte_code)
mOutputFile << "delete('" << basename << "_dynamic.m');" << endl;
if (byte_code)
mOutputFile << "delete('" << basename << "_static.m');" << endl;