mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Pstream: expose tag
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "PstreamReduceOps.H"
|
||||
#include "OSspecific.H"
|
||||
#include "PstreamGlobals.H"
|
||||
#include "SubList.H"
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
@ -172,7 +173,7 @@ void Foam::UPstream::abort()
|
||||
}
|
||||
|
||||
|
||||
void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
void Foam::reduce(scalar& Value, const sumOp<scalar>& bop, const int tag)
|
||||
{
|
||||
if (Pstream::debug)
|
||||
{
|
||||
@ -205,7 +206,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(slave),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD,
|
||||
MPI_STATUS_IGNORE
|
||||
)
|
||||
@ -231,7 +232,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(UPstream::masterNo()),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD
|
||||
)
|
||||
)
|
||||
@ -262,7 +263,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(slave),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD
|
||||
)
|
||||
)
|
||||
@ -285,7 +286,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(UPstream::masterNo()),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD,
|
||||
MPI_STATUS_IGNORE
|
||||
)
|
||||
@ -337,7 +338,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(childProcId),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD,
|
||||
MPI_STATUS_IGNORE
|
||||
)
|
||||
@ -373,7 +374,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(parentId),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD
|
||||
)
|
||||
)
|
||||
@ -393,7 +394,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(parentId),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD,
|
||||
MPI_STATUS_IGNORE
|
||||
)
|
||||
@ -429,7 +430,7 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
1,
|
||||
MPI_SCALAR,
|
||||
UPstream::procID(childProcId),
|
||||
UPstream::msgType(),
|
||||
tag,
|
||||
MPI_COMM_WORLD
|
||||
)
|
||||
)
|
||||
@ -456,23 +457,45 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
|
||||
}
|
||||
|
||||
|
||||
void Foam::UPstream::waitRequests()
|
||||
Foam::label Foam::UPstream::nRequests()
|
||||
{
|
||||
return PstreamGlobals::outstandingRequests_.size();
|
||||
}
|
||||
|
||||
|
||||
void Foam::UPstream::resetRequests(const label i)
|
||||
{
|
||||
if (i < PstreamGlobals::outstandingRequests_.size())
|
||||
{
|
||||
PstreamGlobals::outstandingRequests_.setSize(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::UPstream::waitRequests(const label start)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UPstream::waitRequests : starting wait for "
|
||||
<< PstreamGlobals::outstandingRequests_.size()
|
||||
<< " outstanding requests." << endl;
|
||||
<< PstreamGlobals::outstandingRequests_.size()-start
|
||||
<< " outstanding requests starting at " << start << endl;
|
||||
}
|
||||
|
||||
if (PstreamGlobals::outstandingRequests_.size())
|
||||
{
|
||||
SubList<MPI_Request> waitRequests
|
||||
(
|
||||
PstreamGlobals::outstandingRequests_,
|
||||
PstreamGlobals::outstandingRequests_.size() - start,
|
||||
start
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
MPI_Waitall
|
||||
(
|
||||
PstreamGlobals::outstandingRequests_.size(),
|
||||
PstreamGlobals::outstandingRequests_.begin(),
|
||||
waitRequests.size(),
|
||||
waitRequests.begin(),
|
||||
MPI_STATUSES_IGNORE
|
||||
)
|
||||
)
|
||||
@ -483,7 +506,7 @@ void Foam::UPstream::waitRequests()
|
||||
) << "MPI_Waitall returned with error" << Foam::endl;
|
||||
}
|
||||
|
||||
PstreamGlobals::outstandingRequests_.clear();
|
||||
resetRequests(start);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
|
||||
Reference in New Issue
Block a user