1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Determines the order in which a set of processors should communicate
31 The communication order should
32 - have maximum overlap
33 - allow blocking communication without deadlock
35 Does a very simple scheduling which assumes same time for all operations.
38 - schedule() gives the order in which the input communication should occur
39 - procSchedule()[procI] gives per procI
41 Does not care whether 'talking' is first send, second receive or maybe
42 full swap. This is all responsability of caller. See ProcessorTopology
43 class for use in scheduling processor boundary swaps.
48 \*---------------------------------------------------------------------------*/
50 #ifndef commSchedule_H
51 #define commSchedule_H
53 #include "DynamicList.H"
54 #include "labelPair.H"
55 #include "labelList.H"
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 /*---------------------------------------------------------------------------*\
63 Class commSchedule Declaration
64 \*---------------------------------------------------------------------------*/
70 //- Order in which input communication has been scheduled
73 //- Per processor the order in which communication has been scheduled
74 labelListList procSchedule_;
76 // Private Member Functions
78 //- Count the number of outstanding communications for a single
80 label outstandingComms(const labelList&, DynamicList<label>&) const;
85 ClassName("commSchedule");
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);
101 //- order in which comms is scheduled
102 const labelList& schedule() const
107 //- Per processor the order in which communication has been scheduled
108 const labelListList& procSchedule() const
110 return procSchedule_;
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 } // End namespace Foam
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 // ************************************************************************* //