37 #ifndef MPICH_SKIP_MPICXX 38 #define MPICH_SKIP_MPICXX 40 #ifndef OMPI_SKIP_MPICXX 41 #define OMPI_SKIP_MPICXX 44 #include "kaHIP_interface.h" 69 { kahipDecomp::configs::FAST,
"fast" },
70 { kahipDecomp::configs::ECO,
"eco" },
71 { kahipDecomp::configs::STRONG,
"strong" },
72 { kahipDecomp::configs::FASTSOCIAL,
"fast-social" },
73 { kahipDecomp::configs::ECOSOCIAL,
"eco-social" },
74 { kahipDecomp::configs::STRONGSOCIAL,
"strong-social" },
84 const List<scalar>& cWeights,
90 double imbalance = 0.01;
94 #if WM_LABEL_SIZE == 64 95 if (xadj.size()-1 > INT_MAX)
98 <<
"Cannot decompose " << (xadj.size()-1) <<
" cells," <<
nl 99 <<
"Exceeded integer limit of " << INT_MAX <<
nl 104 int numCells =
Foam::max(0, (xadj.size()-1));
107 ConstPrecisionAdaptor<int, label, List> adjncy_param(adjncy);
108 ConstPrecisionAdaptor<int, label, List> xadj_param(xadj);
111 decomp.resize_nocopy(numCells);
113 PrecisionAdaptor<int, label, List> decomp_param(decomp,
false);
116 labelList adjncy_dummy, xadj_dummy, decomp_dummy;
119 adjncy_dummy.
resize(1, 0);
120 adjncy_param.set(adjncy_dummy);
122 xadj_dummy.resize(2, 0);
123 xadj_param.set(xadj_dummy);
125 decomp_dummy.resize(1, 0);
126 decomp_param.clear();
127 decomp_param.set(decomp_dummy);
136 bool hasWeights = !cWeights.empty();
139 const scalar minWeights = hasWeights ?
min(cWeights) : scalar(1);
145 <<
"Illegal minimum weight " << minWeights
149 else if (hasWeights && (cWeights.size() != numCells))
152 <<
"Number of weights (" << cWeights.size()
153 <<
") != number of cells (" << numCells <<
")" 158 List<int> cellWeights;
163 cellWeights.resize_nocopy(cWeights.size());
166 cellWeights[i] =
static_cast<int> 168 cWeights[i]/minWeights
177 Info<<
"kahipDecomp :" 179 <<
" imbalance=" << imbalance;
183 Info<<
" seed=" << seed;
187 std::map<std::string, std::vector<int>> sizingParams;
196 std::vector<int> vec;
197 vec.reserve(labels.size()+1);
202 for (
const auto val : labels)
215 <<
"Mismatch in number of processors and " 229 sizingParams[
"hierarchy"] = std::move(vec);
240 std::vector<int> vec(labels.size());
247 sizingParams[
"distance"] = std::move(vec);
261 #if 0 // WIP: #ifdef KAFFPA_CPP_INTERFACE 265 (cellWeights.empty() ? nullptr : cellWeights.data()),
266 xadj_param.constCast().data(),
268 adjncy_param.constCast().data(),
275 decomp_param.ref().data(),
282 (cellWeights.empty() ? nullptr : cellWeights.data()),
283 xadj_param.constCast().data(),
285 adjncy_param.constCast().data(),
292 decomp_param.ref().data()
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
label nDomains_
Number of domains for the decomposition.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual label decomposeSerial(const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const
Call kahip with options from dictionary.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val, const bool warnOnly=false) const
Find an entry if present, and assign to T val.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dictionary & coeffsDict_
Coefficients for all derived methods.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
configs
The predefined KaHIP configuration types.
A class for handling words, derived from Foam::string.
static const Enum< configs > configNames
The selection names for predefined KaHIP configurations.
Domain decomposition using METIS-like data structures.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
kahipDecomp(const kahipDecomp &)=delete
No copy construct.
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.