Commit ef25fb76 authored by Wang, Ruonan's avatar Wang, Ruonan
Browse files

added engine parameters necessary for mpi handshake

parent c68378fe
......@@ -303,6 +303,43 @@ void PrintMpiInfo(const MpiInfo &writersInfo, const MpiInfo &readersInfo)
std::cout << std::endl;
}
bool GetParameter(const Params &params, const std::string &key, int &value)
{
auto it = params.find(key);
if (it == params.end())
{
return false;
}
else
{
try
{
value = std::stoi(it->second);
}
catch (...)
{
std::string error = "Engine parameter " + key + " can only be integer numbers";
std::cerr << error << std::endl;
return false;
}
}
return true;
}
bool GetParameter(const Params &params, const std::string &key, std::string &value)
{
auto it = params.find(key);
if (it == params.end())
{
return false;
}
else
{
value = it->second;
}
return true;
}
} // end namespace ssc
} // end namespace engine
} // end namespace core
......
......@@ -66,6 +66,9 @@ void JsonToBlockVecVec(const std::string &input, BlockVecVec &output);
bool AreSameDims(const Dims &a, const Dims &b);
bool GetParameter(const Params &params, const std::string &key, int &value);
bool GetParameter(const Params &params, const std::string &key, std::string &value);
} // end namespace ssc
} // end namespace engine
} // end namespace core
......
......@@ -32,24 +32,11 @@ SscReader::SscReader(IO &io, const std::string &name, const Mode mode,
m_ReaderRank = m_Comm.Rank();
m_ReaderSize = m_Comm.Size();
auto it = m_IO.m_Parameters.find("MpiMode");
if (it != m_IO.m_Parameters.end())
{
m_MpiMode = it->second;
}
it = m_IO.m_Parameters.find("Verbose");
if (it != m_IO.m_Parameters.end())
{
try
{
m_Verbosity = std::stoi(it->second);
}
catch (...)
{
std::cerr << "Engine parameter Verbose can only be integer numbers"
<< std::endl;
}
}
ssc::GetParameter(m_IO.m_Parameters, "MpiMode", m_MpiMode);
ssc::GetParameter(m_IO.m_Parameters, "Verbose", m_Verbosity);
ssc::GetParameter(m_IO.m_Parameters, "MaxStreamsPerApp", m_MaxStreamsPerApp);
ssc::GetParameter(m_IO.m_Parameters, "MaxFilenameLength", m_MaxFilenameLength);
ssc::GetParameter(m_IO.m_Parameters, "RendezvousAppCount", m_RendezvousAppCount);
m_Buffer.resize(1);
......@@ -200,7 +187,7 @@ void SscReader::SyncMpiPattern()
<< ", Reader Rank " << m_ReaderRank << std::endl;
}
m_MpiHandshake.Start(4, 128, 2, 'r', m_Name, CommAsMPI(m_Comm) );
m_MpiHandshake.Start(m_MaxStreamsPerApp, m_MaxFilenameLength, m_RendezvousAppCount, 'r', m_Name, CommAsMPI(m_Comm) );
m_MpiHandshake.Wait(m_Name);
m_MpiHandshake.PrintMaps();
......
......@@ -106,6 +106,9 @@ private:
ssc::RankPosMap &allOverlapRanks);
int m_Verbosity = 0;
int m_MaxStreamsPerApp = 4;
int m_MaxFilenameLength = 128;
int m_RendezvousAppCount = 2;
};
} // end namespace engine
......
......@@ -32,24 +32,11 @@ SscWriter::SscWriter(IO &io, const std::string &name, const Mode mode,
m_WriterRank = m_Comm.Rank();
m_WriterSize = m_Comm.Size();
auto it = m_IO.m_Parameters.find("MpiMode");
if (it != m_IO.m_Parameters.end())
{
m_MpiMode = it->second;
}
it = m_IO.m_Parameters.find("Verbose");
if (it != m_IO.m_Parameters.end())
{
try
{
m_Verbosity = std::stoi(it->second);
}
catch (...)
{
std::cerr << "Engine parameter Verbose can only be integer numbers"
<< std::endl;
}
}
ssc::GetParameter(m_IO.m_Parameters, "MpiMode", m_MpiMode);
ssc::GetParameter(m_IO.m_Parameters, "Verbose", m_Verbosity);
ssc::GetParameter(m_IO.m_Parameters, "MaxStreamsPerApp", m_MaxStreamsPerApp);
ssc::GetParameter(m_IO.m_Parameters, "MaxFilenameLength", m_MaxFilenameLength);
ssc::GetParameter(m_IO.m_Parameters, "RendezvousAppCount", m_RendezvousAppCount);
m_GlobalWritePattern.resize(m_WorldSize);
m_GlobalReadPattern.resize(m_WorldSize);
......@@ -192,7 +179,7 @@ void SscWriter::SyncMpiPattern()
{
TAU_SCOPED_TIMER_FUNC();
m_MpiHandshake.Start(4, 128, 2, 'w', m_Name, CommAsMPI(m_Comm) );
m_MpiHandshake.Start(m_MaxStreamsPerApp, m_MaxFilenameLength, m_RendezvousAppCount, 'w', m_Name, CommAsMPI(m_Comm) );
m_MpiHandshake.Wait(m_Name);
m_MpiHandshake.PrintMaps();
......
......@@ -96,6 +96,9 @@ private:
ssc::RankPosMap &allOverlapRanks);
int m_Verbosity = 0;
int m_MaxStreamsPerApp = 4;
int m_MaxFilenameLength = 128;
int m_RendezvousAppCount = 2;
};
} // end namespace engine
......
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