mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: redistributePar blocks with -ioRanks (#3005)
This commit is contained in:
@ -112,7 +112,7 @@ using namespace Foam;
|
|||||||
|
|
||||||
// Use -verbose -verbose to switch on debug info. TBD.
|
// Use -verbose -verbose to switch on debug info. TBD.
|
||||||
int debug(::Foam::debug::debugSwitch("redistributePar", 0));
|
int debug(::Foam::debug::debugSwitch("redistributePar", 0));
|
||||||
#define InfoOrPout (::debug ? Pout : Info())
|
#define InfoOrPout (::debug ? Pout : Info.stream())
|
||||||
|
|
||||||
|
|
||||||
// Allocate a new file handler on valid processors only
|
// Allocate a new file handler on valid processors only
|
||||||
@ -1216,7 +1216,10 @@ int main(int argc, char *argv[])
|
|||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
argList::addBoolOption("decompose", "Decompose case");
|
argList::addBoolOption("decompose", "Decompose case");
|
||||||
argList::addBoolOption("reconstruct", "Reconstruct case");
|
argList::addBoolOption("reconstruct", "Reconstruct case");
|
||||||
argList::addVerboseOption("Additional verbosity");
|
argList::addVerboseOption
|
||||||
|
(
|
||||||
|
"Additional verbosity. (Can be used multiple times for debugging)"
|
||||||
|
);
|
||||||
argList::addDryRunOption
|
argList::addDryRunOption
|
||||||
(
|
(
|
||||||
"Test without writing the decomposition. "
|
"Test without writing the decomposition. "
|
||||||
@ -1267,9 +1270,9 @@ int main(int argc, char *argv[])
|
|||||||
// - reconstruct - reads parallel, write on master only and to parent
|
// - reconstruct - reads parallel, write on master only and to parent
|
||||||
// directory
|
// directory
|
||||||
|
|
||||||
// Detect if running data-distributed (processors cannot see all other
|
// Running data-distributed?
|
||||||
// processors' files)
|
// (processors cannot see all other processors' files)
|
||||||
const bool nfs = !fileHandler().distributed();
|
const bool hasDistributedFiles(fileHandler().distributed());
|
||||||
|
|
||||||
|
|
||||||
// Set up loose processorsXXX directory matching (for collated) so e.g.
|
// Set up loose processorsXXX directory matching (for collated) so e.g.
|
||||||
@ -1278,21 +1281,6 @@ int main(int argc, char *argv[])
|
|||||||
// matching.
|
// matching.
|
||||||
fileOperation::nProcsFilter(0);
|
fileOperation::nProcsFilter(0);
|
||||||
|
|
||||||
|
|
||||||
// Read handler on processors with a volMesh
|
|
||||||
refPtr<fileOperation> volMeshReadHandler;
|
|
||||||
|
|
||||||
// Read handler on processors with an areaMesh
|
|
||||||
refPtr<fileOperation> areaMeshReadHandler;
|
|
||||||
|
|
||||||
// Handler for master-only operation (read/writing from/to undecomposed)
|
|
||||||
refPtr<fileOperation> masterOnlyHandler;
|
|
||||||
if (UPstream::master(UPstream::worldComm))
|
|
||||||
{
|
|
||||||
masterOnlyHandler = fileOperation::NewUncollated();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Need this line since we don't include "setRootCase.H"
|
// Need this line since we don't include "setRootCase.H"
|
||||||
#include "foamDlOpenLibs.H"
|
#include "foamDlOpenLibs.H"
|
||||||
|
|
||||||
@ -1306,19 +1294,36 @@ int main(int argc, char *argv[])
|
|||||||
bool decompose = args.found("decompose");
|
bool decompose = args.found("decompose");
|
||||||
bool overwrite = args.found("overwrite");
|
bool overwrite = args.found("overwrite");
|
||||||
|
|
||||||
if (optVerbose)
|
// Field restrictions...
|
||||||
|
const wordRes selectedFields;
|
||||||
|
const wordRes selectedLagrangianFields;
|
||||||
|
|
||||||
|
|
||||||
|
if (!UPstream::parRun())
|
||||||
{
|
{
|
||||||
if (optVerbose == 2)
|
FatalErrorInFunction
|
||||||
{
|
<< ": This utility can only be run parallel"
|
||||||
WarningInFunction
|
<< exit(FatalError);
|
||||||
<< "-verbose -verbose switches on full debugging"
|
|
||||||
<< nl << endl;
|
|
||||||
::debug = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decompose && reconstruct)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Cannot specify both -decompose and -reconstruct"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (optVerbose)
|
||||||
|
{
|
||||||
// Report on output
|
// Report on output
|
||||||
faMeshDistributor::verbose_ = 1;
|
faMeshDistributor::verbose_ = 1;
|
||||||
parPointFieldDistributor::verbose_ = 1;
|
parPointFieldDistributor::verbose_ = 1;
|
||||||
|
|
||||||
|
if (optVerbose > 1)
|
||||||
|
{
|
||||||
|
Info<< "Additional debugging enabled" << nl << endl;
|
||||||
|
::debug = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable NaN setting and floating point error trapping. This is to avoid
|
// Disable NaN setting and floating point error trapping. This is to avoid
|
||||||
@ -1332,19 +1337,33 @@ int main(int argc, char *argv[])
|
|||||||
// fvMeshDistribute.
|
// fvMeshDistribute.
|
||||||
Foam::sigFpe::unset(true);
|
Foam::sigFpe::unset(true);
|
||||||
|
|
||||||
const wordRes selectedFields;
|
|
||||||
const wordRes selectedLagrangianFields;
|
|
||||||
|
|
||||||
|
// File handlers (read/write)
|
||||||
|
// ==========================
|
||||||
|
|
||||||
|
// Read handler on processors with a volMesh
|
||||||
|
refPtr<fileOperation> volMeshReadHandler;
|
||||||
|
|
||||||
|
// Read handler on processors with an areaMesh
|
||||||
|
refPtr<fileOperation> areaMeshReadHandler;
|
||||||
|
|
||||||
|
// Handler for master-only operation (read/writing from/to undecomposed)
|
||||||
|
// - only the 'real' master, not io-rank masters
|
||||||
|
refPtr<fileOperation> masterOnlyHandler;
|
||||||
|
|
||||||
|
if (UPstream::master(UPstream::worldComm))
|
||||||
|
{
|
||||||
|
const bool oldParRun = UPstream::parRun(false);
|
||||||
|
|
||||||
|
masterOnlyHandler = fileOperation::NewUncollated();
|
||||||
|
|
||||||
|
UPstream::parRun(oldParRun);
|
||||||
|
}
|
||||||
|
|
||||||
if (decompose)
|
if (decompose)
|
||||||
{
|
{
|
||||||
InfoOrPout<< "Decomposing case (like decomposePar)" << nl << endl;
|
InfoOrPout<< "Decomposing case (like decomposePar)"
|
||||||
if (reconstruct)
|
<< nl << endl;
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Cannot specify both -decompose and -reconstruct"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (reconstruct)
|
else if (reconstruct)
|
||||||
{
|
{
|
||||||
@ -1374,19 +1393,13 @@ int main(int argc, char *argv[])
|
|||||||
if ((decompose || reconstruct) && !overwrite)
|
if ((decompose || reconstruct) && !overwrite)
|
||||||
{
|
{
|
||||||
overwrite = true;
|
overwrite = true;
|
||||||
WarningInFunction
|
|
||||||
<< "Working in -decompose or -reconstruct mode:"
|
|
||||||
" automatically implies -overwrite" << nl << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Pstream::parRun())
|
Warning
|
||||||
{
|
<< nl << " "
|
||||||
FatalErrorInFunction
|
<< "Added implicit -overwrite for decompose/reconstruct modes"
|
||||||
<< ": This utility can only be run parallel"
|
<< nl << endl;
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
fileHandler().ioRanks().contains(UPstream::myProcNo())
|
fileHandler().ioRanks().contains(UPstream::myProcNo())
|
||||||
@ -1401,7 +1414,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!nfs)
|
if (hasDistributedFiles)
|
||||||
{
|
{
|
||||||
InfoOrPout<< "Detected multiple roots i.e. non-nfs running"
|
InfoOrPout<< "Detected multiple roots i.e. non-nfs running"
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
@ -1498,7 +1511,7 @@ int main(int argc, char *argv[])
|
|||||||
// This will read the same controlDict but might have a different
|
// This will read the same controlDict but might have a different
|
||||||
// set of times so enforce same times
|
// set of times so enforce same times
|
||||||
|
|
||||||
if (!nfs)
|
if (hasDistributedFiles)
|
||||||
{
|
{
|
||||||
InfoOrPout<< "Creating time directories for undecomposed Time"
|
InfoOrPout<< "Creating time directories for undecomposed Time"
|
||||||
<< " on all processors" << nl << endl;
|
<< " on all processors" << nl << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user