commSchedule.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::commSchedule
26 
27 Description
28  Determines the order in which a set of processors should communicate
29  with one another.
30 
31  The communication order should
32  - have maximum overlap
33  - allow blocking communication without deadlock
34 
35  Does a very simple scheduling which assumes same time for all operations.
36 
37  After construction:
38  - schedule() gives the order in which the input communication should occur
39  - procSchedule()[proci] gives per proci
40 
41  Does not care whether 'talking' is first send, second receive or maybe
42  full swap. This is all responsibility of caller. See ProcessorTopology
43  class for use in scheduling processor boundary swaps.
44 
45 SourceFiles
46  commSchedule.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef commSchedule_H
51 #define commSchedule_H
52 
53 #include "DynamicList.H"
54 #include "labelPair.H"
55 #include "labelList.H"
56 
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 
59 namespace Foam
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class commSchedule Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class commSchedule
67 {
68  // Private Data
69 
70  //- Order in which input communication has been scheduled
71  labelList schedule_;
72 
73  //- Per processor the order in which communication has been scheduled
74  labelListList procSchedule_;
75 
76  // Private Member Functions
77 
78  //- Count the number of outstanding communications for a single
79  // processor
80  label outstandingComms(const labelList&, DynamicList<label>&) const;
81 
82 
83 public:
84 
85  ClassName("commSchedule");
86 
87  // Constructors
88 
89  //- Construct from wanted communication. Wanted communication is between
90  // two processors. Can be a one-way communication or
91  // two-way communication, that is up to the caller. This class just
92  // determines an order for it such that any processor is only talking
93  // to one other at a time. After construction:
94  // - schedule is the order in which comms is done.
95  // - procSchedule[proci] is for proci the order in which comms is done.
96  commSchedule(const label nProcs, const List<labelPair>& comms);
97 
98 
99  // Member Functions
100 
101  //- Order in which comms is scheduled
102  const labelList& schedule() const
103  {
104  return schedule_;
105  }
106 
107  //- Per processor the order in which communication has been scheduled
108  const labelListList& procSchedule() const
109  {
110  return procSchedule_;
111  }
112 
113 
114 };
115 
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 } // End namespace Foam
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 #endif
124 
125 // ************************************************************************* //
Determines the order in which a set of processors should communicate with one another.
Definition: commSchedule.H:66
commSchedule(const label nProcs, const List< labelPair > &comms)
Construct from wanted communication. Wanted communication is between.
Definition: commSchedule.C:66
const labelList & schedule() const
Order in which comms is scheduled.
Definition: commSchedule.H:101
ClassName("commSchedule")
const labelListList & procSchedule() const
Per processor the order in which communication has been scheduled.
Definition: commSchedule.H:107
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59