Commit Graph

13 Commits

Author SHA1 Message Date
b0d29ba8d6 ENH: add UPstream interface for MPI/IO
- supports writing, but without overlapping (begin/end) semantics.
2025-09-30 10:16:23 +02:00
0ba4f36c60 ENH: use List containers for Pstream read/write calls
- using the List containers, and not their low-level data_bytes(),
  size_bytes() methods is more convenient and allows future
  adjustments to be centralized

ENH: trivial intptr_t wrapper for MPI_Win

STYLE: minor adjustments to mpirunDebug
2025-02-11 11:09:30 +01:00
2889dc7248 ENH: add wrapped accessor for MPI_Comm
- UPstream::Communicator is similar to UPstream::Request to
  wrap/unwrap MPI_Comm. Provides a 'lookup' method to transcribe
  the internal OpenFOAM communicator tracking to the opaque wrapped
  version.

- provide an 'openfoam_mpi.H' interfacing file, which includes
  the <mpi.h> as well as casting routines.

  Example (caution: ugly!)

     MPI_Comm myComm =
         PstreamUtils::Cast::to_mpi
         (
             UPstream::Communicator::lookup(UPstream::worldComm)
         );
2024-04-23 10:58:38 +02:00
06f479fbd4 ENH: improve handling of wait/finished requests
- now simply a no-op for out-of-range values (instead of an error),
  which simplifies the calling code.

  Previously
  ==========

      if (request_ >= 0 && request_ < UPstream::nRequests())
      {
          UPstream::waitRequest(request_);
      }

  Updated
  =======

      UPstream::waitRequest(request_);

- when 'recycling' freed request indices, ensure they are actually
  within the currently addressable range

- MPI finalization now checks outstanding requests against
  MPI_REQUEST_NULL to verify that they have been waited or tested on.
  Previously simply checked against freed request indices

ENH: consistent initialisation of send/receive bookkeeping
2023-01-12 21:19:11 +01:00
87e3b196b0 ENH: extend wrapping of MPI calls to more data types
- supports gatherv of label and scalar types

- combine blocking and non-blocking interfaces in UPstreamWrapping
  (code reduction).

DEFEATURE: remove unused UPstream allToAllv wrapping

- backend interface preserved in UPstreamWrapping

COMP: add genericListBroadcast - simplifies code
2022-03-31 16:01:07 +02:00
8478595a15 ENH: new broadcast version of Pstreams (#2371)
- The idea of broadcast streams is to replace multiple master to
  subProcs communications with a single MPI_Bcast.

    if (Pstream::master())
    {
        OPBstream toAll(Pstream::masterNo());
        toAll << data;
    }
    else
    {
        IPBstream fromMaster(Pstream::masterNo());
        fromMaster >> data;
    }

    // vs.
    if (Pstream::master())
    {
        for (const int proci : Pstream::subProcs())
        {
            OPstream os(Pstream::commsTypes::scheduled, proci);
            os << data;
        }
    }
    else
    {
        IPstream is(Pstream::commsTypes::scheduled, Pstream::masterNo());
        is >> data;
    }

  Can simply use UPstream::broadcast() directly for contiguous data
  with known lengths.

Based on ideas from T.Aoyagi(RIST), A.Azami(RIST)
2022-03-04 17:49:23 +00:00
b0ef650a12 ENH: Pstream specialization for float/scalar, FixedList (#2351)
- native MPI min/max/sum reductions for float/double
  irrespective of WM_PRECISION_OPTION

- native MPI min/max/sum reductions for (u)int32_t/(u)int64_t types,
  irrespective of WM_LABEL_SIZE

- replace rarely used vector2D sum reduction with FixedList as a
  indicator of its intent and also generalizes to different lengths.

  OLD:
      vector2D values;  values.x() = ...;  values.y() = ...;
      reduce(values, sumOp<vector2D>());

  NEW:
      FixedList<scalar,2> values;  values[0] = ...;  values[1] = ...;
      reduce(values, sumOp<scalar>());

- allow returnReduce() to use native reductions. Previous code (with
  linear/tree selector) would have bypassed them inadvertently.

ENH: added support for MPI broadcast (for a memory span)

ENH: select communication schedule as a static method

- UPstream::whichCommunication(comm) to select linear/tree
  communication instead of ternary or
  if (Pstream::nProcs() < Pstream::nProcsSimpleSum) ...

STYLE: align nProcsSimpleSum static value with etc/controlDict override
2022-03-04 17:49:23 +00:00
b95b24e4e7 ENH: improved isolation of MPI access in Pstreams
- refactor as an MPI-independent base class.

  Add bufferIPC{send,recv} private methods for construct/destruct.
  Eliminates code duplication from two constructor forms and reduces
  additional constructor definitions in dummy library.

- add PstreamBuffers access methods, refactor common finish sends
  code, tweak member packing

ENH: resize_nocopy for processorLduInterface buffers

- content is immediately overwritten

STYLE: cull unneeded includes in processorFa*

- handled by processorLduInterface
2022-03-04 17:49:23 +00:00
f233595a7f ENH: improved granularity for MPI-rebuilds
- Provide Allwmake-mpi scripts for handling the MPI-only build segment.

- Adjust Make/options to support a FOAM_MPI_LIBBIN target location.
  This will simply default to FOAM_LIBBIN/FOAM_MPI, but allows different
  types of builds with out-of-tree targets.

Example,

Build OpenFOAM with default MPI settings (eg, system openmpi)
```
./Allwmake
```

Rebuild MPI-layers with different MPI.

For any given and known type
```
othermpi()
{
    export WM_MPLIB=OPENMPI
    export FOAM_MPI=openmpi-3.1.3

    export OPAL_PREFIX=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
    export MPI_ARCH_PATH="$OPAL_PREFIX"
}
```

May wish to build/rebuild ptscotch
```
(
    othermpi
    $WM_THIRD_PARTY_DIR/makeSCOTCH
)
```

Rebuild the mpi-dependent parts. Can also provide install location
```
for script in $(find src -name Allwmake-mpi)
do
(
    other_mpi
    export FOAM_MPI_LIBBIN="$HOME/tmp/install-prefix/lib/$FOAM_MPI"
)
done
```
2020-05-19 07:13:12 +01:00
5e12506f8e ENH: improve separation of OpenFOAM and ThirdParty mpi-libraries
- drop FOAM_MPI_LIBBIN variable in favour of FOAM_MPI from which
  two different locations can be determined.

  Previously there was something like this:

      FOAM_MPI_LIBBIN = $FOAM_LIBBIN/openmpi-1.5.1

  We now instead determine the locations from the FOAM_MPI directly:

      FOAM_MPI=openmpi-1.5.1

          $FOAM_LIBBIN/$FOAM_MPI     -> OpenFOAM  mpi-related
          $FOAM_EXT_LIBBIN/$FOAM_MPI -> ThirdPary mpi-related

ENH: relocate ParaView libraries and plugins back under FOAM_LIBBIN

- as discussed with Mattijs
2011-01-05 07:53:54 +01:00
46f1df810c unallocated Pstream 2009-10-26 09:59:07 +00:00
0b51b764d6 bundle outstanding send and receive requests 2009-08-25 23:03:33 +01:00
3170c7c0c9 Creation of OpenFOAM-dev repository 15/04/2008 2008-04-15 18:56:58 +01:00