Commit d703f09d authored by mattijs's avatar mattijs
Browse files

BUG: fileOperation: avoid par syn in uncollated. Fixes #846.

parent 9d5cb575
......@@ -2396,7 +2396,10 @@ int main(int argc, char *argv[])
instantList timeDirs;
if (Pstream::master())
{
const bool oldParRun = Pstream::parRun();
Pstream::parRun() = false;
timeDirs = Time::findTimes(args.path(), "constant");
Pstream::parRun() = oldParRun;
}
Pstream::scatter(timeDirs);
for (const instant& t : timeDirs)
......@@ -2432,7 +2435,10 @@ int main(int argc, char *argv[])
if (Pstream::master())
{
const bool oldParRun = Pstream::parRun();
Pstream::parRun() = false;
timeDirs = Time::findTimes(basePath, "constant");
Pstream::parRun() = oldParRun;
}
Pstream::scatter(timeDirs);
for (const instant& t : timeDirs)
......
......@@ -238,7 +238,11 @@ bool Foam::fileOperation::isFileOrDir(const bool isFile, const fileName& f)
Foam::tmpNrc<Foam::fileOperation::dirIndexList>
Foam::fileOperation::lookupProcessorsPath(const fileName& fName) const
Foam::fileOperation::lookupAndCacheProcessorsPath
(
const fileName& fName,
const bool syncPar
) const
{
// If path is local to a processor (e.g. contains 'processor2')
// find the corresponding actual processor directory (e.g. 'processors4')
......@@ -344,7 +348,11 @@ Foam::fileOperation::lookupProcessorsPath(const fileName& fName) const
}
}
if (returnReduce(procDirs.size(), sumOp<label>()))
if
(
(syncPar && returnReduce(procDirs.size(), sumOp<label>()))
|| (!syncPar && procDirs.size())
)
{
procsDirs_.insert(procPath, procDirs);
......@@ -362,6 +370,14 @@ Foam::fileOperation::lookupProcessorsPath(const fileName& fName) const
}
Foam::tmpNrc<Foam::fileOperation::dirIndexList>
Foam::fileOperation::lookupProcessorsPath(const fileName& fName) const
{
// Use parallel synchronisation
return lookupAndCacheProcessorsPath(fName, true);
}
bool Foam::fileOperation::exists(IOobject& io) const
{
// Generate output filename for object
......
......@@ -131,12 +131,20 @@ protected:
//- Helper: check for file (isFile) or directory (!isFile)
static bool isFileOrDir(const bool isFile, const fileName&);
//- Detect presence of processorsDDD
void cacheProcessorsPath(const fileName& fName) const;
//- Lookup name of processorsDDD using cache. Return empty fileName
// if not found.
tmpNrc<dirIndexList> lookupAndCacheProcessorsPath
(
const fileName&,
const bool syncPar
) const;
//- Lookup name of processorsDDD using cache. Return empty fileName
// if not found
tmpNrc<dirIndexList> lookupProcessorsPath(const fileName&) const;
// if not found. To be called on all processors
virtual tmpNrc<dirIndexList> lookupProcessorsPath
(
const fileName&
) const;
//- Does ioobject exist. Is either a directory (empty name()) or
// a file
......
......@@ -113,7 +113,11 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
{
tmpNrc<dirIndexList> pDirs
(
lookupProcessorsPath(io.objectPath())
fileOperation::lookupAndCacheProcessorsPath
(
io.objectPath(),
false
)
);
forAll(pDirs(), i)
{
......@@ -159,6 +163,17 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
}
Foam::tmpNrc<Foam::fileOperation::dirIndexList>
Foam::fileOperations::uncollatedFileOperation::lookupProcessorsPath
(
const fileName& fName
) const
{
// Do not use parallel synchronisation
return lookupAndCacheProcessorsPath(fName, false);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileOperations::uncollatedFileOperation::uncollatedFileOperation
......
......@@ -50,7 +50,9 @@ class uncollatedFileOperation
:
public fileOperation
{
// Private Member Functions
protected:
// Protected Member Functions
//- Search for an object.
// checkGlobal : also check undecomposed case
......@@ -63,6 +65,13 @@ class uncollatedFileOperation
const bool search
) const;
//- Lookup name of processorsDDD using cache. Return empty fileName
// if not found. Do not use any parallel synchronisation
virtual tmpNrc<dirIndexList> lookupProcessorsPath
(
const fileName&
) const;
public:
......
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