Parallel IO: New collated file format
When an OpenFOAM simulation runs in parallel, the data for decomposed fields and
mesh(es) has historically been stored in multiple files within separate
directories for each processor. Processor directories are named 'processorN',
where N is the processor number.
This commit introduces an alternative "collated" file format where the data for
each decomposed field (and mesh) is collated into a single file, which is
written and read on the master processor. The files are stored in a single
directory named 'processors'.
The new format produces significantly fewer files - one per field, instead of N
per field. For large parallel cases, this avoids the restriction on the number
of open files imposed by the operating system limits.
The file writing can be threaded allowing the simulation to continue running
while the data is being written to file. NFS (Network File System) is not
needed when using the the collated format and additionally, there is an option
to run without NFS with the original uncollated approach, known as
"masterUncollated".
The controls for the file handling are in the OptimisationSwitches of
etc/controlDict:
OptimisationSwitches
{
...
//- Parallel IO file handler
// uncollated (default), collated or masterUncollated
fileHandler uncollated;
//- collated: thread buffer size for queued file writes.
// If set to 0 or not sufficient for the file size threading is not used.
// Default: 2e9
maxThreadFileBufferSize 2e9;
//- masterUncollated: non-blocking buffer size.
// If the file exceeds this buffer size scheduled transfer is used.
// Default: 2e9
maxMasterFileBufferSize 2e9;
}
When using the collated file handling, memory is allocated for the data in the
thread. maxThreadFileBufferSize sets the maximum size of memory in bytes that
is allocated. If the data exceeds this size, the write does not use threading.
When using the masterUncollated file handling, non-blocking MPI communication
requires a sufficiently large memory buffer on the master node.
maxMasterFileBufferSize sets the maximum size in bytes of the buffer. If the
data exceeds this size, the system uses scheduled communication.
The installation defaults for the fileHandler choice, maxThreadFileBufferSize
and maxMasterFileBufferSize (set in etc/controlDict) can be over-ridden within
the case controlDict file, like other parameters. Additionally the fileHandler
can be set by:
- the "-fileHandler" command line argument;
- a FOAM_FILEHANDLER environment variable.
A foamFormatConvert utility allows users to convert files between the collated
and uncollated formats, e.g.
mpirun -np 2 foamFormatConvert -parallel -fileHandler uncollated
An example case demonstrating the file handling methods is provided in:
$FOAM_TUTORIALS/IO/fileHandling
The work was undertaken by Mattijs Janssens, in collaboration with Henry Weller.
This commit is contained in:
@ -16,6 +16,6 @@ for (label n1=0; n1<Times.size() && variableGood; ++n1)
|
||||
Times[n1].name(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).headerOk();
|
||||
).typeHeaderOk<volScalarField>(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ if (Times.size() > 1)
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
if (io.headerOk())
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
{
|
||||
meshMoving = true;
|
||||
break;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -584,7 +584,10 @@ int main(int argc, char *argv[])
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
bool fieldExists = fieldObject.headerOk();
|
||||
bool fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>
|
||||
(
|
||||
false
|
||||
);
|
||||
if (fieldType == scalarIOField::typeName)
|
||||
{
|
||||
ensightCloudField<scalar>
|
||||
|
||||
@ -13,6 +13,6 @@ if (timeDirs.size() > 1)
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).headerOk();
|
||||
).typeHeaderOk<pointIOField>(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
false
|
||||
);
|
||||
|
||||
if (io.headerOk())
|
||||
if (io.typeHeaderOk<IOdictionary>(true))
|
||||
{
|
||||
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||
IOdictionary timeObject(io);
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
mesh
|
||||
);
|
||||
|
||||
if (io.headerOk())
|
||||
if (io.typeHeaderOk<pointIOField>(true))
|
||||
{
|
||||
// Read new points
|
||||
io.readOpt() = IOobject::MUST_READ;
|
||||
|
||||
@ -71,7 +71,13 @@ for (label i=0; i < nTypes; i++)
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (lagrangianHeader.headerOk())
|
||||
if
|
||||
(
|
||||
lagrangianHeader.typeHeaderOk<IOPosition<Cloud<passiveParticle>>>
|
||||
(
|
||||
false
|
||||
)
|
||||
)
|
||||
{
|
||||
Cloud<passiveParticle> particles(mesh, cloud::defaultName);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ IOobject ioPoints
|
||||
mesh
|
||||
);
|
||||
|
||||
if (ioPoints.headerOk())
|
||||
if (ioPoints.typeHeaderOk<pointIOField>(true))
|
||||
{
|
||||
Info<< "new points available" << endl;
|
||||
// Reading new points
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "patchZones.H"
|
||||
#include "collatedFileOperation.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkDataArraySelection.h"
|
||||
@ -249,6 +250,12 @@ Foam::vtkPV3Foam::vtkPV3Foam
|
||||
printMemory();
|
||||
}
|
||||
|
||||
// Make sure not to use the threaded version - it does not like
|
||||
// being loaded as a shared library - static cleanup order is problematic.
|
||||
// For now just disable the threaded writer.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
|
||||
// avoid argList and get rootPath/caseName directly from the file
|
||||
fileName fullCasePath(fileName(FileName).path());
|
||||
|
||||
@ -567,7 +574,13 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps)
|
||||
if
|
||||
(
|
||||
isFile(runTime.path()/timeName/meshDir_/"points")
|
||||
&& IOobject("points", timeName, meshDir_, runTime).headerOk()
|
||||
&& IOobject
|
||||
(
|
||||
"points",
|
||||
timeName,
|
||||
meshDir_,
|
||||
runTime
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
)
|
||||
{
|
||||
break;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,7 +63,7 @@ public:
|
||||
explicit zonesEntries(const IOobject& io)
|
||||
:
|
||||
regIOobject(io),
|
||||
PtrList<entry>(readStream("regIOobject"))
|
||||
PtrList<entry>(readStream(word("regIOobject")))
|
||||
{
|
||||
close();
|
||||
}
|
||||
@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPV3Foam::getZoneNames(const word& zoneType) const
|
||||
false
|
||||
);
|
||||
|
||||
if (ioObj.headerOk())
|
||||
if (ioObj.typeHeaderOk<cellZoneMesh>(false))
|
||||
{
|
||||
zonesEntries zones(ioObj);
|
||||
|
||||
@ -333,7 +333,7 @@ void Foam::vtkPV3Foam::updateInfoPatches
|
||||
);
|
||||
|
||||
// this should only ever fail if the mesh region doesn't exist
|
||||
if (ioObj.headerOk())
|
||||
if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
|
||||
{
|
||||
polyBoundaryMeshEntries patchEntries(ioObj);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "patchZones.H"
|
||||
#include "OStringStream.H"
|
||||
#include "collatedFileOperation.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkDataArraySelection.h"
|
||||
@ -164,6 +165,12 @@ Foam::vtkPV3blockMesh::vtkPV3blockMesh
|
||||
<< FileName << endl;
|
||||
}
|
||||
|
||||
// Make sure not to use the threaded version - it does not like
|
||||
// being loaded as a shared library - static cleanup order is problematic.
|
||||
// For now just disable the threaded writer.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
|
||||
// avoid argList and get rootPath/caseName directly from the file
|
||||
fileName fullCasePath(fileName(FileName).path());
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "patchZones.H"
|
||||
#include "collatedFileOperation.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkDataArraySelection.h"
|
||||
@ -249,6 +250,12 @@ Foam::vtkPVFoam::vtkPVFoam
|
||||
printMemory();
|
||||
}
|
||||
|
||||
// Make sure not to use the threaded version - it does not like
|
||||
// being loaded as a shared library - static cleanup order is problematic.
|
||||
// For now just disable the threaded writer.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
|
||||
// avoid argList and get rootPath/caseName directly from the file
|
||||
fileName fullCasePath(fileName(FileName).path());
|
||||
|
||||
@ -566,8 +573,13 @@ double* Foam::vtkPVFoam::findTimes(int& nTimeSteps)
|
||||
|
||||
if
|
||||
(
|
||||
isFile(runTime.path()/timeName/meshDir_/"points")
|
||||
&& IOobject("points", timeName, meshDir_, runTime).headerOk()
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
timeName,
|
||||
meshDir_,
|
||||
runTime
|
||||
).typeHeaderOk<pointIOField>(true)
|
||||
)
|
||||
{
|
||||
break;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,7 +63,7 @@ public:
|
||||
explicit zonesEntries(const IOobject& io)
|
||||
:
|
||||
regIOobject(io),
|
||||
PtrList<entry>(readStream("regIOobject"))
|
||||
PtrList<entry>(readStream(word("regIOobject")))
|
||||
{
|
||||
close();
|
||||
}
|
||||
@ -124,7 +124,7 @@ Foam::wordList Foam::vtkPVFoam::getZoneNames(const word& zoneType) const
|
||||
false
|
||||
);
|
||||
|
||||
if (ioObj.headerOk())
|
||||
if (ioObj.typeHeaderOk<cellZoneMesh>(false))
|
||||
{
|
||||
zonesEntries zones(ioObj);
|
||||
|
||||
@ -333,7 +333,7 @@ void Foam::vtkPVFoam::updateInfoPatches
|
||||
);
|
||||
|
||||
// this should only ever fail if the mesh region doesn't exist
|
||||
if (ioObj.headerOk())
|
||||
if (ioObj.typeHeaderOk<polyBoundaryMesh>(true))
|
||||
{
|
||||
polyBoundaryMeshEntries patchEntries(ioObj);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "patchZones.H"
|
||||
#include "OStringStream.H"
|
||||
#include "collatedFileOperation.H"
|
||||
|
||||
// VTK includes
|
||||
#include "vtkDataArraySelection.h"
|
||||
@ -170,6 +171,12 @@ Foam::vtkPVblockMesh::vtkPVblockMesh
|
||||
<< FileName << endl;
|
||||
}
|
||||
|
||||
// Make sure not to use the threaded version - it does not like
|
||||
// being loaded as a shared library - static cleanup order is problematic.
|
||||
// For now just disable the threaded writer.
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
|
||||
// avoid argList and get rootPath/caseName directly from the file
|
||||
fileName fullCasePath(fileName(FileName).path());
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ int USERD_set_filenames
|
||||
// remove the last '/' from rootDir
|
||||
if (the_path[lRoot-1] == '/')
|
||||
{
|
||||
the_path[lRoot-1] = char(NULL);
|
||||
the_path[lRoot-1] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -171,7 +171,7 @@ int USERD_set_filenames
|
||||
false
|
||||
);
|
||||
|
||||
if (sprayHeader.headerOk())
|
||||
if (sprayHeader.typeHeaderOk<Cloud<passiveParticle>>(false))
|
||||
{
|
||||
Info<< "[Found lagrangian]" << endl;
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
if (!fieldObjectPtr.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
if (!fieldObjectPtr.typeHeaderOk<volTensorField>(true))
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
if (!fieldObjectPtr.typeHeaderOk<volVectorField>(true))
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
if (!fieldObjectPtr.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
if (!fieldObjectPtr.typeHeaderOk<volTensorField>(true))
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ IOobject fieldObjectPtr
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
if (!fieldObjectPtr.headerOk())
|
||||
if (!fieldObjectPtr.typeHeaderOk<volVectorField>(true))
|
||||
{
|
||||
return Z_UNDEF;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (!UMeanHeader.headerOk())
|
||||
if (!UMeanHeader.typeHeaderOk<volVectorField>(true))
|
||||
{
|
||||
Info<< " No UMean field" << endl;
|
||||
continue;
|
||||
|
||||
@ -82,6 +82,7 @@ See also
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "CSV.H"
|
||||
#include "IOdictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user