mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: fileOperation: avoid par syn in uncollated. Fixes #846.
This commit is contained in:
@ -2396,7 +2396,10 @@ int main(int argc, char *argv[])
|
|||||||
instantList timeDirs;
|
instantList timeDirs;
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
const bool oldParRun = Pstream::parRun();
|
||||||
|
Pstream::parRun() = false;
|
||||||
timeDirs = Time::findTimes(args.path(), "constant");
|
timeDirs = Time::findTimes(args.path(), "constant");
|
||||||
|
Pstream::parRun() = oldParRun;
|
||||||
}
|
}
|
||||||
Pstream::scatter(timeDirs);
|
Pstream::scatter(timeDirs);
|
||||||
for (const instant& t : timeDirs)
|
for (const instant& t : timeDirs)
|
||||||
@ -2432,7 +2435,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
const bool oldParRun = Pstream::parRun();
|
||||||
|
Pstream::parRun() = false;
|
||||||
timeDirs = Time::findTimes(basePath, "constant");
|
timeDirs = Time::findTimes(basePath, "constant");
|
||||||
|
Pstream::parRun() = oldParRun;
|
||||||
}
|
}
|
||||||
Pstream::scatter(timeDirs);
|
Pstream::scatter(timeDirs);
|
||||||
for (const instant& t : 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::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')
|
// If path is local to a processor (e.g. contains 'processor2')
|
||||||
// find the corresponding actual processor directory (e.g. 'processors4')
|
// 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);
|
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
|
bool Foam::fileOperation::exists(IOobject& io) const
|
||||||
{
|
{
|
||||||
// Generate output filename for object
|
// Generate output filename for object
|
||||||
|
|||||||
@ -131,12 +131,20 @@ protected:
|
|||||||
//- Helper: check for file (isFile) or directory (!isFile)
|
//- Helper: check for file (isFile) or directory (!isFile)
|
||||||
static bool isFileOrDir(const bool isFile, const fileName&);
|
static bool isFileOrDir(const bool isFile, const fileName&);
|
||||||
|
|
||||||
//- Detect presence of processorsDDD
|
//- Lookup name of processorsDDD using cache. Return empty fileName
|
||||||
void cacheProcessorsPath(const fileName& fName) const;
|
// if not found.
|
||||||
|
tmpNrc<dirIndexList> lookupAndCacheProcessorsPath
|
||||||
|
(
|
||||||
|
const fileName&,
|
||||||
|
const bool syncPar
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Lookup name of processorsDDD using cache. Return empty fileName
|
//- Lookup name of processorsDDD using cache. Return empty fileName
|
||||||
// if not found
|
// if not found. To be called on all processors
|
||||||
tmpNrc<dirIndexList> lookupProcessorsPath(const fileName&) const;
|
virtual tmpNrc<dirIndexList> lookupProcessorsPath
|
||||||
|
(
|
||||||
|
const fileName&
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Does ioobject exist. Is either a directory (empty name()) or
|
//- Does ioobject exist. Is either a directory (empty name()) or
|
||||||
// a file
|
// a file
|
||||||
|
|||||||
@ -113,7 +113,11 @@ Foam::fileName Foam::fileOperations::uncollatedFileOperation::filePathInfo
|
|||||||
{
|
{
|
||||||
tmpNrc<dirIndexList> pDirs
|
tmpNrc<dirIndexList> pDirs
|
||||||
(
|
(
|
||||||
lookupProcessorsPath(io.objectPath())
|
fileOperation::lookupAndCacheProcessorsPath
|
||||||
|
(
|
||||||
|
io.objectPath(),
|
||||||
|
false
|
||||||
|
)
|
||||||
);
|
);
|
||||||
forAll(pDirs(), i)
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fileOperations::uncollatedFileOperation::uncollatedFileOperation
|
Foam::fileOperations::uncollatedFileOperation::uncollatedFileOperation
|
||||||
|
|||||||
@ -50,7 +50,9 @@ class uncollatedFileOperation
|
|||||||
:
|
:
|
||||||
public fileOperation
|
public fileOperation
|
||||||
{
|
{
|
||||||
// Private Member Functions
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Search for an object.
|
//- Search for an object.
|
||||||
// checkGlobal : also check undecomposed case
|
// checkGlobal : also check undecomposed case
|
||||||
@ -63,6 +65,13 @@ class uncollatedFileOperation
|
|||||||
const bool search
|
const bool search
|
||||||
) const;
|
) 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:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user