Commit fb8a26f8 authored by Houtan Bastani's avatar Houtan Bastani

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