Changeset 598
- Timestamp:
- 05/26/15 16:13:47 (10 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/client_server_mapping.hpp
r591 r598 41 41 const std::vector<CArray<size_t,1>* >& globalIndexOnServer); 42 42 43 st d::map<int,int> computeConnectedClients(int nbServer, int nbClient,44 MPI_Comm& clientIntraComm,45 const std::vector<int>& connectedServerRank);43 static std::map<int,int> computeConnectedClients(int nbServer, int nbClient, 44 MPI_Comm& clientIntraComm, 45 const std::vector<int>& connectedServerRank); 46 46 47 47 const std::map<int, std::vector<size_t> >& getGlobalIndexOnServer() const; -
XIOS/trunk/src/config/file_attribute.conf
r538 r598 15 15 DECLARE_ENUM2(par_access, collective, independent) 16 16 DECLARE_ATTRIBUTE(bool, append) 17 DECLARE_ENUM2(mode, read, write) 17 18 18 19 // DECLARE_ATTRIBUTE_DEF(bool, enabled, true) -
XIOS/trunk/src/interface/c/iccalendar.cpp
r597 r598 16 16 context->updateCalendar(step); 17 17 context->sendUpdateCalendar(step); 18 context->checkPrefetchingOfEnabledReadModeFiles(); 18 19 CTimer::get("XIOS").suspend(); 19 20 } -
XIOS/trunk/src/interface/c_attr/icfile_attr.cpp
r591 r598 139 139 140 140 141 void cxios_set_file_mode(file_Ptr file_hdl, const char * mode, int mode_size) 142 { 143 std::string mode_str; 144 if (!cstr2string(mode, mode_size, mode_str)) return; 145 CTimer::get("XIOS").resume(); 146 file_hdl->mode.fromString(mode_str); 147 CTimer::get("XIOS").suspend(); 148 } 149 150 void cxios_get_file_mode(file_Ptr file_hdl, char * mode, int mode_size) 151 { 152 CTimer::get("XIOS").resume(); 153 if (!string_copy(file_hdl->mode.getInheritedStringValue(), mode, mode_size)) 154 ERROR("void cxios_get_file_mode(file_Ptr file_hdl, char * mode, int mode_size)", << "Input string is too short"); 155 CTimer::get("XIOS").suspend(); 156 } 157 158 bool cxios_is_defined_file_mode(file_Ptr file_hdl) 159 { 160 CTimer::get("XIOS").resume(); 161 bool isDefined = file_hdl->mode.hasInheritedValue(); 162 CTimer::get("XIOS").suspend(); 163 return isDefined; 164 } 165 166 141 167 void cxios_set_file_name(file_Ptr file_hdl, const char * name, int name_size) 142 168 { -
XIOS/trunk/src/interface/c_attr/icfilegroup_attr.cpp
r591 r598 165 165 166 166 167 void cxios_set_filegroup_mode(filegroup_Ptr filegroup_hdl, const char * mode, int mode_size) 168 { 169 std::string mode_str; 170 if (!cstr2string(mode, mode_size, mode_str)) return; 171 CTimer::get("XIOS").resume(); 172 filegroup_hdl->mode.fromString(mode_str); 173 CTimer::get("XIOS").suspend(); 174 } 175 176 void cxios_get_filegroup_mode(filegroup_Ptr filegroup_hdl, char * mode, int mode_size) 177 { 178 CTimer::get("XIOS").resume(); 179 if (!string_copy(filegroup_hdl->mode.getInheritedStringValue(), mode, mode_size)) 180 ERROR("void cxios_get_filegroup_mode(filegroup_Ptr filegroup_hdl, char * mode, int mode_size)", << "Input string is too short"); 181 CTimer::get("XIOS").suspend(); 182 } 183 184 bool cxios_is_defined_filegroup_mode(filegroup_Ptr filegroup_hdl) 185 { 186 CTimer::get("XIOS").resume(); 187 bool isDefined = filegroup_hdl->mode.hasInheritedValue(); 188 CTimer::get("XIOS").suspend(); 189 return isDefined; 190 } 191 192 167 193 void cxios_set_filegroup_name(filegroup_Ptr filegroup_hdl, const char * name, int name_size) 168 194 { -
XIOS/trunk/src/interface/fortran_attr/file_interface_attr.F90
r581 r598 109 109 110 110 111 SUBROUTINE cxios_set_file_mode(file_hdl, mode, mode_size) BIND(C) 112 USE ISO_C_BINDING 113 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 114 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode 115 INTEGER (kind = C_INT) , VALUE :: mode_size 116 END SUBROUTINE cxios_set_file_mode 117 118 SUBROUTINE cxios_get_file_mode(file_hdl, mode, mode_size) BIND(C) 119 USE ISO_C_BINDING 120 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 121 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode 122 INTEGER (kind = C_INT) , VALUE :: mode_size 123 END SUBROUTINE cxios_get_file_mode 124 125 FUNCTION cxios_is_defined_file_mode(file_hdl) BIND(C) 126 USE ISO_C_BINDING 127 LOGICAL(kind=C_BOOL) :: cxios_is_defined_file_mode 128 INTEGER (kind = C_INTPTR_T), VALUE :: file_hdl 129 END FUNCTION cxios_is_defined_file_mode 130 131 111 132 SUBROUTINE cxios_set_file_name(file_hdl, name, name_size) BIND(C) 112 133 USE ISO_C_BINDING -
XIOS/trunk/src/interface/fortran_attr/filegroup_interface_attr.F90
r581 r598 130 130 131 131 132 SUBROUTINE cxios_set_filegroup_mode(filegroup_hdl, mode, mode_size) BIND(C) 133 USE ISO_C_BINDING 134 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 135 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode 136 INTEGER (kind = C_INT) , VALUE :: mode_size 137 END SUBROUTINE cxios_set_filegroup_mode 138 139 SUBROUTINE cxios_get_filegroup_mode(filegroup_hdl, mode, mode_size) BIND(C) 140 USE ISO_C_BINDING 141 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 142 CHARACTER(kind = C_CHAR) , DIMENSION(*) :: mode 143 INTEGER (kind = C_INT) , VALUE :: mode_size 144 END SUBROUTINE cxios_get_filegroup_mode 145 146 FUNCTION cxios_is_defined_filegroup_mode(filegroup_hdl) BIND(C) 147 USE ISO_C_BINDING 148 LOGICAL(kind=C_BOOL) :: cxios_is_defined_filegroup_mode 149 INTEGER (kind = C_INTPTR_T), VALUE :: filegroup_hdl 150 END FUNCTION cxios_is_defined_filegroup_mode 151 152 132 153 SUBROUTINE cxios_set_filegroup_name(filegroup_hdl, name, name_size) BIND(C) 133 154 USE ISO_C_BINDING -
XIOS/trunk/src/interface/fortran_attr/ifile_attr.F90
r581 r598 12 12 13 13 SUBROUTINE xios(set_file_attr) & 14 ( file_id, append, description, enabled, format, min_digits, name, name_suffix, output_freq &14 ( file_id, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 15 15 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 16 16 … … 25 25 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format 26 26 INTEGER , OPTIONAL, INTENT(IN) :: min_digits 27 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 27 28 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name 28 29 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_suffix … … 37 38 CALL xios(get_file_handle)(file_id,file_hdl) 38 39 CALL xios(set_file_attr_hdl_) & 39 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &40 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 40 41 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 41 42 … … 43 44 44 45 SUBROUTINE xios(set_file_attr_hdl) & 45 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &46 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 46 47 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 47 48 … … 55 56 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format 56 57 INTEGER , OPTIONAL, INTENT(IN) :: min_digits 58 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 57 59 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name 58 60 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_suffix … … 66 68 67 69 CALL xios(set_file_attr_hdl_) & 68 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &70 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 69 71 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 70 72 … … 72 74 73 75 SUBROUTINE xios(set_file_attr_hdl_) & 74 ( file_hdl, append_, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 75 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 76 ( file_hdl, append_, description_, enabled_, format_, min_digits_, mode_, name_, name_suffix_ & 77 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 78 ) 76 79 77 80 IMPLICIT NONE … … 84 87 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: format_ 85 88 INTEGER , OPTIONAL, INTENT(IN) :: min_digits_ 89 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode_ 86 90 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ 87 91 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_suffix_ … … 116 120 ENDIF 117 121 122 IF (PRESENT(mode_)) THEN 123 CALL cxios_set_file_mode(file_hdl%daddr, mode_, len(mode_)) 124 ENDIF 125 118 126 IF (PRESENT(name_)) THEN 119 127 CALL cxios_set_file_name(file_hdl%daddr, name_, len(name_)) … … 155 163 156 164 SUBROUTINE xios(get_file_attr) & 157 ( file_id, append, description, enabled, format, min_digits, name, name_suffix, output_freq &165 ( file_id, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 158 166 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 159 167 … … 168 176 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format 169 177 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits 178 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 170 179 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name 171 180 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_suffix … … 180 189 CALL xios(get_file_handle)(file_id,file_hdl) 181 190 CALL xios(get_file_attr_hdl_) & 182 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &191 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 183 192 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 184 193 … … 186 195 187 196 SUBROUTINE xios(get_file_attr_hdl) & 188 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &197 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 189 198 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 190 199 … … 198 207 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format 199 208 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits 209 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 200 210 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name 201 211 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_suffix … … 209 219 210 220 CALL xios(get_file_attr_hdl_) & 211 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &221 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 212 222 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 213 223 … … 215 225 216 226 SUBROUTINE xios(get_file_attr_hdl_) & 217 ( file_hdl, append_, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 218 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 227 ( file_hdl, append_, description_, enabled_, format_, min_digits_, mode_, name_, name_suffix_ & 228 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 229 ) 219 230 220 231 IMPLICIT NONE … … 227 238 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: format_ 228 239 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits_ 240 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode_ 229 241 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ 230 242 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_suffix_ … … 259 271 ENDIF 260 272 273 IF (PRESENT(mode_)) THEN 274 CALL cxios_get_file_mode(file_hdl%daddr, mode_, len(mode_)) 275 ENDIF 276 261 277 IF (PRESENT(name_)) THEN 262 278 CALL cxios_get_file_name(file_hdl%daddr, name_, len(name_)) … … 298 314 299 315 SUBROUTINE xios(is_defined_file_attr) & 300 ( file_id, append, description, enabled, format, min_digits, name, name_suffix, output_freq &316 ( file_id, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 301 317 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 302 318 … … 314 330 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits 315 331 LOGICAL(KIND=C_BOOL) :: min_digits_tmp 332 LOGICAL, OPTIONAL, INTENT(OUT) :: mode 333 LOGICAL(KIND=C_BOOL) :: mode_tmp 316 334 LOGICAL, OPTIONAL, INTENT(OUT) :: name 317 335 LOGICAL(KIND=C_BOOL) :: name_tmp … … 335 353 CALL xios(get_file_handle)(file_id,file_hdl) 336 354 CALL xios(is_defined_file_attr_hdl_) & 337 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &355 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 338 356 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 339 357 … … 341 359 342 360 SUBROUTINE xios(is_defined_file_attr_hdl) & 343 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &361 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 344 362 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 345 363 … … 356 374 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits 357 375 LOGICAL(KIND=C_BOOL) :: min_digits_tmp 376 LOGICAL, OPTIONAL, INTENT(OUT) :: mode 377 LOGICAL(KIND=C_BOOL) :: mode_tmp 358 378 LOGICAL, OPTIONAL, INTENT(OUT) :: name 359 379 LOGICAL(KIND=C_BOOL) :: name_tmp … … 376 396 377 397 CALL xios(is_defined_file_attr_hdl_) & 378 ( file_hdl, append, description, enabled, format, min_digits, name, name_suffix, output_freq &398 ( file_hdl, append, description, enabled, format, min_digits, mode, name, name_suffix, output_freq & 379 399 , output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 380 400 … … 382 402 383 403 SUBROUTINE xios(is_defined_file_attr_hdl_) & 384 ( file_hdl, append_, description_, enabled_, format_, min_digits_, name_, name_suffix_, output_freq_ & 385 , output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ ) 404 ( file_hdl, append_, description_, enabled_, format_, min_digits_, mode_, name_, name_suffix_ & 405 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ & 406 ) 386 407 387 408 IMPLICIT NONE … … 397 418 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits_ 398 419 LOGICAL(KIND=C_BOOL) :: min_digits__tmp 420 LOGICAL, OPTIONAL, INTENT(OUT) :: mode_ 421 LOGICAL(KIND=C_BOOL) :: mode__tmp 399 422 LOGICAL, OPTIONAL, INTENT(OUT) :: name_ 400 423 LOGICAL(KIND=C_BOOL) :: name__tmp … … 441 464 ENDIF 442 465 466 IF (PRESENT(mode_)) THEN 467 mode__tmp = cxios_is_defined_file_mode(file_hdl%daddr) 468 mode_ = mode__tmp 469 ENDIF 470 443 471 IF (PRESENT(name_)) THEN 444 472 name__tmp = cxios_is_defined_file_name(file_hdl%daddr) -
XIOS/trunk/src/interface/fortran_attr/ifilegroup_attr.F90
r581 r598 12 12 13 13 SUBROUTINE xios(set_filegroup_attr) & 14 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, name, name_suffix &14 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 15 15 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 16 16 … … 26 26 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref 27 27 INTEGER , OPTIONAL, INTENT(IN) :: min_digits 28 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 28 29 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name 29 30 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_suffix … … 38 39 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 39 40 CALL xios(set_filegroup_attr_hdl_) & 40 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &41 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 41 42 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 42 43 … … 44 45 45 46 SUBROUTINE xios(set_filegroup_attr_hdl) & 46 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &47 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 47 48 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 48 49 … … 57 58 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref 58 59 INTEGER , OPTIONAL, INTENT(IN) :: min_digits 60 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode 59 61 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name 60 62 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_suffix … … 68 70 69 71 CALL xios(set_filegroup_attr_hdl_) & 70 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &72 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 71 73 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 72 74 … … 74 76 75 77 SUBROUTINE xios(set_filegroup_attr_hdl_) & 76 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ &77 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ &78 )78 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, mode_, name_ & 79 , name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_ & 80 , type_ ) 79 81 80 82 IMPLICIT NONE … … 88 90 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_ 89 91 INTEGER , OPTIONAL, INTENT(IN) :: min_digits_ 92 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: mode_ 90 93 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_ 91 94 CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_suffix_ … … 124 127 ENDIF 125 128 129 IF (PRESENT(mode_)) THEN 130 CALL cxios_set_filegroup_mode(filegroup_hdl%daddr, mode_, len(mode_)) 131 ENDIF 132 126 133 IF (PRESENT(name_)) THEN 127 134 CALL cxios_set_filegroup_name(filegroup_hdl%daddr, name_, len(name_)) … … 163 170 164 171 SUBROUTINE xios(get_filegroup_attr) & 165 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, name, name_suffix &172 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 166 173 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 167 174 … … 177 184 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref 178 185 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits 186 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 179 187 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name 180 188 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_suffix … … 189 197 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 190 198 CALL xios(get_filegroup_attr_hdl_) & 191 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &199 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 192 200 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 193 201 … … 195 203 196 204 SUBROUTINE xios(get_filegroup_attr_hdl) & 197 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &205 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 198 206 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 199 207 … … 208 216 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref 209 217 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits 218 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode 210 219 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name 211 220 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_suffix … … 219 228 220 229 CALL xios(get_filegroup_attr_hdl_) & 221 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &230 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 222 231 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 223 232 … … 225 234 226 235 SUBROUTINE xios(get_filegroup_attr_hdl_) & 227 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ &228 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ &229 )236 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, mode_, name_ & 237 , name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_ & 238 , type_ ) 230 239 231 240 IMPLICIT NONE … … 239 248 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_ 240 249 INTEGER , OPTIONAL, INTENT(OUT) :: min_digits_ 250 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: mode_ 241 251 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_ 242 252 CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_suffix_ … … 275 285 ENDIF 276 286 287 IF (PRESENT(mode_)) THEN 288 CALL cxios_get_filegroup_mode(filegroup_hdl%daddr, mode_, len(mode_)) 289 ENDIF 290 277 291 IF (PRESENT(name_)) THEN 278 292 CALL cxios_get_filegroup_name(filegroup_hdl%daddr, name_, len(name_)) … … 314 328 315 329 SUBROUTINE xios(is_defined_filegroup_attr) & 316 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, name, name_suffix &330 ( filegroup_id, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 317 331 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 318 332 … … 332 346 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits 333 347 LOGICAL(KIND=C_BOOL) :: min_digits_tmp 348 LOGICAL, OPTIONAL, INTENT(OUT) :: mode 349 LOGICAL(KIND=C_BOOL) :: mode_tmp 334 350 LOGICAL, OPTIONAL, INTENT(OUT) :: name 335 351 LOGICAL(KIND=C_BOOL) :: name_tmp … … 353 369 CALL xios(get_filegroup_handle)(filegroup_id,filegroup_hdl) 354 370 CALL xios(is_defined_filegroup_attr_hdl_) & 355 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &371 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 356 372 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 357 373 … … 359 375 360 376 SUBROUTINE xios(is_defined_filegroup_attr_hdl) & 361 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &377 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 362 378 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 363 379 … … 376 392 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits 377 393 LOGICAL(KIND=C_BOOL) :: min_digits_tmp 394 LOGICAL, OPTIONAL, INTENT(OUT) :: mode 395 LOGICAL(KIND=C_BOOL) :: mode_tmp 378 396 LOGICAL, OPTIONAL, INTENT(OUT) :: name 379 397 LOGICAL(KIND=C_BOOL) :: name_tmp … … 396 414 397 415 CALL xios(is_defined_filegroup_attr_hdl_) & 398 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, name, name_suffix &416 ( filegroup_hdl, append, description, enabled, format, group_ref, min_digits, mode, name, name_suffix & 399 417 , output_freq, output_level, par_access, split_freq, split_freq_format, sync_freq, type ) 400 418 … … 402 420 403 421 SUBROUTINE xios(is_defined_filegroup_attr_hdl_) & 404 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, name_, name_suffix_ &405 , output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_, type_ &406 )422 ( filegroup_hdl, append_, description_, enabled_, format_, group_ref_, min_digits_, mode_, name_ & 423 , name_suffix_, output_freq_, output_level_, par_access_, split_freq_, split_freq_format_, sync_freq_ & 424 , type_ ) 407 425 408 426 IMPLICIT NONE … … 420 438 LOGICAL, OPTIONAL, INTENT(OUT) :: min_digits_ 421 439 LOGICAL(KIND=C_BOOL) :: min_digits__tmp 440 LOGICAL, OPTIONAL, INTENT(OUT) :: mode_ 441 LOGICAL(KIND=C_BOOL) :: mode__tmp 422 442 LOGICAL, OPTIONAL, INTENT(OUT) :: name_ 423 443 LOGICAL(KIND=C_BOOL) :: name__tmp … … 469 489 ENDIF 470 490 491 IF (PRESENT(mode_)) THEN 492 mode__tmp = cxios_is_defined_filegroup_mode(filegroup_hdl%daddr) 493 mode_ = mode__tmp 494 ENDIF 495 471 496 IF (PRESENT(name_)) THEN 472 497 name__tmp = cxios_is_defined_filegroup_name(filegroup_hdl%daddr) -
XIOS/trunk/src/node/context.cpp
r597 r598 253 253 void CContext::setClientServerBuffer() 254 254 { 255 if (hasClient) 256 { 257 size_t bufferSizeMin = 10 * sizeof(size_t) * 1024; 255 size_t bufferSizeMin = 10 * sizeof(size_t) * 1024; 258 256 #define DECLARE_NODE(Name_, name_) \ 259 257 bufferSizeMin = (bufferSizeMin < sizeof(C##Name_##Definition)) ? sizeof(C##Name_##Definition) : bufferSizeMin; 260 258 #define DECLARE_NODE_PAR(Name_, name_) 261 259 #include "node_type.conf" 262 std::map<int, StdSize> bufferSize = getDataSize(); 263 if (bufferSize.empty()) 260 std::map<int, StdSize> bufferSize = getDataSize(); 261 if (bufferSize.empty()) 262 { 263 if (client->isServerLeader()) 264 264 { 265 if (client->isServerLeader()) 266 { 267 const std::list<int>& ranks = client->getRanksServerLeader(); 268 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 269 bufferSize[*itRank] = bufferSizeMin; 270 } 271 else 272 return; 265 const std::list<int>& ranks = client->getRanksServerLeader(); 266 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 267 bufferSize[*itRank] = bufferSizeMin; 273 268 } 274 269 else 275 { 276 std::map<int, StdSize>::iterator it = bufferSize.begin(), 277 ite = bufferSize.end(); 278 for (; it != ite; ++it) 279 it->second = (it->second < bufferSizeMin) ? bufferSizeMin : it->second; 280 } 281 282 client->setBufferSize(bufferSize); 283 } 270 return; 271 } 272 else 273 { 274 std::map<int, StdSize>::iterator it = bufferSize.begin(), 275 ite = bufferSize.end(); 276 for (; it != ite; ++it) 277 it->second = (it->second < bufferSizeMin) ? bufferSizeMin : it->second; 278 } 279 280 client->setBufferSize(bufferSize); 284 281 } 285 282 … … 307 304 } 308 305 client = new CContextClient(this,intraCommClient,interCommClient, cxtClient); 309 // Do something clever instead310 std::map<int, StdSize> bufferSize;311 for (int r = 0; r < client->serverSize; r++)312 bufferSize[r] = 10 * sizeof(size_t) * 1024;313 client->setBufferSize(bufferSize);314 306 } 315 307 … … 363 355 // After xml is parsed, there are some more works with post processing 364 356 postProcessing(); 365 366 setClientServerBuffer(); 367 } 357 } 358 setClientServerBuffer(); 368 359 369 360 if (hasClient && !hasServer) … … 388 379 sendRefGrid(); 389 380 } 390 391 // Now tell server that it can process all messages from client392 if (hasClient && !hasServer) this->sendCloseDefinition();393 381 394 382 // We have a xml tree on the server side and now, it should be also processed … … 403 391 } 404 392 393 // Now tell server that it can process all messages from client 394 if (hasClient && !hasServer) this->sendCloseDefinition(); 405 395 406 396 // Nettoyage de l'arborescence 407 397 if (hasClient && !hasServer) CleanTree(); // Only on client side?? 408 398 409 if (hasClient) sendCreateFileHeader(); 399 if (hasClient) 400 { 401 sendCreateFileHeader(); 402 403 startPrefetchingOfEnabledReadModeFiles(); 404 } 410 405 } 411 406 … … 431 426 { 432 427 this->enabledFiles[i]->buildAllExpressionOfEnabledFields(); 428 } 429 } 430 431 void CContext::startPrefetchingOfEnabledReadModeFiles() 432 { 433 int size = enabledReadModeFiles.size(); 434 for (int i = 0; i < size; ++i) 435 { 436 enabledReadModeFiles[i]->prefetchEnabledReadModeFields(); 437 } 438 } 439 440 void CContext::checkPrefetchingOfEnabledReadModeFiles() 441 { 442 int size = enabledReadModeFiles.size(); 443 for (int i = 0; i < size; ++i) 444 { 445 enabledReadModeFiles[i]->prefetchEnabledReadModeFieldsIfNeeded(); 433 446 } 434 447 } … … 440 453 for (size_t i = 0; i < allFields.size(); ++i) 441 454 { 455 if (allFields[i]->file && !allFields[i]->file->mode.isEmpty() && allFields[i]->file->mode.getValue() == CFile::mode_attr::read) 456 allFields[i]->read_access = true; 442 457 if (!allFields[i]->read_access.isEmpty() && allFields[i]->read_access.getValue()) 443 458 fieldsWithReadAccess.push_back(allFields[i]); … … 501 516 DEBUG(<<"Aucun fichier ne va être sorti dans le contexte nommé \"" 502 517 << getId() << "\" !"); 518 } 519 520 void CContext::findEnabledReadModeFiles(void) 521 { 522 int size = this->enabledFiles.size(); 523 for (int i = 0; i < size; ++i) 524 { 525 if (!enabledFiles[i]->mode.isEmpty() && enabledFiles[i]->mode.getValue() == CFile::mode_attr::read) 526 enabledReadModeFiles.push_back(enabledFiles[i]); 527 } 503 528 } 504 529 … … 717 742 //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 718 743 this->findEnabledFiles(); 744 this->findEnabledReadModeFiles(); 719 745 720 746 // Find all enabled fields of each file … … 734 760 std::map<int, StdSize>& CContext::getDataSize() 735 761 { 762 CFile::mode_attr::t_enum mode = hasClient ? CFile::mode_attr::write : CFile::mode_attr::read; 763 736 764 // Set of grid used by enabled fields 737 765 std::set<StdString> usedGrid; … … 741 769 for (int i = 0; i < numEnabledFiles; ++i) 742 770 { 743 std::vector<CField*> enabledFields = this->enabledFiles[i]->getEnabledFields(); 744 int numEnabledFields = enabledFields.size(); 745 for (int j = 0; j < numEnabledFields; ++j) 771 CFile* file = this->enabledFiles[i]; 772 CFile::mode_attr::t_enum fileMode = file->mode.isEmpty() ? CFile::mode_attr::write : file->mode.getValue(); 773 774 if (fileMode == mode) 746 775 { 747 // const std::pair<StdString, StdString>& prDomAxisId = enabledFields[j]->getDomainAxisIds(); 748 StdString currentGrid = enabledFields[j]->grid->getId(); 749 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataSize(); 750 if (dataSize_.empty()) 776 std::vector<CField*> enabledFields = file->getEnabledFields(); 777 int numEnabledFields = enabledFields.size(); 778 for (int j = 0; j < numEnabledFields; ++j) 751 779 { 752 dataSize_ = mapSize; 753 usedGrid.insert(currentGrid); 754 // domainIds.insert(prDomAxisId.first); 755 } 756 else 757 { 758 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 759 if (usedGrid.find(currentGrid) == usedGrid.end()) 780 StdString currentGrid = enabledFields[j]->grid->getId(); 781 const std::map<int, StdSize> mapSize = enabledFields[j]->getGridDataSize(); 782 if (dataSize_.empty()) 760 783 { 761 for (; it != itE; ++it) 784 dataSize_ = mapSize; 785 usedGrid.insert(currentGrid); 786 } 787 else 788 { 789 std::map<int, StdSize>::const_iterator it = mapSize.begin(), itE = mapSize.end(); 790 if (usedGrid.find(currentGrid) == usedGrid.end()) 762 791 { 763 if (0 < dataSize_.count(it->first)) dataSize_[it->first] += it->second;764 else dataSize_.insert(make_pair(it->first, it->second));765 }766 } else767 {768 for (; it != itE; ++it)792 for (; it != itE; ++it) 793 { 794 if (0 < dataSize_.count(it->first)) dataSize_[it->first] += it->second; 795 else dataSize_.insert(make_pair(it->first, it->second)); 796 } 797 } else 769 798 { 770 if (0 < dataSize_.count(it->first)) 771 if (CXios::isOptPerformance) dataSize_[it->first] += it->second; 772 else 773 { 774 if (dataSize_[it->first] < it->second) dataSize_[it->first] = it->second; 775 } 776 else dataSize_.insert(make_pair(it->first, it->second)); 799 for (; it != itE; ++it) 800 { 801 if (0 < dataSize_.count(it->first)) 802 if (CXios::isOptPerformance) dataSize_[it->first] += it->second; 803 else 804 { 805 if (dataSize_[it->first] < it->second) dataSize_[it->first] = it->second; 806 } 807 else dataSize_.insert(make_pair(it->first, it->second)); 808 } 777 809 } 778 810 } -
XIOS/trunk/src/node/context.hpp
r597 r598 105 105 void solveAllInheritance(bool apply=true); 106 106 void findEnabledFiles(void); 107 void findEnabledReadModeFiles(void); 107 108 void closeAllFile(void); 108 109 void updateCalendar(int step); … … 110 111 void solveAllRefOfEnabledFields(bool sendToServer); 111 112 void buildAllExpressionOfEnabledFields(); 113 void startPrefetchingOfEnabledReadModeFiles(); 114 void checkPrefetchingOfEnabledReadModeFiles(); 112 115 void findFieldsWithReadAccess(void); 113 116 void solveAllRefOfFieldsWithReadAccess(); … … 187 190 boost::shared_ptr<CCalendar> calendar; 188 191 189 // List of all enabled files (files on which fields are written )192 // List of all enabled files (files on which fields are written or read) 190 193 std::vector<CFile*> enabledFiles; 194 // List of all enabled files in read mode (files on which fields are read) 195 std::vector<CFile*> enabledReadModeFiles; 191 196 192 197 // List of all fields whose instant data is accessible from the public API -
XIOS/trunk/src/node/field.cpp
r595 r598 28 28 , active(false) , hasOutputFile(false),hasFieldOut(false), slotUpdateDate(NULL) 29 29 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 30 , isReadDataRequestPending(false) 30 31 { setVirtualVariableGroup(); } 31 32 … … 40 41 , active(false), hasOutputFile(false), hasFieldOut(false), slotUpdateDate(NULL) 41 42 , processed(false), domAxisIds_("", ""), areAllReferenceSolved(false), areAllExpressionBuilt(false) 43 , isReadDataRequestPending(false) 42 44 { setVirtualVariableGroup(); } 43 45 … … 112 114 } 113 115 114 bool CField::dispatchEvent(CEventServer& event) 115 { 116 116 bool CField::dispatchEvent(CEventServer& event) 117 { 117 118 if (SuperClass::dispatchEvent(event)) return true; 118 119 else … … 125 126 break; 126 127 127 case EVENT_ID_ADD_VARIABLE : 128 recvAddVariable(event); 129 return true; 130 break; 131 132 case EVENT_ID_ADD_VARIABLE_GROUP : 133 recvAddVariableGroup(event); 134 return true; 135 break; 128 case EVENT_ID_READ_DATA : 129 recvReadDataRequest(event); 130 return true; 131 break; 132 133 case EVENT_ID_READ_DATA_READY : 134 recvReadDataReady(event); 135 return true; 136 break; 137 138 case EVENT_ID_ADD_VARIABLE : 139 recvAddVariable(event); 140 return true; 141 break; 142 143 case EVENT_ID_ADD_VARIABLE_GROUP : 144 recvAddVariableGroup(event); 145 return true; 146 break; 136 147 137 148 default : … … 263 274 } 264 275 } 276 } 277 278 void CField::sendReadDataRequest(void) 279 { 280 CContext* context = CContext::getCurrent(); 281 CContextClient* client = context->client; 282 283 CEventClient event(getType(), EVENT_ID_READ_DATA); 284 if (client->isServerLeader()) 285 { 286 CMessage msg; 287 msg << getId(); 288 const std::list<int>& ranks = client->getRanksServerLeader(); 289 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 290 event.push(*itRank, 1, msg); 291 client->sendEvent(event); 292 } 293 else client->sendEvent(event); 294 295 lastDataRequestedFromServer = context->getCalendar()->getCurrentDate(); 296 isReadDataRequestPending = true; 297 } 298 299 /*! 300 Send request new data read from file if need be, that is the current data is out-of-date. 301 \return true if and only if some data was requested 302 */ 303 bool CField::sendReadDataRequestIfNeeded(void) 304 { 305 const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); 306 307 bool requestData = (currentDate >= lastDataRequestedFromServer + file->output_freq.getValue()); 308 309 if (requestData) 310 sendReadDataRequest(); 311 312 return requestData; 313 } 314 315 void CField::recvReadDataRequest(CEventServer& event) 316 { 317 CBufferIn* buffer = event.subEvents.begin()->buffer; 318 StdString fieldId; 319 *buffer >> fieldId; 320 get(fieldId)->recvReadDataRequest(); 321 } 322 323 void CField::recvReadDataRequest(void) 324 { 325 CContext* context = CContext::getCurrent(); 326 CContextClient* client = context->client; 327 328 CEventClient event(getType(), EVENT_ID_READ_DATA_READY); 329 std::list<CMessage> msgs; 330 331 // TODO: Read the data from the file 332 if (data_srv.empty()) 333 { 334 for (map<int, CArray<size_t, 1>* >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 335 data_srv.insert( pair<int, CArray<double,1>* >(it->first, new CArray<double,1>(it->second->numElements()))); 336 } 337 338 map<int, CArray<double,1>* >::iterator it; 339 for (it = data_srv.begin(); it != data_srv.end(); it++) 340 { 341 msgs.push_back(CMessage()); 342 CMessage& msg = msgs.back(); 343 msg << getId() << getNStep() << *it->second; 344 event.push(it->first, grid->nbSenders[it->first], msg); 345 } 346 client->sendEvent(event); 347 348 incrementNStep(); 349 } 350 351 void CField::recvReadDataReady(CEventServer& event) 352 { 353 string fieldId; 354 vector<int> ranks; 355 vector<CBufferIn*> buffers; 356 357 list<CEventServer::SSubEvent>::iterator it; 358 for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) 359 { 360 ranks.push_back(it->rank); 361 CBufferIn* buffer = it->buffer; 362 *buffer >> fieldId; 363 buffers.push_back(buffer); 364 } 365 get(fieldId)->recvReadDataReady(ranks, buffers); 366 } 367 368 void CField::recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers) 369 { 370 CContext* context = CContext::getCurrent(); 371 StdSize record; 372 for (int i = 0; i < ranks.size(); i++) 373 { 374 int rank = ranks[i]; 375 CArray<int,1>& index = *grid->storeIndex_toSrv[rank]; 376 CArray<double,1> data_tmp(index.numElements()); 377 *buffers[i] >> record >> data_tmp; 378 379 for (int n = 0; n < data_tmp.numElements(); n++) 380 instantData(index(n)) = data_tmp(n); 381 } 382 383 for (list< pair<CField*, int> >::iterator it = fieldDependency.begin(); it != fieldDependency.end(); ++it) 384 it->first->setSlot(it->second); 385 386 if (!hasExpression) // Should be always true ? 387 { 388 const std::vector<CField*>& refField = getAllReference(); 389 std::vector<CField*>::const_iterator it = refField.begin(), end = refField.end(); 390 391 for (; it != end; it++) (*it)->setDataFromExpression(instantData); 392 if (hasFieldOut) updateDataFromExpression(instantData); 393 } 394 395 isReadDataRequestPending = false; 265 396 } 266 397 … … 477 608 const CDuration toffset = this->freq_operation - freq_offset.getValue() - context->getCalendar()->getTimeStep(); 478 609 *this->last_operation = *this->last_operation - toffset; 610 611 lastDataRequestedFromServer.setRelCalendar(*context->getCalendar()); 479 612 480 613 if (operation.get() == "once") isOnceOperation = true; -
XIOS/trunk/src/node/field.hpp
r593 r598 54 54 enum EEventId 55 55 { 56 EVENT_ID_UPDATE_DATA, EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP 56 EVENT_ID_UPDATE_DATA, EVENT_ID_READ_DATA, EVENT_ID_READ_DATA_READY, 57 EVENT_ID_ADD_VARIABLE, EVENT_ID_ADD_VARIABLE_GROUP 57 58 } ; 58 59 … … 133 134 void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ; 134 135 void writeField(void) ; 136 void sendReadDataRequest(void); 137 bool sendReadDataRequestIfNeeded(void); 138 static void recvReadDataRequest(CEventServer& event); 139 void recvReadDataRequest(void); 140 static void recvReadDataReady(CEventServer& event); 141 void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers); 135 142 void outputField(CArray<double,3>& fieldOut) ; 136 143 void outputField(CArray<double,2>& fieldOut) ; … … 172 179 boost::shared_ptr<CDate> last_Write, last_operation; 173 180 boost::shared_ptr<CDate> lastlast_Write_srv,last_Write_srv, last_operation_srv; 181 CDate lastDataRequestedFromServer; 174 182 175 183 boost::shared_ptr<func::CFunctor> foperation; … … 198 206 bool areAllExpressionBuilt; 199 207 std::pair<StdString,StdString> domAxisIds_; 208 bool isReadDataRequestPending; 200 209 DECLARE_REF_FUNC(Field,field) 201 210 // public: -
XIOS/trunk/src/node/field_impl.hpp
r593 r598 184 184 if (!read_access.isEmpty() && read_access.getValue() && hasInstantData) 185 185 { 186 CContext* context = CContext::getCurrent(); 187 const CDate& currentDate = context->getCalendar()->getCurrentDate(); 188 189 while (isReadDataRequestPending) 190 context->checkBuffersAndListen(); 191 186 192 grid->outputField(instantData, _data); 187 193 } -
XIOS/trunk/src/node/file.cpp
r595 r598 517 517 } 518 518 519 /*! 520 Prefetching the data for enabled fields read from file. 521 */ 522 void CFile::prefetchEnabledReadModeFields(void) 523 { 524 if (mode.isEmpty() || mode.getValue() != mode_attr::read) 525 return; 526 527 int size = this->enabledFields.size(); 528 for (int i = 0; i < size; ++i) 529 this->enabledFields[i]->sendReadDataRequest(); 530 } 531 532 /*! 533 Prefetching the data for enabled fields read from file whose data is out-of-date. 534 */ 535 void CFile::prefetchEnabledReadModeFieldsIfNeeded(void) 536 { 537 if (mode.isEmpty() || mode.getValue() != mode_attr::read) 538 return; 539 540 int size = this->enabledFields.size(); 541 for (int i = 0; i < size; ++i) 542 this->enabledFields[i]->sendReadDataRequestIfNeeded(); 543 } 544 519 545 void CFile::solveFieldRefInheritance(bool apply) 520 546 { -
XIOS/trunk/src/node/file.hpp
r591 r598 105 105 void solveAllRefOfEnabledFields(bool sendToServer); 106 106 void buildAllExpressionOfEnabledFields(); 107 void prefetchEnabledReadModeFields(); 108 void prefetchEnabledReadModeFieldsIfNeeded(); 107 109 108 110 // Add component into file -
XIOS/trunk/src/node/grid.cpp
r595 r598 669 669 void CGrid::recvIndex(CEventServer& event) 670 670 { 671 list<CEventServer::SSubEvent>::iterator it ; 671 string gridId; 672 vector<int> ranks; 673 vector<CBufferIn*> buffers; 674 675 list<CEventServer::SSubEvent>::iterator it; 672 676 for (it=event.subEvents.begin();it!=event.subEvents.end();++it) 673 677 { 674 int rank=it->rank;675 CBufferIn* buffer =it->buffer;676 string gridId;677 *buffer>>gridId;678 get(gridId)->recvIndex(rank,*buffer) ;679 }678 ranks.push_back(it->rank); 679 CBufferIn* buffer = it->buffer; 680 *buffer >> gridId; 681 buffers.push_back(buffer); 682 } 683 get(gridId)->recvIndex(ranks, buffers) ; 680 684 } 681 685 … … 748 752 } 749 753 750 void CGrid::recvIndex(int rank, CBufferIn& buffer) 751 { 752 CContext* context = CContext::getCurrent() ; 753 CContextServer* server=context->server ; 754 buffer>>isDataDistributed_; 755 size_t dataSize = 0; 756 757 if (true == scalar_grid) 758 { 759 writtenDataSize_ = 1; 760 CArray<size_t,1> outIndex; 761 buffer>>outIndex; 762 outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex))); 763 std::vector<int> nZoomBegin(1,0), nZoomSize(1,1), nGlob(1,1), nZoomBeginGlobal(1,0); 764 serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 765 nZoomBeginGlobal, nGlob); 766 return; 767 } 768 769 770 if (0 == serverDistribution_) 771 { 772 int idx = 0, numElement = axis_domain_order.numElements(); 773 int ssize = numElement; 774 std::vector<int> indexMap(numElement); 775 for (int i = 0; i < numElement; ++i) 776 { 777 indexMap[i] = idx; 778 if (true == axis_domain_order(i)) 779 { 754 void CGrid::recvIndex(vector<int> ranks, vector<CBufferIn*> buffers) 755 { 756 CContext* context = CContext::getCurrent(); 757 CContextServer* server = context->server; 758 759 for (int n = 0; n < ranks.size(); n++) 760 { 761 int rank = ranks[n]; 762 CBufferIn& buffer = *buffers[n]; 763 764 buffer >> isDataDistributed_; 765 size_t dataSize = 0; 766 767 if (true == scalar_grid) 768 { 769 writtenDataSize_ = 1; 770 CArray<size_t,1> outIndex; 771 buffer >> outIndex; 772 outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex))); 773 std::vector<int> nZoomBegin(1,0), nZoomSize(1,1), nGlob(1,1), nZoomBeginGlobal(1,0); 774 serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 775 nZoomBeginGlobal, nGlob); 776 return; 777 } 778 779 if (0 == serverDistribution_) 780 { 781 int idx = 0, numElement = axis_domain_order.numElements(); 782 int ssize = numElement; 783 std::vector<int> indexMap(numElement); 784 for (int i = 0; i < numElement; ++i) 785 { 786 indexMap[i] = idx; 787 if (true == axis_domain_order(i)) 788 { 780 789 ++ssize; 781 790 idx += 2; 782 }783 else784 ++idx;785 }786 787 int axisId = 0, domainId = 0;788 std::vector<CDomain*> domainList = getDomains();789 std::vector<CAxis*> axisList = getAxis();790 std::vector<int> nZoomBegin(ssize), nZoomSize(ssize), nGlob(ssize), nZoomBeginGlobal(ssize);791 for (int i = 0; i < numElement; ++i)792 {793 if (axis_domain_order(i))794 {795 nZoomBegin[indexMap[i]] 796 nZoomSize[indexMap[i]] 791 } 792 else 793 ++idx; 794 } 795 796 int axisId = 0, domainId = 0; 797 std::vector<CDomain*> domainList = getDomains(); 798 std::vector<CAxis*> axisList = getAxis(); 799 std::vector<int> nZoomBegin(ssize), nZoomSize(ssize), nGlob(ssize), nZoomBeginGlobal(ssize); 800 for (int i = 0; i < numElement; ++i) 801 { 802 if (axis_domain_order(i)) 803 { 804 nZoomBegin[indexMap[i]] = domainList[domainId]->zoom_ibegin_srv; 805 nZoomSize[indexMap[i]] = domainList[domainId]->zoom_ni_srv; 797 806 nZoomBeginGlobal[indexMap[i]] = domainList[domainId]->zoom_ibegin; 798 nGlob[indexMap[i]] 799 800 nZoomBegin[indexMap[i] +1] = domainList[domainId]->zoom_jbegin_srv;801 nZoomSize[indexMap[i] +1]= domainList[domainId]->zoom_nj_srv;802 nZoomBeginGlobal[indexMap[i] +1] = domainList[domainId]->zoom_jbegin;803 nGlob[indexMap[i] +1]= domainList[domainId]->nj_glo;807 nGlob[indexMap[i]] = domainList[domainId]->ni_glo; 808 809 nZoomBegin[indexMap[i] + 1] = domainList[domainId]->zoom_jbegin_srv; 810 nZoomSize[indexMap[i] + 1] = domainList[domainId]->zoom_nj_srv; 811 nZoomBeginGlobal[indexMap[i] + 1] = domainList[domainId]->zoom_jbegin; 812 nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 804 813 ++domainId; 805 }806 else807 {814 } 815 else 816 { 808 817 nZoomBegin[indexMap[i]] = axisList[axisId]->zoom_begin_srv; 809 818 nZoomSize[indexMap[i]] = axisList[axisId]->zoom_size_srv; 810 819 nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->zoom_begin; 811 nGlob[indexMap[i]] 820 nGlob[indexMap[i]] = axisList[axisId]->size; 812 821 ++axisId; 813 } 814 } 815 dataSize = 1; 816 for (int i = 0; i < nZoomSize.size(); ++i) 817 dataSize *= nZoomSize[i]; 818 819 serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 820 nZoomBeginGlobal, nGlob); 821 } 822 823 CArray<size_t,1> outIndex; 824 buffer>>outIndex; 825 if (isDataDistributed_) 826 serverDistribution_->computeLocalIndex(outIndex); 827 else 828 { 829 dataSize = outIndex.numElements(); 830 for (int i = 0; i < outIndex.numElements(); ++i) outIndex(i) = i; 831 } 832 writtenDataSize_ += dataSize; 833 834 outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex))); 822 } 823 } 824 dataSize = 1; 825 for (int i = 0; i < nZoomSize.size(); ++i) 826 dataSize *= nZoomSize[i]; 827 828 serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 829 nZoomBeginGlobal, nGlob); 830 } 831 832 CArray<size_t,1> outIndex; 833 buffer >> outIndex; 834 if (isDataDistributed_) 835 serverDistribution_->computeLocalIndex(outIndex); 836 else 837 { 838 dataSize = outIndex.numElements(); 839 for (int i = 0; i < outIndex.numElements(); ++i) outIndex(i) = i; 840 } 841 writtenDataSize_ += dataSize; 842 843 outIndexFromClient.insert(std::pair<int, CArray<size_t,1>* >(rank, new CArray<size_t,1>(outIndex))); 844 connectedDataSize_[rank] = outIndex.numElements(); 845 } 846 847 nbSenders = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 835 848 } 836 849 -
XIOS/trunk/src/node/grid.hpp
r593 r598 157 157 void outputFieldToServer(CArray<double,1>& fieldIn, int rank, CArray<double,1>& fieldOut) ; 158 158 static void recvIndex(CEventServer& event) ; 159 void recvIndex( int rank, CBufferIn& buffer) ;159 void recvIndex(vector<int> ranks, vector<CBufferIn*> buffers) ; 160 160 void sendIndex(void) ; 161 161 void sendIndexScalarGrid();
Note: See TracChangeset
for help on using the changeset viewer.