Loading...
Searching...
No Matches
hostCollatedFileOperation.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2017-2018 OpenFOAM Foundation
9 Copyright (C) 2021-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::fileOperations::hostCollatedFileOperation
29
30Description
31 Version of collatedFileOperation with multiple read/write ranks.
32
33 In parallel it will assume ranks are sorted according to hostname
34 and the lowest rank per hostname will be the IO rank. The output directories
35 will get a unique name processors<N>_<low>-<high> where N is the
36 overall number of processors and low and high is the range of ranks
37 contained in the files. Each of these subsets uses its own communicator.
38
39 Instead of using the hostnames the IO ranks can be assigned using the
40 FOAM_IORANKS environment variable (also when running non-parallel), e.g.
41 when decomposing into 4:
42
43 \verbatim
44 FOAM_IORANKS='(0 2)' decomposePar -fileHandler hostCollated
45 FOAM_IORANKS='0,2' decomposePar -fileHandler hostCollated
46 FOAM_IORANKS='0 2' decomposePar -fileHandler hostCollated
47 \endverbatim
48
49 will generate
50
51 \verbatim
52 processors4_0-1/ : containing data for processors 0 to 1
53 processors4_2-3/ : containing data for processors 2 to 3
54 \endverbatim
55
56Environment
57 - \c FOAM_ENV : list of io-ranks as plain space or comma separated
58 list or as an OpenFOAM formatted list. Eg, '(0 4 8)'
59
60See also
61 Foam::collatedFileOperation
62
63SourceFiles
64 hostCollatedFileOperation.C
65
66\*---------------------------------------------------------------------------*/
67
68#ifndef Foam_fileOperations_hostCollatedFileOperation_H
69#define Foam_fileOperations_hostCollatedFileOperation_H
70
72
73// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74
75namespace Foam
76{
77namespace fileOperations
78{
80/*---------------------------------------------------------------------------*\
81 Class hostCollatedFileOperation Declaration
82\*---------------------------------------------------------------------------*/
83
85:
87{
88 // Private Data
89
90 //- Communicator allocated/managed by us
91 mutable label managedComm_;
92
93
94 // Private Member Functions
95
96 //- Any initialisation steps after constructing
97 void init(bool verbose);
98
99
100public:
101
102 //- Runtime type information
103 TypeName("hostCollated");
105
106 // Constructors
107
108 //- Default construct
109 explicit hostCollatedFileOperation(bool verbose = false);
110
111 //- Construct from communicator with specified io-ranks
113 (
114 const Tuple2<label, labelList>& commAndIORanks,
115 const bool distributedRoots,
116 bool verbose = false
117 );
118
119
120 //- Destructor
122
123
124 // Member Functions
125
126 //- Transfer ownership of communicator to this fileOperation.
127 //- Use with caution
128 virtual void storeComm() const;
129};
130
131
132// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133
134} // End namespace fileOperations
135} // End namespace Foam
136
137// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138
139#endif
140
141// ************************************************************************* //
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition Tuple2.H:51
collatedFileOperation(bool verbose=false)
Default construct.
hostCollatedFileOperation(bool verbose=false)
Default construct.
TypeName("hostCollated")
Runtime type information.
virtual void storeComm() const
Transfer ownership of communicator to this fileOperation. Use with caution.
Namespace for implementations of a fileOperation.
Definition regIOobject.H:60
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68