Commit 9a2e4cc6 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

config file: support GlobalInitFile option

parent bd9aeef1
......@@ -216,6 +216,7 @@ Typical usages
The Configuration File
* Dynare Configuration::
* Parallel Configuration::
@end detailmenu
......@@ -6944,9 +6945,43 @@ Is @code{true} or @code{false}.
@end table
@menu
* Dynare Configuration::
* Parallel Configuration::
@end menu
@node Dynare Configuration
@section Dynare Configuration
This section explains how to configure Dynare for general
processing. Currently, there is only one option available.
@deffn {Configuration block} [hooks]
@descriptionhead
The @code{[hooks]} block can be used to specify configuration options
that will be used when running dynare.
@optionshead
@table @code
@item GlobalInitFile = @var{PATH_AND_FILE}
The location of the global initialization file to be run at the end of
@code{global_initialization.m}
@end table
@examplehead
@example
[hooks]
GlobalInitFile = /home/usern/dynare/myInitFile.m
@end example
@end deffn
@node Parallel Configuration
@section Parallel Configuration
......
......@@ -517,11 +517,7 @@ set_dynare_seed('default');
[junk,junk]=mkdir([M_.fname '/Output']);
% Load user configuration file.
if isunix
origin = pwd;
cd('~/')
if exist('dynare_configuration.m')
dynare_configuration;
end
cd(origin)
end
\ No newline at end of file
if isfield(options_, 'global_init_file')
run(options_.global_init_file);
end
This diff is collapsed.
......@@ -29,6 +29,16 @@ using namespace std;
typedef map<string, double> member_nodes_t;
class Hook
{
public:
Hook(string &global_init_file_arg);
~Hook();
private:
map<string, string> hooks;
public:
inline map<string, string>get_hooks() { return hooks; };
};
class SlaveNode
{
......@@ -79,16 +89,20 @@ private:
const bool parallel_slave_open_mode;
const string cluster_name;
string firstClusterName;
//! Hooks
vector<Hook *> hooks;
//! Cluster Table
map<string, Cluster *> clusters;
//! Node Map
map<string, SlaveNode *> slave_nodes;
//! Add Hooks
void addHooksConfFileElement(string &global_init_file);
//! Add a SlaveNode or a Cluster object
void addConfFileElement(bool inNode, bool inCluster, member_nodes_t member_nodes, string &name,
string &computerName, string port, int minCpuNbr, int maxCpuNbr, string &userName,
string &password, string &remoteDrive, string &remoteDirectory,
string &dynarePath, string &matlabOctavePath, bool singleCompThread,
string &operatingSystem);
void addParallelConfFileElement(bool inNode, bool inCluster, member_nodes_t member_nodes, string &name,
string &computerName, string port, int minCpuNbr, int maxCpuNbr, string &userName,
string &password, string &remoteDrive, string &remoteDirectory,
string &dynarePath, string &matlabOctavePath, bool singleCompThread,
string &operatingSystem);
public:
//! Parse config file
void getConfigFileInfo(const string &parallel_config_file);
......@@ -96,6 +110,8 @@ public:
void checkPass(WarningConsolidation &warnings) const;
//! Check Pass
void transformPass();
//! Write any hooks
void writeHooks(ostream &output) const;
//! Create options_.parallel structure, write options
void writeCluster(ostream &output) const;
//! Close slave nodes if needed
......
......@@ -462,8 +462,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
<< "M_.fname = '" << basename << "';" << endl
<< "%" << endl
<< "% Some global variables initialization" << endl
<< "%" << endl
<< "global_initialization;" << endl
<< "%" << endl;
config_file.writeHooks(mOutputFile);
mOutputFile << "global_initialization;" << endl
<< "diary off;" << endl;
if (!no_log)
mOutputFile << "logname_ = '" << basename << ".log';" << endl
......
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