34 namespace fileOperations
40 hostCollatedFileOperation,
48 fileOperationInitialise,
49 hostCollatedFileOperationInitialise,
59 Foam::labelList Foam::fileOperations::hostCollatedFileOperation::subRanks
64 DynamicList<label> subRanks(64);
66 string ioRanksString(
getEnv(
"FOAM_IORANKS"));
67 if (!ioRanksString.empty())
69 IStringStream is(ioRanksString);
75 <<
"Rank 0 (master) should be in the IO ranks. Currently " 80 PackedBoolList isIOrank(n);
81 isIOrank.set(ioRanks);
88 subRanks.append(proci);
92 rank < n && !isIOrank[rank];
96 subRanks.append(rank);
105 const string myHostName(
hostName());
115 if (hosts[proci] == myHostName)
117 subRanks.append(proci);
122 return move(subRanks);
158 if (!ioRanks[proci].empty())
160 Info<<
" " << ioRanks[proci] <<
endl;
string getEnv(const word &)
Return environment variable of given name.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
static label worldComm
Default communicator (all processors)
Macros for easy insertion into run-time selection tables.
addNamedToRunTimeSelectionTable(fileOperationInitialise, collatedFileOperationInitialise, word, collated)
addToRunTimeSelectionTable(fileOperation, collatedFileOperation, word)
string hostName(const bool full=false)
Return the system's host name, as per hostname(1)
List< label > labelList
A List of labels.
pid_t pid()
Return the PID of this process.
hostCollatedFileOperation(const bool verbose)
Construct null.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
word name(const complex &)
Return a string representation of a complex.
List< string > stringList
A List of strings.
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Version of masterUncollatedFileOperation that collates regIOobjects into a container in the processor...
virtual ~hostCollatedFileOperation()
Destructor.
defineTypeNameAndDebug(collatedFileOperation, 0)
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.