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:
@ -187,7 +187,7 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (omegaHeader.headerOk())
|
||||
if (omegaHeader.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
volScalarField omega(omegaHeader, mesh);
|
||||
dimensionedScalar k0("VSMALL", k.dimensions(), VSMALL);
|
||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (nuTildaHeader.headerOk())
|
||||
if (nuTildaHeader.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
volScalarField nuTilda(nuTildaHeader, mesh);
|
||||
nuTilda = nut;
|
||||
|
||||
@ -428,7 +428,6 @@ int main(int argc, char *argv[])
|
||||
FatalErrorInFunction
|
||||
<< "No times selected." << exit(FatalError);
|
||||
}
|
||||
|
||||
forAll(times, timei)
|
||||
{
|
||||
word instance;
|
||||
@ -641,7 +640,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
runTime.writeFormat(),
|
||||
runTime.writeFormat(),
|
||||
IOstream::UNCOMPRESSED
|
||||
IOstream::UNCOMPRESSED,
|
||||
true
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -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
|
||||
@ -74,7 +74,8 @@ void rewriteBoundary
|
||||
HashTable<word>& nbrNames
|
||||
)
|
||||
{
|
||||
Info<< "Reading boundary from " << io.filePath() << endl;
|
||||
Info<< "Reading boundary from " << typeFilePath<IOPtrList<entry>>(io)
|
||||
<< endl;
|
||||
|
||||
// Read PtrList of dictionary.
|
||||
const word oldTypeName = IOPtrList<entry>::typeName;
|
||||
@ -446,7 +447,7 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (io.headerOk())
|
||||
if (io.typeHeaderOk<IOPtrList<entry>>(false))
|
||||
{
|
||||
rewriteBoundary
|
||||
(
|
||||
@ -480,7 +481,7 @@ int main(int argc, char *argv[])
|
||||
false
|
||||
);
|
||||
|
||||
if (io.headerOk())
|
||||
if (io.typeHeaderOk<IOPtrList<entry>>(false))
|
||||
{
|
||||
rewriteBoundary
|
||||
(
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,15 +44,12 @@ void MapConsistentVolFields
|
||||
const CombineOp& cop
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
|
||||
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
|
||||
|
||||
word fieldClassName
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||
);
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
||||
|
||||
forAllIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
@ -60,11 +57,7 @@ void MapConsistentVolFields
|
||||
<< endl;
|
||||
|
||||
// Read field
|
||||
GeometricField<Type, fvPatchField, volMesh> fieldSource
|
||||
(
|
||||
*fieldIter(),
|
||||
meshSource
|
||||
);
|
||||
fieldType fieldSource(*fieldIter(), meshSource);
|
||||
|
||||
IOobject fieldTargetIOobject
|
||||
(
|
||||
@ -75,10 +68,10 @@ void MapConsistentVolFields
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (fieldTargetIOobject.headerOk())
|
||||
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
// Read fieldTarget
|
||||
GeometricField<Type, fvPatchField, volMesh> fieldTarget
|
||||
fieldType fieldTarget
|
||||
(
|
||||
fieldTargetIOobject,
|
||||
meshTarget
|
||||
@ -101,7 +94,7 @@ void MapConsistentVolFields
|
||||
fieldTargetIOobject.readOpt() = IOobject::NO_READ;
|
||||
|
||||
// Interpolate field
|
||||
GeometricField<Type, fvPatchField, volMesh> fieldTarget
|
||||
fieldType fieldTarget
|
||||
(
|
||||
fieldTargetIOobject,
|
||||
meshToMesh0Interp.interpolate
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,15 +44,12 @@ void MapVolFields
|
||||
const CombineOp& cop
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
const fvMesh& meshSource = meshToMesh0Interp.fromMesh();
|
||||
const fvMesh& meshTarget = meshToMesh0Interp.toMesh();
|
||||
|
||||
word fieldClassName
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||
);
|
||||
|
||||
IOobjectList fields = objects.lookupClass(fieldClassName);
|
||||
IOobjectList fields = objects.lookupClass(fieldType::typeName);
|
||||
|
||||
forAllIter(IOobjectList, fields, fieldIter)
|
||||
{
|
||||
@ -65,20 +62,15 @@ void MapVolFields
|
||||
IOobject::AUTO_WRITE
|
||||
);
|
||||
|
||||
if (fieldTargetIOobject.headerOk())
|
||||
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " interpolating " << fieldIter()->name()
|
||||
<< endl;
|
||||
Info<< " interpolating " << fieldIter()->name() << endl;
|
||||
|
||||
// Read field fieldSource
|
||||
GeometricField<Type, fvPatchField, volMesh> fieldSource
|
||||
(
|
||||
*fieldIter(),
|
||||
meshSource
|
||||
);
|
||||
fieldType fieldSource(*fieldIter(), meshSource);
|
||||
|
||||
// Read fieldTarget
|
||||
GeometricField<Type, fvPatchField, volMesh> fieldTarget
|
||||
fieldType fieldTarget
|
||||
(
|
||||
fieldTargetIOobject,
|
||||
meshTarget
|
||||
|
||||
@ -149,7 +149,7 @@ void MapVolFields
|
||||
IOobject::MUST_READ
|
||||
);
|
||||
|
||||
if (targetIO.headerOk())
|
||||
if (targetIO.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " interpolating onto existing field "
|
||||
<< fieldName << endl;
|
||||
|
||||
@ -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
|
||||
@ -64,7 +64,7 @@ bool setCellFieldType
|
||||
);
|
||||
|
||||
// Check the "constant" directory
|
||||
if (!fieldHeader.headerOk())
|
||||
if (!fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
fieldHeader = IOobject
|
||||
(
|
||||
@ -76,7 +76,7 @@ bool setCellFieldType
|
||||
}
|
||||
|
||||
// Check field exists
|
||||
if (fieldHeader.headerOk())
|
||||
if (fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " Setting internal values of "
|
||||
<< fieldHeader.headerClassName()
|
||||
@ -210,7 +210,7 @@ bool setFaceFieldType
|
||||
);
|
||||
|
||||
// Check the "constant" directory
|
||||
if (!fieldHeader.headerOk())
|
||||
if (!fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
fieldHeader = IOobject
|
||||
(
|
||||
@ -222,7 +222,7 @@ bool setFaceFieldType
|
||||
}
|
||||
|
||||
// Check field exists
|
||||
if (fieldHeader.headerOk())
|
||||
if (fieldHeader.typeHeaderOk<fieldType>(true))
|
||||
{
|
||||
Info<< " Setting patchField values of "
|
||||
<< fieldHeader.headerClassName()
|
||||
|
||||
Reference in New Issue
Block a user