source: XIOS/dev/dev_olga/src/node/axis.hpp @ 1099

Last change on this file since 1099 was 1099, checked in by mhnguyen, 7 years ago

Updating 2-level server

+) Make some changes in the way data rebuilt on each level of server
+) Make some changes in the order of functions call during close context to make sure that each server receives the global indexes before calculating index to send to next level
+) Modify some functions to make sure data sent to the correct server pool

Test
+) On Curie
+) Only test_client

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:executable set to *
File size: 7.3 KB
Line 
1#ifndef __XIOS_CAxis__
2#define __XIOS_CAxis__
3
4/// XIOS headers ///
5#include "xios_spl.hpp"
6#include "group_factory.hpp"
7#include "virtual_node.hpp"
8
9#include "declare_group.hpp"
10#include "declare_ref_func.hpp"
11#include "declare_virtual_node.hpp"
12#include "attribute_array.hpp"
13#include "attribute_enum.hpp"
14#include "attribute_enum_impl.hpp"
15#include "server_distribution_description.hpp"
16#include "transformation.hpp"
17#include "transformation_enum.hpp"
18
19namespace xios {
20   /// ////////////////////// Déclarations ////////////////////// ///
21
22   class CAxisGroup;
23   class CAxisAttributes;
24   class CAxis;
25
26   ///--------------------------------------------------------------
27
28   // Declare/Define CAxisAttribute
29   BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis)
30#  include "axis_attribute.conf"
31#  include "axis_attribute_private.conf"
32   END_DECLARE_ATTRIBUTE_MAP(CAxis)
33
34   ///--------------------------------------------------------------
35
36   class CAxis
37      : public CObjectTemplate<CAxis>
38      , public CAxisAttributes
39   {
40               /// typedef ///
41         typedef CObjectTemplate<CAxis>   SuperClass;
42         typedef CAxisAttributes SuperClassAttribute;
43         
44      public :
45         enum EEventId
46         {
47           EVENT_ID_DISTRIBUTION_ATTRIBUTE,
48           EVENT_ID_INDEX,
49           EVENT_ID_DISTRIBUTED_VALUE,
50           EVENT_ID_NON_DISTRIBUTED_VALUE,
51           EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES,
52           EVENT_ID_DISTRIBUTED_ATTRIBUTES
53         } ;
54
55
56
57      public :
58
59         typedef CAxisAttributes RelAttributes;
60         typedef CAxisGroup      RelGroup;
61         typedef CTransformation<CAxis>::TransformationMapTypes TransMapTypes;
62
63      public:
64         /// Constructeurs ///
65         CAxis(void);
66         explicit CAxis(const StdString & id);
67         CAxis(const CAxis & axis);       // Not implemented yet.
68         CAxis(const CAxis * const axis); // Not implemented yet.
69
70         static CAxis* createAxis();
71
72         /// Accesseurs ///
73         const std::set<StdString> & getRelFiles(void) const;
74
75         const std::vector<int>& getIndexesToWrite(void) const;
76         int getNumberWrittenIndexes() const;
77         int getTotalNumberWrittenIndexes() const;
78         int getOffsetWrittenIndexes() const;
79
80         int getStartWriteIndex() const;
81         int getCountWriteIndex() const;
82         int getLocalWriteSize() const;
83         int getGlobalWriteSize() const;
84
85         std::map<int, StdSize> getAttributesBufferSize();
86
87         /// Test ///
88         bool IsWritten(const StdString & filename) const;
89         bool isWrittenCompressed(const StdString& filename) const;
90         bool isDistributed(void) const;
91         bool isCompressible(void) const;
92
93         /// Mutateur ///
94         void addRelFile(const StdString & filename);
95         void addRelFileCompressed(const StdString& filename);
96
97         /// Vérifications ///
98         void checkAttributes(void);
99
100         /// Destructeur ///
101         virtual ~CAxis(void);
102
103         virtual void parse(xml::CXMLNode & node);
104
105         /// Accesseurs statiques ///
106         static StdString GetName(void);
107         static StdString GetDefName(void);
108         static ENodeType GetType(void);
109
110         static bool dispatchEvent(CEventServer& event);
111         static void recvDistributionAttribute(CEventServer& event);
112         void recvDistributionAttribute(CBufferIn& buffer) ;
113         void checkAttributesOnClient();
114         void checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid,
115                                                         CServerDistributionDescription::ServerDistributionType distType = CServerDistributionDescription::BAND_DISTRIBUTION);
116         void sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
117                                    CServerDistributionDescription::ServerDistributionType disType = CServerDistributionDescription::BAND_DISTRIBUTION);
118
119         void checkEligibilityForCompressedOutput();
120
121         bool hasTransformation();
122         void solveInheritanceTransformation();
123         TransMapTypes getAllTransformations();
124         void fillInValues(const CArray<double,1>& values);
125         void duplicateTransformation(CAxis*);
126         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id="");
127
128      public:
129        int zoom_begin_srv, zoom_end_srv, zoom_size_srv;
130        int ni_srv, begin_srv, end_srv;
131        CArray<double,1> value_srv;
132        CArray<double,2> bound_srv;
133        bool hasValue;
134        CArray<int,1> globalDimGrid;
135        int orderPosInGrid;
136
137      private:
138         void checkData();
139         void checkMask();
140         void checkZoom();
141         void checkBounds();         
142         void sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid,
143                             CServerDistributionDescription::ServerDistributionType distType);
144         void sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid,
145                                        CServerDistributionDescription::ServerDistributionType distType);
146         void computeConnectedServer(const std::vector<int>& globalDim, int orderPositionInGrid,
147                                     CServerDistributionDescription::ServerDistributionType distType);
148
149         void sendNonDistributedAttributes(void);
150         void sendDistributedAttributes(void);
151
152         static void recvNonDistributedAttributes(CEventServer& event);
153         static void recvDistributedAttributes(CEventServer& event);
154         void recvNonDistributedAttributes(int rank, CBufferIn& buffer);
155         void recvDistributedAttributes(vector<int>& rank, vector<CBufferIn*> buffers);
156
157         void setTransformations(const TransMapTypes&);
158
159      private:
160         bool isChecked;
161         bool areClientAttributesChecked_;
162         bool isClientAfterTransformationChecked;
163         std::set<StdString> relFiles, relFilesCompressed;
164         TransMapTypes transformationMap_;
165         bool isDistributed_;
166         //! True if and only if the data defined on the axis can be outputted in a compressed way
167         bool isCompressible_;
168         std::map<int,int> nbConnectedClients_; // Mapping of number of communicating client to a server
169         boost::unordered_map<int, vector<size_t> > indSrv_; // Global index of each client sent to server
170         std::map<int, vector<int> > indWrittenSrv_; // Global written index of each client sent to server
171         boost::unordered_map<size_t,size_t> globalLocalIndexMap_;
172         std::vector<int> indexesToWrite;
173         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
174         std::vector<int> connectedServerRank_;
175         std::map<int, CArray<int,1> > indiSrv_;
176         bool hasBounds_;
177
178         int start_write_index_;
179         int count_write_index_;
180         int local_write_size_;
181         int global_write_size_;
182
183         bool doZoomByIndex_;
184
185       private:
186         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m);
187         static std::map<StdString, ETranformationType> transformationMapList_;
188         static bool dummyTransformationMapList_;
189
190         DECLARE_REF_FUNC(Axis,axis)
191   }; // class CAxis
192
193   ///--------------------------------------------------------------
194
195   // Declare/Define CAxisGroup and CAxisDefinition
196   DECLARE_GROUP(CAxis);
197} // namespace xios
198
199#endif // __XIOS_CAxis__
Note: See TracBrowser for help on using the repository browser.