Skip to content

Commit 3a3deee

Browse files
committed
Retry a few times if directory creation fails
This tries to fix the following error reported by @BenWibking Writing checkpoint chk02500 amrex::UtilCreateDirectory:: path errno: chk02500 :: File exists amrex::UtilCreateDirectory:: path errno: chk02500/Level_2 :: Input/output error amrex::Error::0::Couldn't create directory: chk02500/Level_2 !!!
1 parent bb593a2 commit 3a3deee

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Src/Base/AMReX_Utility.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ bool
116116
amrex::UtilCreateDirectory (const std::string& path,
117117
mode_t mode, bool verbose)
118118
{
119-
return FileSystem::CreateDirectories(path, mode, verbose);
119+
double sleep = 0.1;
120+
while (sleep < 2.0) {
121+
if (FileSystem::CreateDirectories(path, mode, verbose)) { return true; }
122+
amrex::Sleep(sleep);
123+
sleep *= 2;
124+
}
125+
return false;
120126
}
121127

122128
void

0 commit comments

Comments
 (0)