Commit 1c946011 authored by Kilian Lackhove's avatar Kilian Lackhove
Browse files

add comments

parent adc0af82
...@@ -408,6 +408,7 @@ std::string FieldIO::SetUpOutput(const std::string outname, bool perRank, bool b ...@@ -408,6 +408,7 @@ std::string FieldIO::SetUpOutput(const std::string outname, bool perRank, bool b
// serial. // serial.
fs::path specPath(outname), fulloutname; fs::path specPath(outname), fulloutname;
// in case we are rank 0 or not on a shared filesystem, check if the specPath already exists
if (backup && (rank == 0 || !m_sharedFilesystem) && fs::exists(specPath)) if (backup && (rank == 0 || !m_sharedFilesystem) && fs::exists(specPath))
{ {
// rename. foo/bar_123.chk -> foo/bar_123_bak0.chk and in case // rename. foo/bar_123.chk -> foo/bar_123_bak0.chk and in case
...@@ -424,6 +425,7 @@ std::string FieldIO::SetUpOutput(const std::string outname, bool perRank, bool b ...@@ -424,6 +425,7 @@ std::string FieldIO::SetUpOutput(const std::string outname, bool perRank, bool b
std::cout << "renaming " << specPath << " -> " << bakPath << std::endl; std::cout << "renaming " << specPath << " -> " << bakPath << std::endl;
fs::rename(specPath, bakPath); fs::rename(specPath, bakPath);
} }
// wait until rank 0 has backed up the old specPath
if (backup) if (backup)
{ {
m_comm->Block(); m_comm->Block();
......
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