Commit Graph

57 Commits

Author SHA1 Message Date
70208a7399 ENH: use returnReduceAnd(), returnReduceOr() functions
DOC: document which MPI send/recv are associated with commType
2022-11-08 16:48:08 +00:00
a674c9d373 ENH: use broadcasting streams to distribute uniform file content
BUG: masterUncollatedFileOperation checking of file-size

- used Foam:fileSize check to decide on scheduled/nonBlocking but this
  was being done on all ranks and subsequently broadcast.
  Now avoid unnecessary filesystem access on non-master ranks.
2022-03-12 21:16:30 +01:00
794e23e083 ENH: add error::master() static for low-level messages
- a Pstream::master with a Pstream::parRun guard in case Pstream has
  not yet been initialised, as will be the case for low-level messages
  during startup.

- propagate relativeName handling into IOstreams
2021-11-05 14:53:55 +01:00
cf9063878e ENH: improve dynamicCode consistency
- refactor and provision for additional code context
2021-04-19 16:33:42 +00:00
9a2a22a03a ENH: provide setter methods for IOobject read/write options etc.
- simplifies local toggling.

- centralize fileModification static variables into IOobject.
  They were previously scattered between IOobject and regIOobject
2021-03-17 15:10:00 +01:00
1e7c6ea2f1 ENH: mutable libs() access in Time and other classes (#1737)
- This reflects the pre-existing coding situation where const_cast was
  used throughout to effect the same.

STYLE: fix private/protected access

- CodedField, codedMixedFvPatchField
2020-07-14 11:19:05 +02:00
41d3e6f1d4 ENH: various dlLibraryTable improvements/refinements (#1737)
- libs() singleton method for global library handling

- explicit handling of empty filename for dlLibraryTable open/close.
  Largely worked before, but now be more explicit about its behaviour.

- add (key, dict) constructor and open() methods.
  More similarity to dimensionedType, Enum etc, and there is no
  ambiguity with the templated open().

- construct or open from initializer_list of names

- optional verbosity when opening with auxiliary table,
  avoid duplicate messages or spurious messages for these.

- basename and fullname methods (migrated from dynamicCode).

- centralise low-level load/unload hooks

- adjust close to also dlclose() aliased library names.
2020-07-14 11:19:05 +02:00
76de104daa ENH: fileModificationSkew: add polling. Fixes #1472. 2019-11-27 14:13:01 +00:00
fdf8d10ab4 Merge commit 'e9219558d7' into develop-v1906 2019-12-05 11:47:19 +00:00
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
c0fce5c762 ENH: refactor some function entries to reduce code duplication 2019-08-21 11:19:54 +02:00
a85c55bbb5 ENH: ensure that content changes in coded objects are noticed (#1293)
- for codedFunctionObject and CodedSource the main code snippets
  were not included in the SHA1 calculation, which meant that many
  changes would not be noticed and no new library would be compiled.

  As a workaround, a dummy 'code' entry could be used solely for the
  purposes of generating a SHA1, but this is easily forgotten.

  We now allow tracking of the dynamicCodeContext for the coded
  objects and append to the SHA1 hasher with specific entries.
  This should solve the previous misbehaviour.

  We additionally add information about the ordering of the code
  sections. Suppose we have a coded function object (all code
  segments are optional) with the following:

      codeExecute "";
      codeWrite   #{ Info<< "Called\n"; #};

  which we subsequently change to this:

      codeExecute #{ Info<< "Called\n"; #};
      codeWrite   "";

  If the code strings are simply concatenated together, the SHA1 hashes
  will be identical. We thus 'salt' with their semantic locations,
  choosing tags that are unlikely to occur within the code strings
  themselves.

- simplify the coded templates with constexpr for the SHA1sum
  information.

- Correct the CodedSource to use 'codeConstrain' instead of
  'codeSetValue' for consistency with the underlying functions.
2019-05-01 14:00:54 +02:00
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
a7a346b206 STYLE: indentation for FatalIOErrorInFunction calls 2018-11-06 09:49:22 +01:00
6390c18381 ENH: suppress Info output for some cases (issue #722, #893)
- add additional control via a Foam::infoDetailLevel flag, which is
  supported by a 'DetailLevel' macro.  Eg,

      DetailLevel << "some information" << nl

- When infoDetailLevel is zero, the stdout for all Foam::system() calls
  are also redirected to stderr to prevent child output from
  appearing on the parent.

- close stdin before exec in system call.
2018-06-22 12:26:33 +02:00
d8d6030ab6 INT: Integration of Mattijs' collocated parallel IO additions
Original commit message:
------------------------

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.
2017-07-07 11:39:56 +01:00
5148e4f860 STYLE: manage dictionary inputMode directly within entry class
- The logic for switching input-mode was previously completely
  encapsulated within the #inputMode directive, but without any
  programming equivalent. Furthermore, the encapsulation in inputMode
  made the logic less clear in other places.

  Exposing the inputMode as an enum with direct access from entry
  simplifies things a fair bit.

- eliminate one level of else/if nesting in entryIO.C for clearer logic

- for dictionary function entries, simply use
  addNamedToMemberFunctionSelectionTable() and avoid defining a type()
  as a static. For most function entries the information is only used
  to get a name for the selection table lookup anyhow.
2017-08-03 07:14:17 +02:00
86ef9e86dc ENH: make treatment of stream allocators more uniform (issue #532)
- use allocator class to wrap the stream pointers instead of passing
  them into ISstream, OSstream and using a dynamic cast to delete
  then. This is especially important if we will have a bidirectional
  stream (can't delete twice!).

STYLE:

- file stream constructors with std::string (C++11)

- for rewind, explicit about in|out direction. This is not currently
  important, but avoids surprises with any future bidirectional access.

- combined string streams in StringStream.H header.
  Similar to <sstream> include that has both input and output string
  streams.
2017-07-17 15:14:38 +02:00
9fbd612672 GIT: Initial state after latest Foundation merge 2016-09-20 14:49:08 +01:00
58f905ff70 C++11: Replaced the C NULL with the safer C++11 nullptr
Requires gcc version 4.7 or higher
2016-08-05 17:19:38 +01:00
70525fe75e ENH: include file tracking: missed out adding files to list of files to check 2016-01-27 17:35:46 +00:00
dc43311e62 src/OpenFOAM: Update ...IOErrorIn -> ...IOErrorInFunction
Avoids the clutter and maintenance effort associated with providing the
function signature string.
2015-11-10 21:13:04 +00:00
b50f294391 BUG: codeStream: do not reduce if timeStampMaster 2014-03-11 10:13:10 +00:00
f2d8f6361c ENH: dictionary: added topDict() function 2013-09-03 15:28:26 +01:00
0d8fff3a5f ENH: codeStream: function in dictionary context 2013-08-17 05:28:31 +01:00
ff373afdcc BUG: codeStream: make sure scatter result is consumed before starting again 2013-08-15 15:31:15 +01:00
2503ac43e5 ENH: codeStream: update from 2.2.0 2013-01-22 10:10:51 +00:00
4023418a6b ENH: codeStream: sha1 calculation cached 2012-09-25 14:14:05 +01:00
1cc1ddcacf ENH: dlOpen: check error message string 2011-10-24 21:31:38 +01:00
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
cb8bf9f7f0 ENH: codeStream: make it work with master-only reading (timeStampMaster) 2011-08-09 10:53:23 +01:00
30f2589d00 BUG: codeStream.C: commented out code for master-only checking since would not work for fields 2011-07-06 10:13:30 +01:00
b3558a8991 ENH: codeStream: work with timeStampMaster 2011-07-05 17:29:30 +01:00
9fa370f54a ENH: calcEntry: new functionEntry method 2011-06-29 09:56:01 +01:00
f79aeb9402 ENH: Time: construct dlLibraryTable before reading dictionary so controlDict can have e.g. #codeStream 2011-04-20 11:52:24 +01:00
a791316896 ENH: dlLibraryTable: moved library handles to objects 2011-04-18 16:41:21 +01:00
cf99e5c800 ENH: codeStream: added codeLibs 2011-03-21 17:54:20 +00:00
ea67afaf96 ENH: codedFixedValue : added printing 2011-03-18 14:54:11 +00:00
0ba821d184 ENH: codeStream: added message if loading library 2011-03-07 12:54:28 +00:00
7ca8b24a0d STYLE: minor code cleanup for codeStream/codedFixedValueFvPatchScalarField 2011-03-03 14:16:00 +01:00
97cd3af1ff ENH: cleanup codeStream - use dynamicCode, dynamicCodeContext encapsulation
Problems remain with codedFixedValueFvPatchScalarField:

- readIfModified() notices change on system/codeDict, but the
  codeProperties::setUnmodified() means that only a single entry will
  get processed

- it appears that while dlclose() may (or may not) be actually closing
  the library, there are probably still references about. This means
  that a subsequent reloading still points to the original functions
  and the lookup is not updated correctly.
2011-03-01 14:19:24 +01:00
74bc658fe9 ENH: new encapsulation: dynamicCode, dynamicCodeContext
- improve loading/unloading characteristics for codedFixedValue
  but still needs work
2011-02-24 17:14:59 +01:00
6eb982573c ENH: add stub function to codedFixedValueFvPatchScalarField for version checking
- eg, fixedValue10_<SHA1>, its existence indicates that the correct
  library has been loaded
2011-02-24 08:54:12 +01:00
97a15a8b06 STYLE: simplify stringOps::expand names 2011-02-23 14:42:51 +01:00
67fc6a171a ENH: use stringOps::expandDict when processing codeStream input 2011-02-23 14:22:14 +01:00
f4a84af465 STYLE: trim both ends of codeStream entries
- improves consistency of SHA1 calculation
2011-02-23 10:23:50 +01:00
abde400dd5 Merge remote branch 'OpenCFD/master' into olesenm
Conflicts:
	bin/foamCleanPath
2011-02-22 19:24:31 +01:00
70f359bb2b STYLE: refactor codeStream code into codeStreamTools 2011-02-22 18:22:57 +01:00
dce20ade07 ENH: compile codedFixedValueFvPatchScalarField into local directory only 2011-02-22 16:25:34 +01:00
141fe37a86 ENH: compile codeStream into local directory only 2011-02-22 16:07:06 +01:00