Skip to content
Snippets Groups Projects
  1. Apr 20, 2023
  2. Apr 19, 2023
  3. Apr 18, 2023
    • Mark OLESEN's avatar
      CONFIG: support call of 'openfoam' wrapper in other in-project locations · 8434931c
      Mark OLESEN authored
      - directory discovery originally designed for a sub-dir location
        (eg, etc/openfoam) but failed if called from within the sub-dir
        itself.
      
        Now simply assume it is located in the project directory or the etc/
        sub-dir, so that it can also be relocated into the project directory
        in the future (pending changes to RPM and debian packaging)
      8434931c
    • Mark OLESEN's avatar
      CONFIG: increment API level to 2302 · b12e47d9
      Mark OLESEN authored
      b12e47d9
    • Mark OLESEN's avatar
      ENH: provide UPstream::finishedRequests() support · 66a7f0c9
      Mark OLESEN authored
      - for querying all outstanding requests:
      
           if (UPstream::finishedRequests(startRequest)) ...
           if (UPstream::finishedRequests(startRequest, -1)) ...
      
      - for querying slice of outstanding requests:
      
           if (UPstream::finishedRequests(startRequest, 10)) ...
      66a7f0c9
    • Mark OLESEN's avatar
      ENH: provide UPstream intra-host and inter-host communicators · 80bc1db5
      Mark OLESEN authored
      - simplifies communication structuring with intra-host communication.
        Can be used for IO only, or for specialised communication.
      
        Demand-driven construction. Gathers the SHA1 of host names when
        determining the connectivity. Internally uses an MPI_Gather of the
        digests and a MPI_Bcast of the unique host indices.
      
        NOTE:
          does not use MPI_Comm_splt or MPI_Comm_splt_type since these
          return MPI_COMM_NULL on non-participating process which does not
          easily fit into the OpenFOAM framework.
      
          Additionally, if using the caching version of
          UPstream::commInterHost() and UPstream::commIntraHost()
          the topology is determined simultaneously
          (ie, equivalent or potentially lower communication).
      80bc1db5
    • Mark OLESEN's avatar
      ENH: consolidate UPstream::commsStruct code · 9d3427e0
      Mark OLESEN authored
      - make sizing of commsStruct List demand-driven as well
        for more robustness, fewer unneeded allocations.
      
      - fix potential latent bug with allBelow/allNotBelow for proc 0
        (linear communication).
      
      ENH: remove unused/unusable UPstream::communicator optional parameter
      
      - had constructor option to avoid constructing the MPI backend,
        but this is not useful and inconsistent with what the reset or
        destructor expect.
      
      STYLE: local use of UPstream::communicator
      
      - automatically frees communicator when it leaves scope
      9d3427e0
    • Mark OLESEN's avatar
      ENH: add guards for partially populated communicators · b277b913
      Mark OLESEN authored
      - these are primarily when encountering sparse (eg, inter-host)
        communicators. Additional UPstream convenience methods:
      
        is_rank(comm)
          => True if process corresponds to a rank in the communicators.
             Can be a master rank or a sub-rank.
      
        is_parallel(comm)
          => True if parallel algorithm or exchange is used on the process.
             same as
      
                 (parRun() && (nProcs(comm) > 1) && is_rank(comm))
      b277b913
    • Mark OLESEN's avatar
      ENH: add interface code for MPI_Allgather · 74db18a9
      Mark OLESEN authored
      COMP: incorrect macro declaration for mpiGather/mpiScatter
      74db18a9
    • Mark OLESEN's avatar
      ENH: more consistent min edge lengths (finite-area) · 2cf200ae
      Mark OLESEN authored
      - for robustness with small edges (which can occur with snappy meshes),
        the Le() and magLe() are limited to SMALL (commit a0f1e98d).
        Now use factor sqrt(1/3) in the components to maintain magnitude of 1.
      
      ENH: add fvMesh::unitSf() and faMesh::unitLe() methods
      
      - simple wrappers around Sf()/magSf() and Le()/magLe() but with
        the potential for additional/alternative corrections.
      
      STYLE: thisDb() in faMesh code to simplify future changes in storage
      
      ENH: do not register finite-area geometric fields
      
      - consistent with finite-volume treatment
      2cf200ae
    • Mark OLESEN's avatar
      ENH: robuster handling of inv() of fields with singular tensors (#2724) · a96dcf70
      Mark OLESEN authored
      - replace the "one-size-fits-all" approach of tensor field inv()
        with individual 'failsafe' inverts.
      
        The inv() field function historically just checked the first entry
        to detect 2D cases and adjusted/readjusted *all* tensors accordingly
        (to avoid singularity tensors and/or noisy inversions).
      
        This seems to have worked reasonably well with 3D volume meshes, but
        breaks down for 2D area meshes, which can be axis-aligned
        differently on different sections of the mesh.
      a96dcf70
  4. Apr 13, 2023
  5. Apr 11, 2023
    • Mark OLESEN's avatar
      ENH: restrict use of MPI_Group to local scope · 89e1d8c2
      Mark OLESEN authored
      - don't need to retain group references globally.
        Just retrieve parent group reference on-demand and discard
        immediately afterwards.
      89e1d8c2
    • Mark OLESEN's avatar
      ENH: add request-driven polling/consumption of processor interfaces · 1f5cf395
      Mark OLESEN authored
      - with (nPollProcInterfaces < 0) it does the following:
      
        - loop, waiting for some requests to finish
        - for each out-of-date interface, check if its associated
          requests have now finished (ie, the ready() check).
        - if ready() -> call updateInterfaceMatrix()
      
        In contrast to (nPollProcInterfaces > 0) which loops a specified
        number of times with several calls to MPI_Test each time, the
        (nPollProcInterfaces < 0) variant relies on internal MPI looping
        within MPI_Waitsome to progress communication.
      
        The actual dispatch still remains non-deterministic (ie, waiting for
        some requests to finish does not mean that any particular interface
        is eligible for update, or in any particular order). However, using
        Waitsome places the tight looping into the MPI layer, which results
        in few calls and eliminates behaviour dependent on the value of
        nPollProcInterfaces.
      
      TUT: add polling to windAroundBuildings case (for testing purposes)
      1f5cf395
    • Mark OLESEN's avatar
      e1cb1250
    • Mark OLESEN's avatar
      ENH: use bundled MPI_Test when checking processor interface ready() · 9fbc484c
      Mark OLESEN authored
      - fewer calls, potentially more consistent
      
      ENH: update sendRequest state after recvRequest wait
      
      - previously had this type of code:
      
          // Treat send as finished when recv is done
          UPstream::waitRequest(recvRequest_);
          recvRequest_ = -1;
          sendRequest_ = -1;
      
        Now refined as follows:
      
          // Require receive data. Update the send request state.
          UPstream::waitRequest(recvRequest_);
          recvRequest_ = -1;
          if (UPstream::finishedRequest(sendRequest_)) sendRequest_ = -1;
      
        Can potentially investigate with requiring both,
        but this may be over-contrained.
        Example,
      
          // Require receive data, but also wait for sends too
          UPstream::waitRequestPair(recvRequest_, sendRequest_);
      9fbc484c
    • Mark OLESEN's avatar
      ENH: MPI_Waitany / MPI_Waitsome interface for internal list of requests · 11065bb0
      Mark OLESEN authored
      - checks requests from completion, returning true when some requests
        have completed and false when there are no active requests.
        This allows it to be used in a polling loop to progress MPI
        and then respond when as requests become satisfied.
      
        When using as part of a dispatch loop, waitSomeRequests() is
        probably more efficient than calling waitAnyRequest() and can help
        avoid biasing which client requests are serviced.
      
        Takes an optional return parameter, to retrieve the indices,
        but more importantly to avoid inner-loop reallocations.
      
        Example,
      
            DynamicList<int> indices;
            while (UPstream::waitSomeRequests(startRequest, &indices))
            {
                // Dispatch something ....
            }
      
            // Reset list of outstanding requests with 'Waitall' for safety
            UPstream::waitRequests(startRequest);
      
        ---
      
        If only dealing with single items and an index is required for
        dispatching, it can be better to use a list of UPstream::Request
        instead.
      
        Example,
      
            List<UPstream::Request> requests = ...;
      
            label index = -1;
            while ((index = UPstream::waitAnyRequest(requests)) >= 0)
            {
                // Do something at index
            }
      
      ENH: pair-wise wrappers for MPI_Test or MPI_Wait
      
      - for send/recv pairs of requests, can bundle both together and use a
        single MPI_Testsome and MPI_Waitall instead of two individual
        calls.
      11065bb0
  6. Apr 08, 2023
    • Mark OLESEN's avatar
      ENH: simplify handling of pushed/freed requests · aa002122
      Mark OLESEN authored
      - previously had an additional stack for freedRequests_,
        which were used to 'remember' locations into the list of
        outstandingRequests_ that were handled by 'waitRequest()'.
      
        This was principally done for sanity checks on shutdown,
        but we now just test for any outstanding requests that
        are *not* MPI_REQUEST_NULL instead (much simpler).
      
        The framework with freedRequests_ also had a provision to 'recycle'
        them by popping from that stack, but this is rather fragile since it
        would only triggered by some collectives
        (MPI_Iallreduce, MPI_Ialltoall, MPI_Igather, MPI_Iscatter)
        with no guarantee that these will all be properly removed again.
        There was also no pruning of extraneous indices.
      
      ENH: consolidate internal reset/push of requests
      
      - replace duplicate code with inline functions
        reset_request(), push_request()
      
      ENH: null out trailing requests
      
      - extra safety (paranoia) for the UPstream::Request versions
        of finishedRequests(), waitAnyRequest()
      
      CONFIG: document nPollProcInterfaces in etc/controlDict
      
      - still experimental, but at least make the keyword known
      aa002122
    • Mark OLESEN's avatar
      DEFEATURE: remove unused UPstream allocateTag(), freeTag() routines · 700156b4
      Mark OLESEN authored
      - mechanism has been unused for at least a decade or more
        (or was never used). Message tags are assigned on an ad hoc basis
        locally when collision avoidance is necessary.
      700156b4
    • Mark OLESEN's avatar
      ENH: properly trap any sub-rank changes in allocatePstreamCommunicator · d826f925
      Mark OLESEN authored
      - not currently used, but it is possible that communicator allocation
        modifies the list of sub-ranks. Ensure that the correct size is used
        when (re)initialising the linear/tree structures.
      
      STYLE: adjust MPI test applications
      
      - remove some clutter and unneeded grouping.
        Some ideas for host-only communicators
      d826f925
  7. Apr 06, 2023
  8. Apr 05, 2023
    • Mark OLESEN's avatar
      ENH: improve suspend/resume handling of Pstream profiling (#2737) · 5de59417
      Mark OLESEN authored
      - allow reporting even when profiling is suspended
      
      - consolidate reporting into profilingPstream itself
        (avoids code scatter).
      
      Example of possible advanced use for timing only one section of
      code:
      
          ====
          // Profile local operations
          profilingPstream::enable();
      
          ... do something
      
          // Don't profile elsewhere
          profilingPstream::suspend();
          ====
      5de59417
    • Mark OLESEN's avatar
      ENH: extend parProfiling (#2737) · 9577a0f6
      Mark OLESEN authored
      - separate broadcast times from reduce/gather/scatter time
      - separate wait times from all-to-all time
      - support invocation counts, split off requests time/count
        from others to avoid flooding the counts
      
      - support 'detail' switch to increase the output information.
        Format may change in the future
      9577a0f6
  9. Apr 04, 2023
  10. Apr 03, 2023
  11. Mar 31, 2023
  12. Mar 29, 2023
  13. Mar 23, 2023
    • Mark OLESEN's avatar
      STYLE: Allwmake report api/patch directly from META-INFO · f903707e
      Mark OLESEN authored
      - avoid dependency on etc/openfoam (location may change)
      f903707e
    • Mark OLESEN's avatar
      ENH: robuster handling inv() of singular tensor for finite-area LSQ (#2724) · 66cae2b9
      Mark OLESEN authored
      - with the current handling of small edges (finite-area), the LSQ
        vectors can result in singular/2D tensors. However, the regular
        2D handling in field inv() only detects based on the first element.
      
        Provide a 'failsafe' inv() method for symmTensor and tensor that
        follows a similar logic for avoiding zero determinates, but it is
        applied on a per element basis, instead of deciding based on the
        first field element.
      
        The symmTensor::inv(bool) and tensor::inv(bool) methods have a
        fairly modest additional overhead.
      
      - unroll the field inv() function to avoid creating an intermediate
        field.  Reduce the number of operations when adjusting/re-adjusting
        the diagonal.
      66cae2b9
    • Mark OLESEN's avatar
      ENH: add 2D det() / inv() methods for Tensor/SymmTensor (#2724) · 4994456a
      Mark OLESEN authored
      - for cases where a 3D tensor is being used to represent 2D content,
        the determinant is zero. Can use inv2D(excludeDirection) to compensate
        and invert as if it were only 2D.
      
      ENH: consistent definitions for magSqr of symmTensors, diagSqr() norm
      
      COMP: return scalar not component type for magSqr
      
      - had inconsistent definitions with SymmTensor returning the component
        type and Tensor returning scalar. Only evident with complex.
      4994456a
    • Mark OLESEN's avatar
      BUG: remove overly optimistic short-cut when reading BCs · 726787b0
      Mark OLESEN authored
      - had an optimisation to skip attempted reading for zero-sized
        patches. But this leads to inconsistency in the code branching, thus
        removing it.
      726787b0
    • Mark OLESEN's avatar
      ENH: support optional upper limit for printStack · f6969631
      Mark OLESEN authored
      - when only a partial stacktrace is desirable.
      
      ENH: add stack trace decorators
      
      - the 0-th frame is always printStack(), so skip that and emit
        some headers/footers instead. Eg,
      
        [stack trace]
        =============
        #1  Foam::SymmTensor<double> Foam::inv<double>(...)
        #2  Foam::inv(Foam::UList<Foam::SymmTensor<double>> const&) ...
        ...
        =============
      f6969631
    • Mark OLESEN's avatar
      ENH: additional SHA1Digest constructors and methods · 81807646
      Mark OLESEN authored
      - data_bytes(), size_bytes() methods to support broadcasting or
        gather/scatter content. Additional construct from raw bytes
        to support transmitting content.
      81807646