New parallel_use_psexec command-line option

Ref. dynare!1843
issue#70
Sébastien Villemot 2021-05-06 16:25:46 +02:00
parent 1d188a7444
commit 337b6f469c
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 38 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2010-2020 Dynare Team
* Copyright © 2010-2021 Dynare Team
*
* This file is part of Dynare.
*
@ -98,9 +98,12 @@ Cluster::Cluster(member_nodes_t member_nodes_arg) :
}
ConfigFile::ConfigFile(bool parallel_arg, bool parallel_test_arg,
bool parallel_slave_open_mode_arg, string cluster_name_arg) :
bool parallel_slave_open_mode_arg, bool parallel_use_psexec_arg,
string cluster_name_arg) :
parallel{parallel_arg}, parallel_test{parallel_test_arg},
parallel_slave_open_mode{parallel_slave_open_mode_arg}, cluster_name{move(cluster_name_arg)}
parallel_slave_open_mode{parallel_slave_open_mode_arg},
parallel_use_psexec{parallel_use_psexec_arg},
cluster_name{move(cluster_name_arg)}
{
}
@ -748,8 +751,12 @@ ConfigFile::writeCluster(ostream &output) const
output << "'SingleCompThread', 'false');" << endl;
}
// Default values for the following two are both in DynareMain.cc and matlab/default_option_values.m
if (parallel_slave_open_mode)
output << "options_.parallel_info.leaveSlaveOpen = 1;" << endl;
if (!parallel_use_psexec)
output << "options_.parallel_use_psexec = false;" << endl;
output << "options_.parallel_info.console_mode= isoctave;" << endl;
output << "InitializeComputationalEnvironment();" << endl;

View File

@ -1,5 +1,5 @@
/*
* Copyright © 2010-2020 Dynare Team
* Copyright © 2010-2021 Dynare Team
*
* This file is part of Dynare.
*
@ -91,10 +91,11 @@ protected:
class ConfigFile
{
public:
ConfigFile(bool parallel_arg, bool parallel_test_arg, bool parallel_slave_open_mode_arg, string cluster_name);
ConfigFile(bool parallel_arg, bool parallel_test_arg, bool parallel_slave_open_mode_arg,
bool parallel_use_psexec_arg, string cluster_name);
private:
const bool parallel, parallel_test, parallel_slave_open_mode;
const bool parallel, parallel_test, parallel_slave_open_mode, parallel_use_psexec;
const string cluster_name;
string firstClusterName;
//! Hooks

View File

@ -49,7 +49,7 @@ void
usage()
{
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [onlyclearglobals] [savemacro[=macro_file]] [onlymacro] [linemacro] [notmpterms] [nolog] [warn_uninit]"
<< " [console] [nograph] [nointeractive] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test]"
<< " [console] [nograph] [nointeractive] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test] [parallel_use_psexec=true|false]"
<< " [-D<variable>[=<value>]] [-I/path] [nostrict] [stochastic] [fast] [minimal_workspace] [compute_xrefs] [output=second|third] [language=matlab|julia]"
<< " [params_derivs_order=0|1|2] [transform_unary_ops] [exclude_eqs=<equation_tag_list_or_file>] [include_eqs=<equation_tag_list_or_file>]"
<< " [json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonderivsimple] [nopathchange] [nopreprocessoroutput]"
@ -137,8 +137,9 @@ main(int argc, char **argv)
string parallel_config_file;
bool parallel = false;
string cluster_name;
bool parallel_slave_open_mode = false;
bool parallel_slave_open_mode = false; // Must be the same default as in matlab/default_option_values.m
bool parallel_test = false;
bool parallel_use_psexec = true; // Must be the same default as in matlab/default_option_values.m
bool nostrict = false;
bool stochastic = false;
bool check_model_changes = false;
@ -230,6 +231,26 @@ main(int argc, char **argv)
parallel_slave_open_mode = true;
else if (s == "parallel_test")
parallel_test = true;
else if (s.substr(0, 19) == "parallel_use_psexec")
{
if (s.length() <= 20 || s.at(19) != '=')
{
cerr << "Incorrect syntax for parallel_use_psexec option" << endl;
usage();
}
s.erase(0, 20);
if (s == "true")
parallel_use_psexec = true;
else if (s == "false")
parallel_use_psexec = false;
else
{
cerr << "Incorrect syntax for parallel_use_psexec option" << endl;
usage();
}
}
else if (s == "nostrict")
nostrict = true;
else if (s == "stochastic")
@ -429,7 +450,7 @@ main(int argc, char **argv)
WarningConsolidation warnings(no_warn);
// Process config file
ConfigFile config_file(parallel, parallel_test, parallel_slave_open_mode, cluster_name);
ConfigFile config_file(parallel, parallel_test, parallel_slave_open_mode, parallel_use_psexec, cluster_name);
config_file.getConfigFileInfo(parallel_config_file);
config_file.checkPass(warnings);
config_file.transformPass();