Skip to content
Snippets Groups Projects
Commit a66ea301 authored by wgodoy's avatar wgodoy
Browse files

Implementing profiling.log as default

To do:
Memory buffer reallocation strategy
parent 88fe60b1
No related branches found
No related tags found
1 merge request!129Implementing profiling.log as default
......@@ -86,8 +86,22 @@ void BPFileWriter::Close(const int transportIndex)
const std::string log(m_BP1Writer.GetRankProfilingLog(
transportTypes, transportProfilers));
// TODO profiling.log
// m_BP1Writer.m_BP1Aggregator.WriteProfilingLog( )
// TODO profiling.log from rank0
const std::string profilingLog(
m_BP1Writer.AggregateProfilingLog(log));
if (m_BP1Writer.m_BP1Aggregator.m_RankMPI == 0)
{
transport::FileStream profilingLogStream(m_MPIComm,
m_DebugMode);
auto bpBaseNames = m_BP1Writer.GetBPBaseNames({m_Name});
profilingLogStream.Open(bpBaseNames[0] + "/profiling.log",
OpenMode::Write);
profilingLogStream.Write(profilingLog.c_str(),
profilingLog.size());
profilingLogStream.Close();
}
}
}
}
......@@ -123,6 +137,8 @@ void BPFileWriter::InitBPBuffer()
{
if (m_OpenMode == OpenMode::Append)
{
throw std::invalid_argument(
"ADIOS2: OpenMode Append hasn't been implemented, yet");
// TODO: Get last pg timestep and update timestep counter in
}
else
......
......@@ -83,7 +83,7 @@ std::string BP1Aggregator::GetGlobalProfilingLog(const std::string &rankLog)
profilingLog.reserve(rankLog.size() * m_SizeMPI);
profilingLog += "{\n";
profilingLog += rankLog + "\n";
profilingLog += rankLog + ",\n";
for (unsigned int i = 1; i < sizeMPI; ++i)
{
const std::string rankLogStr(rankLogs[i - 1].data(),
......@@ -124,6 +124,8 @@ std::string BP1Aggregator::GetGlobalProfilingLog(const std::string &rankLog)
1, m_MPIComm, &requestRankLog);
}
MPI_Barrier(m_MPIComm); // Barrier here?
return profilingLog;
}
......
......@@ -157,6 +157,9 @@ void BP1Writer::Close() noexcept
}
FlattenMetadata();
m_Profiler.Bytes.at("buffering") += m_HeapBuffer.m_DataAbsolutePosition;
m_IsClosed = true;
}
......@@ -195,7 +198,6 @@ std::string BP1Writer::GetRankProfilingLog(
for (const auto &transportTimerPair : transportsProfilers[t]->Timers)
{
lf_WriterTimer(rankLog, transportTimerPair.second);
rankLog += ", ";
}
// replace last comma with space
rankLog.pop_back();
......@@ -216,6 +218,12 @@ std::string BP1Writer::GetRankProfilingLog(
return rankLog;
}
std::string
BP1Writer::AggregateProfilingLog(const std::string &rankProfilingLog) noexcept
{
return m_BP1Aggregator.GetGlobalProfilingLog(rankProfilingLog);
}
// PRIVATE FUNCTIONS
void BP1Writer::WriteDimensionsRecord(const Dims localDimensions,
const Dims globalDimensions,
......
......@@ -98,6 +98,9 @@ public:
const std::vector<std::string> &transportsTypes,
const std::vector<profiling::IOChrono *> &transportsProfilers) noexcept;
std::string
AggregateProfilingLog(const std::string &rankProfilingLog) noexcept;
private:
/** BP format version */
const uint8_t m_Version = 3;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment