dragonfly: support ProgramConfig config file option

parent f022f666
Pipeline #3177 passed with stages
in 8 minutes and 58 seconds
...@@ -56,8 +56,8 @@ Path::Path(vector<string> includepath_arg) ...@@ -56,8 +56,8 @@ Path::Path(vector<string> includepath_arg)
SlaveNode::SlaveNode(string computerName_arg, string port_arg, int minCpuNbr_arg, int maxCpuNbr_arg, string userName_arg, SlaveNode::SlaveNode(string computerName_arg, string port_arg, int minCpuNbr_arg, int maxCpuNbr_arg, string userName_arg,
string password_arg, string remoteDrive_arg, string remoteDirectory_arg, string password_arg, string remoteDrive_arg, string remoteDirectory_arg,
string programPath_arg, string matlabOctavePath_arg, bool singleCompThread_arg, int numberOfThreadsPerJob_arg, string programPath_arg, string programConfig_arg, string matlabOctavePath_arg, bool singleCompThread_arg,
string operatingSystem_arg) : int numberOfThreadsPerJob_arg, string operatingSystem_arg) :
computerName{move(computerName_arg)}, computerName{move(computerName_arg)},
port{move(port_arg)}, port{move(port_arg)},
minCpuNbr{minCpuNbr_arg}, minCpuNbr{minCpuNbr_arg},
...@@ -67,6 +67,7 @@ SlaveNode::SlaveNode(string computerName_arg, string port_arg, int minCpuNbr_arg ...@@ -67,6 +67,7 @@ SlaveNode::SlaveNode(string computerName_arg, string port_arg, int minCpuNbr_arg
remoteDrive{move(remoteDrive_arg)}, remoteDrive{move(remoteDrive_arg)},
remoteDirectory{move(remoteDirectory_arg)}, remoteDirectory{move(remoteDirectory_arg)},
programPath{move(programPath_arg)}, programPath{move(programPath_arg)},
programConfig{move(programConfig_arg)},
matlabOctavePath{move(matlabOctavePath_arg)}, matlabOctavePath{move(matlabOctavePath_arg)},
singleCompThread{singleCompThread_arg}, singleCompThread{singleCompThread_arg},
numberOfThreadsPerJob{numberOfThreadsPerJob_arg}, numberOfThreadsPerJob{numberOfThreadsPerJob_arg},
...@@ -168,8 +169,8 @@ ConfigFile::getConfigFileInfo(const string &config_file) ...@@ -168,8 +169,8 @@ ConfigFile::getConfigFileInfo(const string &config_file)
} }
string name, computerName, port, userName, password, remoteDrive, string name, computerName, port, userName, password, remoteDrive,
remoteDirectory, programPath, matlabOctavePath, operatingSystem, remoteDirectory, programPath, programConfig, matlabOctavePath,
global_init_file; operatingSystem, global_init_file;
vector<string> includepath; vector<string> includepath;
int minCpuNbr{0}, maxCpuNbr{0}; int minCpuNbr{0}, maxCpuNbr{0};
int numberOfThreadsPerJob{1}; int numberOfThreadsPerJob{1};
...@@ -202,8 +203,8 @@ ConfigFile::getConfigFileInfo(const string &config_file) ...@@ -202,8 +203,8 @@ ConfigFile::getConfigFileInfo(const string &config_file)
addParallelConfFileElement(inNode, inCluster, member_nodes, name, addParallelConfFileElement(inNode, inCluster, member_nodes, name,
computerName, port, minCpuNbr, maxCpuNbr, userName, computerName, port, minCpuNbr, maxCpuNbr, userName,
password, remoteDrive, remoteDirectory, password, remoteDrive, remoteDirectory,
programPath, matlabOctavePath, singleCompThread, numberOfThreadsPerJob, programPath, programConfig, matlabOctavePath, singleCompThread,
operatingSystem); numberOfThreadsPerJob, operatingSystem);
//! Reset communication vars / option defaults //! Reset communication vars / option defaults
if (!line.compare("[hooks]")) if (!line.compare("[hooks]"))
...@@ -236,7 +237,7 @@ ConfigFile::getConfigFileInfo(const string &config_file) ...@@ -236,7 +237,7 @@ ConfigFile::getConfigFileInfo(const string &config_file)
} }
name = userName = computerName = port = password = remoteDrive name = userName = computerName = port = password = remoteDrive
= remoteDirectory = programPath = matlabOctavePath = remoteDirectory = programPath = programConfig = matlabOctavePath
= operatingSystem = global_init_file = ""; = operatingSystem = global_init_file = "";
includepath.clear(); includepath.clear();
minCpuNbr = maxCpuNbr = 0; minCpuNbr = maxCpuNbr = 0;
...@@ -356,6 +357,8 @@ ConfigFile::getConfigFileInfo(const string &config_file) ...@@ -356,6 +357,8 @@ ConfigFile::getConfigFileInfo(const string &config_file)
else if (!tokenizedLine.front().compare("DynarePath") else if (!tokenizedLine.front().compare("DynarePath")
|| !tokenizedLine.front().compare("ProgramPath")) || !tokenizedLine.front().compare("ProgramPath"))
programPath = tokenizedLine.back(); programPath = tokenizedLine.back();
else if (!tokenizedLine.front().compare("ProgramConfig"))
programConfig = tokenizedLine.back();
else if (!tokenizedLine.front().compare("MatlabOctavePath")) else if (!tokenizedLine.front().compare("MatlabOctavePath"))
matlabOctavePath = tokenizedLine.back(); matlabOctavePath = tokenizedLine.back();
else if (!tokenizedLine.front().compare("NumberOfThreadsPerJob")) else if (!tokenizedLine.front().compare("NumberOfThreadsPerJob"))
...@@ -446,8 +449,8 @@ ConfigFile::getConfigFileInfo(const string &config_file) ...@@ -446,8 +449,8 @@ ConfigFile::getConfigFileInfo(const string &config_file)
addParallelConfFileElement(inNode, inCluster, member_nodes, name, addParallelConfFileElement(inNode, inCluster, member_nodes, name,
computerName, port, minCpuNbr, maxCpuNbr, userName, computerName, port, minCpuNbr, maxCpuNbr, userName,
password, remoteDrive, remoteDirectory, password, remoteDrive, remoteDirectory,
programPath, matlabOctavePath, singleCompThread, numberOfThreadsPerJob, programPath, programConfig, matlabOctavePath, singleCompThread,
operatingSystem); numberOfThreadsPerJob, operatingSystem);
configFile.close(); configFile.close();
} }
...@@ -478,9 +481,10 @@ ConfigFile::addPathsConfFileElement(vector<string> includepath) ...@@ -478,9 +481,10 @@ ConfigFile::addPathsConfFileElement(vector<string> includepath)
void void
ConfigFile::addParallelConfFileElement(bool inNode, bool inCluster, const member_nodes_t &member_nodes, const string &name, ConfigFile::addParallelConfFileElement(bool inNode, bool inCluster, const member_nodes_t &member_nodes, const string &name,
const string &computerName, const string &port, int minCpuNbr, int maxCpuNbr, const string &userName, const string &computerName, const string &port, int minCpuNbr, int maxCpuNbr,
const string &password, const string &remoteDrive, const string &remoteDirectory, const string &userName, const string &password, const string &remoteDrive,
const string &programPath, const string &matlabOctavePath, bool singleCompThread, int numberOfThreadsPerJob, const string &remoteDirectory, const string &programPath, const string &programConfig,
const string &matlabOctavePath, bool singleCompThread, int numberOfThreadsPerJob,
const string &operatingSystem) const string &operatingSystem)
{ {
//! ADD NODE //! ADD NODE
...@@ -498,14 +502,15 @@ ConfigFile::addParallelConfFileElement(bool inNode, bool inCluster, const member ...@@ -498,14 +502,15 @@ ConfigFile::addParallelConfFileElement(bool inNode, bool inCluster, const member
} }
else else
slave_nodes.emplace(name, SlaveNode{computerName, port, minCpuNbr, maxCpuNbr, userName, slave_nodes.emplace(name, SlaveNode{computerName, port, minCpuNbr, maxCpuNbr, userName,
password, remoteDrive, remoteDirectory, programPath, password, remoteDrive, remoteDirectory, programPath, programConfig,
matlabOctavePath, singleCompThread, numberOfThreadsPerJob, matlabOctavePath, singleCompThread, numberOfThreadsPerJob,
operatingSystem}); operatingSystem});
//! ADD CLUSTER //! ADD CLUSTER
else if (inCluster) else if (inCluster)
if (minCpuNbr > 0 || maxCpuNbr > 0 || !userName.empty() if (minCpuNbr > 0 || maxCpuNbr > 0 || !userName.empty()
|| !password.empty() || !remoteDrive.empty() || !remoteDirectory.empty() || !password.empty() || !remoteDrive.empty() || !remoteDirectory.empty()
|| !programPath.empty() || !matlabOctavePath.empty() || !operatingSystem.empty()) || !programPath.empty() || !programConfig.empty()
|| !matlabOctavePath.empty() || !operatingSystem.empty())
{ {
cerr << "Invalid option passed to [cluster]." << endl; cerr << "Invalid option passed to [cluster]." << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -730,6 +735,7 @@ ConfigFile::writeCluster(ostream &output) const ...@@ -730,6 +735,7 @@ ConfigFile::writeCluster(ostream &output) const
<< "'RemoteDrive', '" << slave_node.second.remoteDrive << "', " << "'RemoteDrive', '" << slave_node.second.remoteDrive << "', "
<< "'RemoteDirectory', '" << slave_node.second.remoteDirectory << "', " << "'RemoteDirectory', '" << slave_node.second.remoteDirectory << "', "
<< "'ProgramPath', '" << slave_node.second.programPath << "', " << "'ProgramPath', '" << slave_node.second.programPath << "', "
<< "'ProgramConfig', '" << slave_node.second.programConfig << "', "
<< "'MatlabOctavePath', '" << slave_node.second.matlabOctavePath << "', " << "'MatlabOctavePath', '" << slave_node.second.matlabOctavePath << "', "
<< "'OperatingSystem', '" << slave_node.second.operatingSystem << "', " << "'OperatingSystem', '" << slave_node.second.operatingSystem << "', "
<< "'NodeWeight', '" << (cluster_it->second.member_nodes.find(slave_node.first))->second << "', " << "'NodeWeight', '" << (cluster_it->second.member_nodes.find(slave_node.first))->second << "', "
......
...@@ -63,15 +63,15 @@ class SlaveNode ...@@ -63,15 +63,15 @@ class SlaveNode
public: public:
SlaveNode(string computerName_arg, string port_arg, int minCpuNbr_arg, int maxCpuNbr_arg, string userName_arg, SlaveNode(string computerName_arg, string port_arg, int minCpuNbr_arg, int maxCpuNbr_arg, string userName_arg,
string password_arg, string remoteDrive_arg, string remoteDirectory_arg, string password_arg, string remoteDrive_arg, string remoteDirectory_arg,
string programPath_arg, string matlabOctavePath_arg, bool singleCompThread_arg, int numberOfThreadsPerJob_arg, string programPath_arg, string programConfig_arg, string matlabOctavePath_arg, bool singleCompThread_arg,
string operatingSystem_arg); int numberOfThreadsPerJob_arg, string operatingSystem_arg);
protected: protected:
const string computerName, port; const string computerName, port;
int minCpuNbr, maxCpuNbr; int minCpuNbr, maxCpuNbr;
const string userName, password; const string userName, password;
const string remoteDrive, remoteDirectory; const string remoteDrive, remoteDirectory;
const string programPath, matlabOctavePath; const string programPath, programConfig, matlabOctavePath;
const bool singleCompThread; const bool singleCompThread;
const int numberOfThreadsPerJob; const int numberOfThreadsPerJob;
const string operatingSystem; const string operatingSystem;
...@@ -111,9 +111,10 @@ private: ...@@ -111,9 +111,10 @@ private:
void addPathsConfFileElement(vector<string> includepath); void addPathsConfFileElement(vector<string> includepath);
//! Add a SlaveNode or a Cluster object //! Add a SlaveNode or a Cluster object
void addParallelConfFileElement(bool inNode, bool inCluster, const member_nodes_t &member_nodes, const string &name, void addParallelConfFileElement(bool inNode, bool inCluster, const member_nodes_t &member_nodes, const string &name,
const string &computerName, const string &port, int minCpuNbr, int maxCpuNbr, const string &userName, const string &computerName, const string &port, int minCpuNbr, int maxCpuNbr,
const string &password, const string &remoteDrive, const string &remoteDirectory, const string &userName, const string &password, const string &remoteDrive,
const string &programPath, const string &matlabOctavePath, bool singleCompThread, int numberOfThreadsPerJob, const string &remoteDirectory, const string &programPath, const string &programConfig,
const string &matlabOctavePath, bool singleCompThread, int numberOfThreadsPerJob,
const string &operatingSystem); const string &operatingSystem);
public: public:
//! Parse config file //! Parse config file
......
Markdown is supported
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