Changeset 1646 for XIOS/dev/dev_trunk_omp/src/node/context.cpp
- Timestamp:
- 01/31/19 12:12:52 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/src/node/context.cpp
r1628 r1646 21 21 #include "distribute_file_server2.hpp" 22 22 23 #ifdef _usingEP 23 24 using namespace ep_lib; 25 #endif 24 26 25 27 namespace xios { … … 35 37 , idServer_(), client(0), server(0) 36 38 , allProcessed(false), countChildCtx_(0) 39 37 40 { /* Ne rien faire de plus */ } 38 41 … … 67 70 */ 68 71 CContextGroup* CContext::getRoot(void) 72 TRY 69 73 { 70 74 if(root_ptr == 0) root_ptr = new std::shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())); 71 75 return root_ptr->get(); 72 76 } 77 CATCH 73 78 74 79 //---------------------------------------------------------------- … … 79 84 */ 80 85 std::shared_ptr<CCalendar> CContext::getCalendar(void) const 86 TRY 81 87 { 82 88 return (this->calendar); 83 89 } 90 CATCH 84 91 85 92 //---------------------------------------------------------------- … … 90 97 */ 91 98 void CContext::setCalendar(std::shared_ptr<CCalendar> newCalendar) 99 TRY 92 100 { 93 101 this->calendar = newCalendar; 94 102 } 103 CATCH_DUMP_ATTR 95 104 96 105 //---------------------------------------------------------------- … … 100 109 */ 101 110 void CContext::parse(xml::CXMLNode & node) 111 TRY 102 112 { 103 113 CContext::SuperClass::parse(node); … … 154 164 } 155 165 } 166 CATCH_DUMP_ATTR 156 167 157 168 //---------------------------------------------------------------- 158 169 //! Show tree structure of context 159 170 void CContext::ShowTree(StdOStream & out) 171 TRY 160 172 { 161 173 StdString currentContextId = CContext::getCurrent() -> getId(); … … 178 190 CContext::setCurrent(currentContextId); 179 191 } 180 192 CATCH 181 193 182 194 //---------------------------------------------------------------- … … 184 196 //! Convert context object into string (to print) 185 197 StdString CContext::toString(void) const 198 TRY 186 199 { 187 200 StdOStringStream oss; … … 203 216 204 217 } 205 206 218 oss << "</" << CContext::GetName() << " >"; 207 208 219 return (oss.str()); 209 220 } 221 CATCH 210 222 211 223 //---------------------------------------------------------------- … … 218 230 */ 219 231 void CContext::solveDescInheritance(bool apply, const CAttributeMap * const UNUSED(parent)) 232 TRY 220 233 { 221 234 #define DECLARE_NODE(Name_, name_) \ … … 225 238 #include "node_type.conf" 226 239 } 240 CATCH_DUMP_ATTR 227 241 228 242 //---------------------------------------------------------------- … … 230 244 //! Verify if all root definition in the context have child. 231 245 bool CContext::hasChild(void) const 246 TRY 232 247 { 233 248 return ( … … 238 253 false); 239 254 } 255 CATCH 240 256 241 257 //---------------------------------------------------------------- 242 258 243 259 void CContext::CleanTree(void) 260 TRY 244 261 { 245 262 #define DECLARE_NODE(Name_, name_) C##Name_##Definition::ClearAllAttributes(); … … 247 264 #include "node_type.conf" 248 265 } 266 CATCH 267 249 268 ///--------------------------------------------------------------- 250 269 251 270 //! Initialize client side 252 271 void CContext::initClient(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtServer /*= 0*/) 272 TRY 253 273 { 254 274 … … 299 319 } 300 320 } 321 CATCH_DUMP_ATTR 301 322 302 323 /*! … … 307 328 */ 308 329 void CContext::setClientServerBuffer(CContextClient* contextClient, bool bufferForWriting) 330 TRY 309 331 { 310 332 // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) … … 353 375 } 354 376 contextClient->setBufferSize(bufferSize, maxEventSize); 355 356 }377 } 378 CATCH_DUMP_ATTR 357 379 358 380 //! Verify whether a context is initialized 359 381 bool CContext::isInitialized(void) 382 TRY 360 383 { 361 384 return hasClient; 362 385 } 386 CATCH_DUMP_ATTR 363 387 364 388 void CContext::initServer(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtClient /*= 0*/) 389 TRY 365 390 { 366 391 hasServer=true; … … 395 420 client = new CContextClient(this,intraCommClient,interCommClient, cxtClient); 396 421 } 422 CATCH_DUMP_ATTR 397 423 398 424 //! Try to send the buffers and receive possible answers 399 425 bool CContext::checkBuffersAndListen(bool enableEventsProcessing /*= true*/) 426 TRY 400 427 { 401 428 bool clientReady, serverFinished; … … 435 462 } 436 463 } 464 CATCH_DUMP_ATTR 437 465 438 466 //! Terminate a context 439 467 void CContext::finalize(void) 468 TRY 440 469 { 441 470 if (hasClient && !hasServer) // For now we only use server level 1 to read data … … 481 510 482 511 #pragma omp critical (_output) 483 info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 512 { 513 info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 514 } 484 515 } 485 516 } … … 497 528 // Blocking send of context finalize message to its client (e.g. primary server or model) 498 529 #pragma omp critical (_output) 499 info(100)<<"DEBUG: context "<<getId()<<" Send client finalize<<"<<endl ; 530 { 531 info(100)<<"DEBUG: context "<<getId()<<" Send client finalize<<"<<endl ; 532 } 500 533 client->finalize(); 501 534 bool bufferReleased; … … 525 558 526 559 #pragma omp critical (_output) 527 info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 560 { 561 info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 562 } 528 563 } 529 564 … … 531 566 } 532 567 } 568 CATCH_DUMP_ATTR 533 569 534 570 //! Free internally allocated communicators 535 571 void CContext::freeComms(void) 572 TRY 536 573 { 537 574 for (std::list<ep_lib::MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it) … … 539 576 comms.clear(); 540 577 } 578 CATCH_DUMP_ATTR 541 579 542 580 //! Deallocate buffers allocated by clientContexts 543 581 void CContext::releaseClientBuffers(void) 582 TRY 544 583 { 545 584 client->releaseBuffers(); … … 547 586 clientPrimServer[i]->releaseBuffers(); 548 587 } 588 CATCH_DUMP_ATTR 549 589 550 590 void CContext::postProcessingGlobalAttributes() 591 TRY 551 592 { 552 593 if (allProcessed) return; … … 612 653 allProcessed = true; 613 654 } 655 CATCH_DUMP_ATTR 614 656 615 657 void CContext::sendPostProcessingGlobalAttributes() 658 TRY 616 659 { 617 660 // Use correct context client to send message … … 638 681 } 639 682 } 683 CATCH_DUMP_ATTR 640 684 641 685 void CContext::recvPostProcessingGlobalAttributes(CEventServer& event) 686 TRY 642 687 { 643 688 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 646 691 get(id)->recvPostProcessingGlobalAttributes(*buffer); 647 692 } 693 CATCH 648 694 649 695 void CContext::recvPostProcessingGlobalAttributes(CBufferIn& buffer) 696 TRY 650 697 { 651 698 postProcessingGlobalAttributes(); 652 699 } 700 CATCH_DUMP_ATTR 653 701 654 702 /*! … … 661 709 and the active fields (fields will be written onto active files) 662 710 */ 711 663 712 void CContext::closeDefinition(void) 713 TRY 664 714 { 665 715 CTimer::get("Context : close definition").resume() ; … … 692 742 CTimer::get("Context : close definition").suspend() ; 693 743 } 744 CATCH_DUMP_ATTR 694 745 695 746 void CContext::findAllEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 747 TRY 696 748 { 697 749 for (unsigned int i = 0; i < activeFiles.size(); i++) 698 750 (void)activeFiles[i]->getEnabledFields(); 699 751 } 752 CATCH_DUMP_ATTR 700 753 701 754 void CContext::readAttributesOfEnabledFieldsInReadModeFiles() 755 TRY 702 756 { 703 757 for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) 704 758 (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); 705 759 } 760 CATCH_DUMP_ATTR 706 761 707 762 void CContext::sendGridComponentEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 763 TRY 708 764 { 709 765 int size = activeFiles.size(); … … 713 769 } 714 770 } 771 CATCH_DUMP_ATTR 715 772 716 773 /*! … … 719 776 */ 720 777 void CContext::sendGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 778 TRY 721 779 { 722 780 int size = activeFiles.size(); … … 726 784 } 727 785 } 786 CATCH_DUMP_ATTR 728 787 729 788 void CContext::checkGridEnabledFields() 789 TRY 730 790 { 731 791 int size = enabledFiles.size(); … … 735 795 } 736 796 } 797 CATCH_DUMP_ATTR 737 798 738 799 /*! … … 741 802 */ 742 803 void CContext::checkGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 804 TRY 743 805 { 744 806 int size = activeFiles.size(); … … 748 810 } 749 811 } 812 CATCH_DUMP_ATTR 750 813 751 814 /*! … … 755 818 */ 756 819 void CContext::solveOnlyRefOfEnabledFields(bool sendToServer) 820 TRY 757 821 { 758 822 int size = this->enabledFiles.size(); … … 767 831 } 768 832 } 833 CATCH_DUMP_ATTR 769 834 770 835 /*! … … 775 840 */ 776 841 void CContext::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 842 TRY 777 843 { 778 844 int size = this->enabledFiles.size(); … … 782 848 } 783 849 } 850 CATCH_DUMP_ATTR 784 851 785 852 void CContext::buildFilterGraphOfEnabledFields() 853 TRY 786 854 { 787 855 int size = this->enabledFiles.size(); … … 791 859 } 792 860 } 861 CATCH_DUMP_ATTR 793 862 794 863 void CContext::postProcessFilterGraph() 864 TRY 795 865 { 796 866 int size = enabledFiles.size(); … … 800 870 } 801 871 } 872 CATCH_DUMP_ATTR 802 873 803 874 void CContext::startPrefetchingOfEnabledReadModeFiles() 875 TRY 804 876 { 805 877 int size = enabledReadModeFiles.size(); … … 809 881 } 810 882 } 883 CATCH_DUMP_ATTR 811 884 812 885 void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 886 TRY 813 887 { 814 888 int size = enabledReadModeFiles.size(); … … 818 892 } 819 893 } 894 CATCH_DUMP_ATTR 820 895 821 896 void CContext::doPostTimestepOperationsForEnabledReadModeFiles() 897 TRY 822 898 { 823 899 int size = enabledReadModeFiles.size(); … … 827 903 } 828 904 } 905 CATCH_DUMP_ATTR 829 906 830 907 void CContext::findFieldsWithReadAccess(void) 908 TRY 831 909 { 832 910 fieldsWithReadAccess.clear(); … … 842 920 } 843 921 } 922 CATCH_DUMP_ATTR 844 923 845 924 void CContext::solveAllRefOfFieldsWithReadAccess() 925 TRY 846 926 { 847 927 for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) 848 928 fieldsWithReadAccess[i]->solveAllReferenceEnabledField(false); 849 929 } 930 CATCH_DUMP_ATTR 850 931 851 932 void CContext::buildFilterGraphOfFieldsWithReadAccess() 933 TRY 852 934 { 853 935 for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) 854 936 fieldsWithReadAccess[i]->buildFilterGraph(garbageCollector, true); 855 937 } 938 CATCH_DUMP_ATTR 856 939 857 940 void CContext::solveAllInheritance(bool apply) 941 TRY 858 942 { 859 943 // Résolution des héritages descendants (cà d des héritages de groupes) … … 878 962 879 963 } 964 CATCH_DUMP_ATTR 880 965 881 966 void CContext::findEnabledFiles(void) 967 TRY 882 968 { 883 969 const std::vector<CFile*> allFiles = CFile::getAll(); … … 928 1014 929 1015 } 1016 CATCH_DUMP_ATTR 930 1017 931 1018 void CContext::distributeFiles(void) 1019 TRY 932 1020 { 933 1021 bool distFileMemory=false ; … … 937 1025 else distributeFileOverBandwith() ; 938 1026 } 939 1027 CATCH_DUMP_ATTR 940 1028 941 1029 void CContext::distributeFileOverBandwith(void) 1030 TRY 942 1031 { 943 1032 double eps=std::numeric_limits<double>::epsilon()*10 ; … … 1009 1098 { 1010 1099 #pragma omp critical (_output) 1011 info(30)<<"Load Balancing for servers (perfect=1) : "<<it->second<<" : ratio "<<it->first*1./dataPerPool<<endl ; 1100 { 1101 info(30)<<"Load Balancing for servers (perfect=1) : "<<it->second<<" : ratio "<<it->first*1./dataPerPool<<endl ; 1102 } 1012 1103 } 1013 1104 … … 1023 1114 } 1024 1115 } 1116 CATCH_DUMP_ATTR 1025 1117 1026 1118 void CContext::distributeFileOverMemoryBandwith(void) 1119 TRY 1027 1120 { 1028 1121 // If primary server … … 1102 1195 { 1103 1196 #pragma omp critical (_output) 1104 info(100)<<"Pool server level2 "<<i<<" assigned file bandwith "<<bandwithSize[i]*86400.*4./1024/1024.<<" Mb / days"<<endl ; 1197 { 1198 info(100)<<"Pool server level2 "<<i<<" assigned file bandwith "<<bandwithSize[i]*86400.*4./1024/1024.<<" Mb / days"<<endl ; 1199 } 1105 1200 } 1106 1201 for (int i = 0; i < nbPools; ++i) 1107 1202 { 1108 1203 #pragma omp critical (_output) 1109 info(100)<<"Pool server level2 "<<i<<" assigned grid memory "<<memorySize[i]*100/1024./1024.<<" Mb"<<endl ; 1204 { 1205 info(100)<<"Pool server level2 "<<i<<" assigned grid memory "<<memorySize[i]*100/1024./1024.<<" Mb"<<endl ; 1206 } 1110 1207 } 1111 1208 … … 1122 1219 } 1123 1220 } 1124 1125 1221 CATCH_DUMP_ATTR 1126 1222 1127 1223 /*! … … 1129 1225 */ 1130 1226 void CContext::findEnabledWriteModeFiles(void) 1227 TRY 1131 1228 { 1132 1229 int size = this->enabledFiles.size(); … … 1138 1235 } 1139 1236 } 1237 CATCH_DUMP_ATTR 1140 1238 1141 1239 /*! … … 1143 1241 */ 1144 1242 void CContext::findEnabledReadModeFiles(void) 1243 TRY 1145 1244 { 1146 1245 int size = this->enabledFiles.size(); … … 1151 1250 } 1152 1251 } 1252 CATCH_DUMP_ATTR 1153 1253 1154 1254 void CContext::closeAllFile(void) 1255 TRY 1155 1256 { 1156 1257 std::vector<CFile*>::const_iterator … … 1160 1261 { 1161 1262 #pragma omp critical (_output) 1162 info(30)<<"Closing File : "<<(*it)->getId()<<endl; 1263 { 1264 info(30)<<"Closing File : "<<(*it)->getId()<<endl; 1265 } 1163 1266 (*it)->close(); 1164 1267 } 1165 1268 } 1269 CATCH_DUMP_ATTR 1166 1270 1167 1271 /*! … … 1173 1277 */ 1174 1278 bool CContext::dispatchEvent(CEventServer& event) 1279 TRY 1175 1280 { 1176 1281 … … 1214 1319 } 1215 1320 } 1321 CATCH 1216 1322 1217 1323 //! Client side: Send a message to server to make it close 1218 1324 void CContext::sendCloseDefinition(void) 1325 TRY 1219 1326 { 1220 1327 // Use correct context client to send message … … 1239 1346 } 1240 1347 } 1348 CATCH_DUMP_ATTR 1241 1349 1242 1350 //! Server side: Receive a message of client announcing a context close 1243 1351 void CContext::recvCloseDefinition(CEventServer& event) 1352 TRY 1244 1353 { 1245 1354 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 1248 1357 get(id)->closeDefinition(); 1249 1358 } 1359 CATCH 1250 1360 1251 1361 //! Client side: Send a message to update calendar in each time step 1252 1362 void CContext::sendUpdateCalendar(int step) 1363 TRY 1253 1364 { 1254 1365 // Use correct context client to send message … … 1274 1385 } 1275 1386 } 1387 CATCH_DUMP_ATTR 1276 1388 1277 1389 //! Server side: Receive a message of client annoucing calendar update 1278 1390 void CContext::recvUpdateCalendar(CEventServer& event) 1391 TRY 1279 1392 { 1280 1393 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 1283 1396 get(id)->recvUpdateCalendar(*buffer); 1284 1397 } 1398 CATCH 1285 1399 1286 1400 //! Server side: Receive a message of client annoucing calendar update 1287 1401 void CContext::recvUpdateCalendar(CBufferIn& buffer) 1402 TRY 1288 1403 { 1289 1404 int step; … … 1295 1410 } 1296 1411 } 1412 CATCH_DUMP_ATTR 1297 1413 1298 1414 //! Client side: Send a message to create header part of netcdf file 1299 1415 void CContext::sendCreateFileHeader(void) 1416 TRY 1300 1417 { 1301 1418 // Use correct context client to send message … … 1322 1439 } 1323 1440 } 1441 CATCH_DUMP_ATTR 1324 1442 1325 1443 //! Server side: Receive a message of client annoucing the creation of header part of netcdf file 1326 1444 void CContext::recvCreateFileHeader(CEventServer& event) 1445 TRY 1327 1446 { 1328 1447 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 1331 1450 get(id)->recvCreateFileHeader(*buffer); 1332 1451 } 1452 CATCH 1333 1453 1334 1454 //! Server side: Receive a message of client annoucing the creation of header part of netcdf file 1335 1455 void CContext::recvCreateFileHeader(CBufferIn& buffer) 1456 TRY 1336 1457 { 1337 1458 if (!hasClient && hasServer) 1338 1459 createFileHeader(); 1339 1460 } 1461 CATCH_DUMP_ATTR 1340 1462 1341 1463 //! Client side: Send a message to do some post processing on server 1342 1464 void CContext::sendProcessingGridOfEnabledFields() 1465 TRY 1343 1466 { 1344 1467 // Use correct context client to send message … … 1364 1487 } 1365 1488 } 1489 CATCH_DUMP_ATTR 1366 1490 1367 1491 //! Server side: Receive a message to do some post processing 1368 1492 void CContext::recvProcessingGridOfEnabledFields(CEventServer& event) 1493 TRY 1369 1494 { 1370 1495 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 1372 1497 *buffer>>id; 1373 1498 } 1499 CATCH 1374 1500 1375 1501 //! Client side: Send a message to do some post processing on server 1376 1502 void CContext::sendPostProcessing() 1503 TRY 1377 1504 { 1378 1505 // Use correct context client to send message … … 1398 1525 } 1399 1526 } 1527 CATCH_DUMP_ATTR 1400 1528 1401 1529 //! Server side: Receive a message to do some post processing 1402 1530 void CContext::recvPostProcessing(CEventServer& event) 1531 TRY 1403 1532 { 1404 1533 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 1407 1536 get(id)->recvPostProcessing(*buffer); 1408 1537 } 1538 CATCH 1409 1539 1410 1540 //! Server side: Receive a message to do some post processing 1411 1541 void CContext::recvPostProcessing(CBufferIn& buffer) 1542 TRY 1412 1543 { 1413 1544 CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); 1414 1545 postProcessing(); 1415 1546 } 1547 CATCH_DUMP_ATTR 1416 1548 1417 1549 const StdString& CContext::getIdServer() 1550 TRY 1418 1551 { 1419 1552 if (hasClient) … … 1425 1558 if (hasServer) return (this->getId()); 1426 1559 } 1560 CATCH_DUMP_ATTR 1427 1561 1428 1562 const StdString& CContext::getIdServer(const int i) 1563 TRY 1429 1564 { 1430 1565 idServer_ = this->getId(); … … 1433 1568 return idServer_; 1434 1569 } 1435 1570 CATCH_DUMP_ATTR 1436 1571 1437 1572 /*! … … 1442 1577 */ 1443 1578 void CContext::postProcessing() 1579 TRY 1444 1580 { 1445 1581 if (isPostProcessed) return; … … 1504 1640 isPostProcessed = true; 1505 1641 } 1642 CATCH_DUMP_ATTR 1506 1643 1507 1644 /*! … … 1514 1651 std::map<int, StdSize> CContext::getAttributesBufferSize(std::map<int, StdSize>& maxEventSize, 1515 1652 CContextClient* contextClient, bool bufferForWriting /*= "false"*/) 1653 TRY 1516 1654 { 1517 1655 // As calendar attributes are sent even if there are no active files or fields, maps are initialized according the size of calendar attributes … … 1545 1683 return attributesSize; 1546 1684 } 1685 CATCH_DUMP_ATTR 1547 1686 1548 1687 /*! … … 1555 1694 std::map<int, StdSize> CContext::getDataBufferSize(std::map<int, StdSize>& maxEventSize, 1556 1695 CContextClient* contextClient, bool bufferForWriting /*= "false"*/) 1696 TRY 1557 1697 { 1558 1698 std::map<int, StdSize> dataSize; … … 1563 1703 for (size_t i = 0; i < numEnabledFiles; ++i) 1564 1704 { 1565 // CFile* file = this->enabledFiles[i];1566 1705 CFile* file = fileList[i]; 1567 1706 if (file->getContextClient() == contextClient) … … 1591 1730 return dataSize; 1592 1731 } 1732 CATCH_DUMP_ATTR 1593 1733 1594 1734 //! Client side: Send infomation of active files (files are enabled to write out) 1595 1735 void CContext::sendEnabledFiles(const std::vector<CFile*>& activeFiles) 1736 TRY 1596 1737 { 1597 1738 int size = activeFiles.size(); … … 1611 1752 } 1612 1753 } 1754 CATCH_DUMP_ATTR 1613 1755 1614 1756 //! Client side: Send information of active fields (ones are written onto files) 1615 1757 void CContext::sendEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 1758 TRY 1616 1759 { 1617 1760 int size = activeFiles.size(); … … 1621 1764 } 1622 1765 } 1766 CATCH_DUMP_ATTR 1623 1767 1624 1768 //! Client side: Check if the defined axis, domains and grids are eligible for compressed indexed output 1625 1769 void CContext::checkAxisDomainsGridsEligibilityForCompressedOutput() 1770 TRY 1626 1771 { 1627 1772 if (!hasClient) return; … … 1639 1784 (*it)->checkEligibilityForCompressedOutput(); 1640 1785 } 1786 CATCH_DUMP_ATTR 1641 1787 1642 1788 //! Client side: Prepare the timeseries by adding the necessary files 1643 1789 void CContext::prepareTimeseries() 1790 TRY 1644 1791 { 1645 1792 if (!hasClient) return; … … 1739 1886 } 1740 1887 } 1888 CATCH_DUMP_ATTR 1741 1889 1742 1890 //! Client side: Send information of reference grid of active fields 1743 1891 void CContext::sendRefGrid(const std::vector<CFile*>& activeFiles) 1892 TRY 1744 1893 { 1745 1894 std::set<StdString> gridIds; … … 1773 1922 } 1774 1923 } 1924 CATCH_DUMP_ATTR 1775 1925 1776 1926 //! Client side: Send information of reference domain, axis and scalar of active fields 1777 1927 void CContext::sendRefDomainsAxisScalars(const std::vector<CFile*>& activeFiles) 1928 TRY 1778 1929 { 1779 1930 std::set<StdString> domainIds, axisIds, scalarIds; … … 1834 1985 } 1835 1986 } 1987 CATCH_DUMP_ATTR 1836 1988 1837 1989 //! Update calendar in each time step 1838 1990 void CContext::updateCalendar(int step) 1991 TRY 1839 1992 { 1840 1993 int prevStep = calendar->getStep(); … … 1847 2000 } 1848 2001 1849 //#pragma omp critical (_output) 1850 info(150) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 2002 #pragma omp critical (_output) 2003 { 2004 info(100) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 2005 } 1851 2006 calendar->update(step); 1852 //#pragma omp critical (_output) 1853 info(150) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 2007 #pragma omp critical (_output) 2008 { 2009 info(100) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 2010 } 1854 2011 #ifdef XIOS_MEMTRACK_LIGHT 1855 2012 #pragma omp critical (_output) 1856 info(50) << " Current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 2013 { 2014 info(50) << " Current memory used by XIOS : "<< MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 2015 } 1857 2016 #endif 1858 2017 … … 1866 2025 { 1867 2026 #pragma omp critical (_output) 1868 info(50) << "updateCalendar: already at step " << step << ", no operation done." << endl; 2027 { 2028 info(50) << "updateCalendar: already at step " << step << ", no operation done." << endl; 2029 } 1869 2030 } 1870 2031 else // if (prevStep > step) … … 1872 2033 << "Illegal calendar update: previous step was " << prevStep << ", new step " << step << "is in the past!") 1873 2034 } 2035 CATCH_DUMP_ATTR 1874 2036 1875 2037 void CContext::initReadFiles(void) 2038 TRY 1876 2039 { 1877 2040 vector<CFile*>::const_iterator it; … … 1882 2045 } 1883 2046 } 2047 CATCH_DUMP_ATTR 1884 2048 1885 2049 //! Server side: Create header of netcdf file 1886 2050 void CContext::createFileHeader(void) 2051 TRY 1887 2052 { 1888 2053 vector<CFile*>::const_iterator it; … … 1894 2059 } 1895 2060 } 2061 CATCH_DUMP_ATTR 1896 2062 1897 2063 //! Get current context 1898 2064 CContext* CContext::getCurrent(void) 2065 TRY 1899 2066 { 1900 2067 return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()).get(); 1901 2068 } 2069 CATCH 1902 2070 1903 2071 /*! … … 1906 2074 */ 1907 2075 void CContext::setCurrent(const string& id) 2076 TRY 1908 2077 { 1909 2078 CObjectFactory::SetCurrentContextId(id); 1910 2079 CGroupFactory::SetCurrentContextId(id); 1911 2080 } 2081 CATCH 1912 2082 1913 2083 /*! … … 1917 2087 */ 1918 2088 CContext* CContext::create(const StdString& id) 2089 TRY 1919 2090 { 1920 2091 CContext::setCurrent(id); … … 1932 2103 return (context); 1933 2104 } 1934 2105 CATCH 1935 2106 1936 2107 //! Server side: Receive a message to do some post processing 1937 2108 void CContext::recvRegistry(CEventServer& event) 2109 TRY 1938 2110 { 1939 2111 CBufferIn* buffer=event.subEvents.begin()->buffer; … … 1942 2114 get(id)->recvRegistry(*buffer); 1943 2115 } 2116 CATCH 1944 2117 1945 2118 void CContext::recvRegistry(CBufferIn& buffer) 2119 TRY 1946 2120 { 1947 2121 if (server->intraCommRank==0) … … 1952 2126 } 1953 2127 } 2128 CATCH_DUMP_ATTR 1954 2129 1955 2130 void CContext::sendRegistry(void) 2131 TRY 1956 2132 { 1957 2133 registryOut->hierarchicalGatherRegistry() ; … … 1979 2155 } 1980 2156 } 2157 CATCH_DUMP_ATTR 1981 2158 1982 2159 /*! … … 1985 2162 */ 1986 2163 bool CContext::isFinalized(void) 2164 TRY 1987 2165 { 1988 2166 return finalized; 1989 2167 } 2168 CATCH_DUMP_ATTR 2169 ///-------------------------------------------------------------- 2170 StdString CContext::dumpClassAttributes(void) 2171 { 2172 StdString str; 2173 str.append("enabled files=\""); 2174 int size = this->enabledFiles.size(); 2175 for (int i = 0; i < size; ++i) 2176 { 2177 str.append(enabledFiles[i]->getId()); 2178 str.append(" "); 2179 } 2180 str.append("\""); 2181 return str; 2182 } 1990 2183 1991 2184 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.