Changeset 1136 for XIOS/dev/dev_olga/src
- Timestamp:
- 05/17/17 18:30:38 (7 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/field.cpp
r1129 r1136 125 125 126 126 CContext* context = CContext::getCurrent(); 127 // CContextClient* client = context->client;128 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;129 // int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 0) : 1;130 // for (int i = 0; i < nbSrvPools; ++i)131 // {132 127 CContextClient* client = (!context->hasServer) ? context->client : this->file->getContextClient(); 133 128 … … 261 256 { 262 257 CArray<int,1>& storeClient = grid->storeIndex_client; 263 // for (map<int, CArray<size_t, 1> >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 264 // { 265 // // sizeData += it->second.numElements(); 266 // data_srv.insert(std::make_pair(it->first, CArray<double,1>(it->second.numElements()))); 267 // } 268 269 // for (map<int, CArray<size_t, 1> >::iterator it = grid->outLocalIndexStoreOnClient.begin(); it != grid->outLocalIndexStoreOnClient.end(); ++it) 270 // { 271 // // sizeData += it->second.numElements(); 272 // data_srv.insert(std::make_pair(it->first, CArray<double,1>(it->second.numElements()))); 273 // } 274 275 // Gather all data from different clients 276 // recvDataSrv.resize(sizeData); 258 259 // Gather all data from different clients 277 260 recvDataSrv.resize(storeClient.numElements()); 278 261 recvFoperationSrv = boost::shared_ptr<func::CFunctor>(new func::CInstant(recvDataSrv)); 279 262 } 280 263 281 CArray<double,1> recv_data_tmp(recvDataSrv.numElements()); 282 // sizeData = 0; 264 CArray<double,1> recv_data_tmp(recvDataSrv.numElements()); 283 265 const CDate& currDate = context->getCalendar()->getCurrentDate(); 284 266 const CDate opeDate = last_operation_srv +freq_op + freq_operation_srv - freq_op; … … 286 268 if (opeDate <= currDate) 287 269 { 288 270 for (map<int, CArray<size_t, 1> >::iterator it = grid->outLocalIndexStoreOnClient.begin(); it != grid->outLocalIndexStoreOnClient.end(); ++it) 289 271 { 290 272 CArray<double,1> tmp; … … 294 276 { 295 277 recv_data_tmp(indexTmp(idx)) = tmp(idx); 296 } 297 // recv_data_tmp(Range(sizeData,sizeData+it->second.numElements()-1)) = tmp; 298 // sizeData += it->second.numElements(); 299 } 300 301 // for (map<int, CArray<size_t, 1> >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it) 302 // { 303 // CArray<double,1> tmp; 304 // CArray<size_t,1>& indexTmp = it->second; 305 // *(rankBuffers[it->first]) >> tmp; 306 // for (int idx = 0; idx < indexTmp.numElements(); ++idx) 307 // { 308 // recv_data_tmp(indexTmp(idx)) = tmp(idx); 309 // } 310 // // recv_data_tmp(Range(sizeData,sizeData+it->second.numElements()-1)) = tmp; 311 // // sizeData += it->second.numElements(); 312 // } 278 } 279 } 313 280 } 314 281 … … 328 295 (*recvFoperationSrv)(data); 329 296 last_operation_srv = currDate; 330 // sendUpdateData(fieldData);331 // Redirecting data to the correct secondary server332 //int fileIdx = std::find(context->enabledFiles.begin(), context->enabledFiles.end(), this->file) - context->enabledFiles.begin();333 //int srvId = fileIdx % context->clientPrimServer.size();334 //sendUpdateData(fieldData, context->clientPrimServer[srvId]);335 297 } 336 298 … … 416 378 if (grid->doGridHaveDataToWrite() || getRelFile()->type == CFile::type_attr::one_file) 417 379 { 418 getRelFile()->check File();380 getRelFile()->checkWriteFile(); 419 381 this->incrementNStep(); 420 382 getRelFile()->getDataOutput()->writeFieldData(CField::get(this)); … … 479 441 { 480 442 CContext* context = CContext::getCurrent(); 481 CContextClient* client = context->client; 443 CContextClient* client = context->client; 482 444 483 445 CEventClient event(getType(), EVENT_ID_READ_DATA_READY); … … 486 448 bool hasData = readField(); 487 449 488 map<int, CArray<double,1> >::iterator it; 489 // for (it = data_srv.begin(); it != data_srv.end(); it++) 490 // { 491 // msgs.push_back(CMessage()); 492 // CMessage& msg = msgs.back(); 493 // msg << getId(); 494 // if (hasData) 495 // msg << getNStep() - 1 << it->second; 496 // else 497 // msg << int(-1); 498 // event.push(it->first, grid->nbSenders[it->first], msg); 499 // } 500 // client->sendEvent(event); 450 501 451 if (!grid->doGridHaveDataDistributed()) 502 452 { 503 453 if (client->isServerLeader()) 504 454 { 505 if (!data_srv.empty()) 506 { 507 it = data_srv.begin(); 455 if (0 != recvDataSrv.numElements()) 456 { 508 457 const std::list<int>& ranks = client->getRanksServerLeader(); 509 458 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) … … 513 462 msg << getId(); 514 463 if (hasData) 515 msg << getNStep() - 1 << it->second;464 msg << getNStep() - 1 << recvDataSrv; 516 465 else 517 466 msg << int(-1); … … 519 468 } 520 469 } 470 521 471 client->sendEvent(event); 522 472 } 523 473 else 524 474 { 525 // if (!data_srv.empty())526 // {527 // it = data_srv.begin();528 // const std::list<int>& ranks = client->getRanksServerNotLeader();529 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)530 // {531 // msgs.push_back(CMessage());532 // CMessage& msg = msgs.back();533 // msg << getId();534 // if (hasData)535 // msg << getNStep() - 1 << it->second;536 // else537 // msg << int(-1);538 // event.push(*itRank, 1, msg);539 // }540 // }541 475 client->sendEvent(event); 542 476 } … … 544 478 else 545 479 { 546 for (it = data_srv.begin(); it != data_srv.end(); it++) 480 for (map<int, CArray<size_t, 1> >::iterator it = grid->outLocalIndexStoreOnClient.begin(); 481 it != grid->outLocalIndexStoreOnClient.end(); ++it) 547 482 { 483 CArray<size_t,1>& indexTmp = it->second; 484 CArray<double,1> tmp(indexTmp.numElements()); 485 for (int idx = 0; idx < indexTmp.numElements(); ++idx) 486 { 487 tmp(idx) = recvDataSrv(indexTmp(idx)); 488 } 489 548 490 msgs.push_back(CMessage()); 549 491 CMessage& msg = msgs.back(); 550 492 msg << getId(); 551 493 if (hasData) 552 msg << getNStep() - 1 << it->second;494 msg << getNStep() - 1 << tmp; 553 495 else 554 496 msg << int(-1); 555 event.push(it->first, grid->nb Senders[0][it->first], msg);497 event.push(it->first, grid->nbReadSenders[0][it->first], msg); 556 498 } 557 499 client->sendEvent(event); … … 561 503 bool CField::readField(void) 562 504 { 505 grid->computeWrittenIndex(); 563 506 if (!getRelFile()->allDomainEmpty) 564 507 { 565 508 if (grid->doGridHaveDataToWrite() || getRelFile()->type == CFile::type_attr::one_file) 566 509 { 567 if ( data_srv.empty())568 { 569 for (map<int, CArray<size_t, 1> >::iterator it = grid->outIndexFromClient.begin(); it != grid->outIndexFromClient.end(); ++it)570 data_srv.insert(std::make_pair(it->first, CArray<double,1>(it->second.numElements())));510 if (0 == recvDataSrv.numElements()) 511 { 512 CArray<int,1>& storeClient = grid->storeIndex_client; 513 recvDataSrv.resize(storeClient.numElements()); 571 514 } 572 515 573 getRelFile()->check File();516 getRelFile()->checkReadFile(); 574 517 if (!nstepMax) 575 518 { … … 578 521 579 522 this->incrementNStep(); 580 581 582 523 583 524 if (getNStep() > nstepMax && (getRelFile()->cyclic.isEmpty() || !getRelFile()->cyclic) ) … … 1426 1367 void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) 1427 1368 { 1428 map<int, CArray<double,1> >::iterator it; 1429 for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = (it->second - addOffset) / scaleFactor; 1369 // map<int, CArray<double,1> >::iterator it; 1370 // for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = (it->second - addOffset) / scaleFactor; 1371 recvDataSrv = (recvDataSrv - addOffset) / scaleFactor; 1430 1372 } 1431 1373 1432 1374 void CField::invertScaleFactorAddOffset(double scaleFactor, double addOffset) 1433 1375 { 1434 map<int, CArray<double,1> >::iterator it; 1435 for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = it->second * scaleFactor + addOffset; 1436 } 1437 1438 void CField::outputField(CArray<double,3>& fieldOut) 1439 { 1440 map<int, CArray<double,1> >::iterator it; 1441 for (it = data_srv.begin(); it != data_srv.end(); it++) 1442 { 1443 grid->outputField(it->first, it->second, fieldOut.dataFirst()); 1444 } 1445 } 1446 1447 void CField::outputField(CArray<double,2>& fieldOut) 1448 { 1449 map<int, CArray<double,1> >::iterator it; 1450 for(it=data_srv.begin();it!=data_srv.end();it++) 1451 { 1452 grid->outputField(it->first, it->second, fieldOut.dataFirst()); 1453 } 1376 // map<int, CArray<double,1> >::iterator it; 1377 // for (it = data_srv.begin(); it != data_srv.end(); it++) it->second = it->second * scaleFactor + addOffset; 1378 recvDataSrv = recvDataSrv * scaleFactor + addOffset; 1454 1379 } 1455 1380 1456 1381 void CField::outputField(CArray<double,1>& fieldOut) 1457 { 1458 map<int, CArray<double,1> >::iterator it; 1459 1382 { 1460 1383 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 1461 1384 CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; … … 1464 1387 fieldOut(outIndexServer(idx)) = recvDataSrv(outIndexClient(idx)); 1465 1388 } 1466 1389 } 1390 1391 void CField::inputField(CArray<double,1>& fieldIn) 1392 { 1393 // map<int, CArray<double,1> >::iterator it; 1467 1394 // for (it = data_srv.begin(); it != data_srv.end(); it++) 1468 1395 // { 1469 // grid-> outputField(it->first, it->second, fieldOut.dataFirst());1396 // grid->inputField(it->first, fieldOut.dataFirst(), it->second); 1470 1397 // } 1471 // grid->outputField(recvDataSrv, fieldOut); 1472 } 1473 1474 void CField::inputField(CArray<double,3>& fieldOut) 1475 { 1476 map<int, CArray<double,1> >::iterator it; 1477 for (it = data_srv.begin(); it != data_srv.end(); it++) 1398 CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 1399 CArray<size_t,1>& outIndexServer = grid->localIndexToWriteOnServer; 1400 for (size_t idx = 0; idx < outIndexServer.numElements(); ++idx) 1478 1401 { 1479 grid->inputField(it->first, fieldOut.dataFirst(), it->second); 1480 } 1481 } 1482 1483 void CField::inputField(CArray<double,2>& fieldOut) 1484 { 1485 map<int, CArray<double,1> >::iterator it; 1486 for(it = data_srv.begin(); it != data_srv.end(); it++) 1487 { 1488 grid->inputField(it->first, fieldOut.dataFirst(), it->second); 1489 } 1490 } 1491 1492 void CField::inputField(CArray<double,1>& fieldOut) 1493 { 1494 map<int, CArray<double,1> >::iterator it; 1495 for (it = data_srv.begin(); it != data_srv.end(); it++) 1496 { 1497 grid->inputField(it->first, fieldOut.dataFirst(), it->second); 1498 } 1402 recvDataSrv(outIndexClient(idx)) = fieldIn(outIndexServer(idx)); 1403 } 1404 1499 1405 } 1500 1406 … … 1603 1509 { 1604 1510 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE); 1605 // CContext* context = CContext::getCurrent();1606 1607 // if (!context->hasServer)1608 // {1609 // CContextClient* client = context->client;1610 1611 // CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE);1612 // if (client->isServerLeader())1613 // {1614 // CMessage msg;1615 // msg << this->getId();1616 // msg << id;1617 // const std::list<int>& ranks = client->getRanksServerLeader();1618 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)1619 // event.push(*itRank,1,msg);1620 // client->sendEvent(event);1621 // }1622 // else client->sendEvent(event);1623 // }1624 1511 } 1625 1512 … … 1627 1514 { 1628 1515 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 1629 // CContext* context = CContext::getCurrent();1630 1631 // if (!context->hasServer)1632 // {1633 // CContextClient* client = context->client;1634 1635 // CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE);1636 // if (client->isServerLeader())1637 // {1638 // CMessage msg;1639 // msg << this->getId();1640 // msg << id;1641 // const std::list<int>& ranks = client->getRanksServerLeader();1642 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)1643 // event.push(*itRank,1,msg);1644 // client->sendEvent(event);1645 // }1646 // else client->sendEvent(event);1647 // }1648 1516 } 1649 1517 … … 1651 1519 { 1652 1520 sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP); 1653 // CContext* context = CContext::getCurrent();1654 // if (!context->hasServer)1655 // {1656 // CContextClient* client = context->client;1657 1658 // CEventClient event(this->getType(),EVENT_ID_ADD_VARIABLE_GROUP);1659 // if (client->isServerLeader())1660 // {1661 // CMessage msg;1662 // msg << this->getId();1663 // msg << id;1664 // const std::list<int>& ranks = client->getRanksServerLeader();1665 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)1666 // event.push(*itRank,1,msg);1667 // client->sendEvent(event);1668 // }1669 // else client->sendEvent(event);1670 // }1671 1521 } 1672 1522 -
XIOS/dev/dev_olga/src/node/field.hpp
r1129 r1136 157 157 static void recvReadDataReady(CEventServer& event); 158 158 void recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers); 159 void outputField(CArray<double,3>& fieldOut);160 void outputField(CArray<double,2>& fieldOut);161 159 void outputField(CArray<double,1>& fieldOut); 162 void inputField(CArray<double,3>& fieldOut);163 void inputField(CArray<double,2>& fieldOut);164 160 void inputField(CArray<double,1>& fieldOut); 165 161 void outputCompressedField(CArray<double, 1>& fieldOut); -
XIOS/dev/dev_olga/src/node/file.cpp
r1132 r1136 267 267 } 268 268 269 //! Verify state of a file 270 void CFile::checkFile(void) 269 /* 270 Check condition to write into a file 271 For now, we only use the level-2 server to write files (if this mode is activated) 272 or classical server to do this job. 273 */ 274 void CFile::checkWriteFile(void) 271 275 { 272 276 CContext* context = CContext::getCurrent(); 273 277 // Done by classical server or secondary server 274 if (!CXios::usingServer2 || (CXios::usingServer2 && !context->hasClient)) 278 // This condition should be changed soon 279 if (!CXios::usingServer2 || (CXios::usingServer2 && !context->hasClient)) 275 280 { 276 281 if (mode.isEmpty() || mode.getValue() == mode_attr::write) … … 278 283 if (!isOpen) createHeader(); 279 284 checkSync(); 285 } 286 checkSplit(); // REally need this? 287 } 288 } 289 290 /* 291 Check condition to read from a file 292 For now, we only use the level-1 server to write files (if this mode is activated) 293 or classical server to do this job. 294 This function can be used by client for reading metadata 295 */ 296 void CFile::checkReadFile(void) 297 { 298 CContext* context = CContext::getCurrent(); 299 // Done by classical server or secondary server 300 // TODO: This condition should be changed soon. It only works with maximum number of level as 2 301 if (!CXios::usingServer2 || (CXios::usingServer2 && context->hasClient)) 302 { 303 if (!mode.isEmpty() && mode.getValue() == mode_attr::read) 304 { 305 if (!isOpen) openInReadMode(&(context->server->intraComm)); 280 306 } 281 else 282 { 283 if (!isOpen) openInReadMode(); 284 } 285 checkSplit(); 307 //checkSplit(); // Really need for reading? 286 308 } 287 309 } … … 502 524 \brief Open an existing NetCDF file in read-only mode 503 525 */ 504 void CFile::openInReadMode( void)526 void CFile::openInReadMode(MPI_Comm* comm) 505 527 { 506 528 CContext* context = CContext::getCurrent(); 507 529 CContextServer* server = context->server; 530 MPI_Comm readComm = *comm; 508 531 509 532 if (!allDomainEmpty) … … 547 570 { 548 571 int commSize, commRank; 549 MPI_Comm_size( fileComm, &commSize);550 MPI_Comm_rank( fileComm, &commRank);572 MPI_Comm_size(readComm, &commSize); 573 MPI_Comm_rank(readComm, &commRank); 551 574 552 575 if (server->intraCommSize > 1) … … 567 590 568 591 if (isOpen) data_out->closeFile(); 569 if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective));570 else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name));592 if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), readComm, multifile, isCollective)); 593 else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), readComm, multifile, isCollective, time_counter_name)); 571 594 isOpen = true; 572 595 } … … 594 617 // Just check file and try to open it 595 618 CContext* context = CContext::getCurrent(); 596 CContextClient* client=context->client;597 //CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client;619 // CContextClient* client=context->client; 620 CContextClient* client = (0 != context->clientPrimServer.size()) ? context->clientPrimServer[0] : context->client; 598 621 599 622 // It would probably be better to call initFile() somehow 600 MPI_Comm_dup(client->intraComm, &fileComm);623 // MPI_Comm_dup(client->intraComm, &fileComm); 601 624 if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 602 625 603 check File();626 checkReadFile(); 604 627 605 628 for (int idx = 0; idx < enabledFields.size(); ++idx) … … 883 906 884 907 /*! 908 \brief Send a message to create a field group on server side 909 \param[in] id String identity of field group that will be created on server 910 */ 911 void CFile::sendAddFieldGroup(const string& id, CContextClient* client) 912 { 913 sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP, client); 914 } 915 916 /*! 885 917 \brief Receive a message annoucing the creation of a field on server side 886 918 \param[in] event Received event … … 1057 1089 With these two id, it's easier to make reference to grid where all data should be written. 1058 1090 Remark: This function must be called AFTER all active (enabled) files have been created on the server side 1059 */ void CFile::sendEnabledFields(CContextClient* client) 1091 */ 1092 void CFile::sendEnabledFields(CContextClient* client) 1060 1093 { 1061 1094 size_t size = this->enabledFields.size(); -
XIOS/dev/dev_olga/src/node/file.hpp
r1132 r1136 87 87 bool checkSplit(void); 88 88 bool checkSync(void); 89 void checkFile(void); 89 void checkWriteFile(void); 90 void checkReadFile(void); 90 91 void initFile(void); 91 92 … … 96 97 97 98 void createHeader(void); 98 void openInReadMode( void);99 void openInReadMode(MPI_Comm* readComm = NULL); 99 100 void close(void); 100 101 void readAttributesOfEnabledFieldsInReadMode(); … … 128 129 void sendAddField(const string& id, CContextClient* client); 129 130 void sendAddFieldGroup(const string& id = ""); 131 void sendAddFieldGroup(const string& id, CContextClient* client); 130 132 void sendAddAllVariables(); // to be removed (?) 131 133 void sendAddAllVariables(CContextClient* client); -
XIOS/dev/dev_olga/src/node/grid.cpp
r1132 r1136 409 409 using namespace std; 410 410 std::vector<CDomain*> domainP = this->getDomains(); 411 std::vector<CAxis*> axisP = this->getAxis(); 411 std::vector<CAxis*> axisP = this->getAxis(); 412 412 int dim = domainP.size() * 2 + axisP.size(); 413 413 … … 442 442 { 443 443 std::vector<CDomain*> domainP = this->getDomains(); 444 std::vector<CAxis*> axisP = this->getAxis(); 444 std::vector<CAxis*> axisP = this->getAxis(); 445 445 int dim = domainP.size() * 2 + axisP.size(); 446 446 … … 591 591 { 592 592 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) : context->client; 593 // CContextClient* client = (context->hasServer) ? context->clientPrimServer[i] : context->client;594 // CContextServer* server = (context->hasServer) ? context->server : 0 ;595 // int rank = (server && !client) ? server->intraCommRank : client->clientRank;596 593 int rank = client->clientRank; 597 594 598 // First of all, compute distribution on client side599 // if (0 != serverDistribution_)600 // {601 // // clientDistribution_ = new CDistributionClient(rank, this, serverDistribution_->getGlobalLocalIndex());602 // clientDistribution_ = new CDistributionClient(rank, this);603 // storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size());604 // // storeIndex_client.resize(serverDistribution_->getGridSize());605 // int nbStoreIndex = storeIndex_client.numElements();606 // for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = idx;607 // }608 // else609 // {610 595 clientDistribution_ = new CDistributionClient(rank, this); 611 596 // Get local data index on client … … 665 650 } 666 651 652 /*! 653 Compute the connected clients and index to send to these clients. 654 Each client can connect to a pool of other clients, each of which can have a piece of information of a grid 655 656 */ 667 657 void CGrid::computeConnectedClients() 668 658 { 669 659 CContext* context = CContext::getCurrent(); 670 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;671 660 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; 672 661 connectedServerRank_.resize(nbSrvPools); … … 747 736 { 748 737 CContext* context = CContext::getCurrent(); 749 // CContextClient* client = context->client;750 // CContextClient* client = (context->hasServer) ? context->clientPrimServer : context->client;751 752 753 // // First of all, compute distribution on client side754 // if (0 != serverDistribution_)755 // clientDistribution_ = new CDistributionClient(client->clientRank, this, serverDistribution_->getGlobalLocalIndex());756 // else757 // clientDistribution_ = new CDistributionClient(client->clientRank, this);758 759 // // Get local data index on client760 // int tmp = clientDistribution_->getLocalDataIndexOnClient().size();761 // storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size());762 // int nbStoreIndex = storeIndex_client.numElements();763 // for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx];764 // isDataDistributed_= clientDistribution_->isDataDistributed();765 766 767 // int nbSrvPools = (context->hasServer) ? context->clientPrimServer.size() : 1;768 769 738 computeClientIndex(); 770 739 if (context->hasClient) … … 772 741 computeConnectedClients(); 773 742 } 774 775 // connectedServerRank_.clear();776 777 // if (!doGridHaveDataDistributed())778 // {779 // if (client->isServerLeader())780 // {781 // size_t ssize = clientDistribution_->getLocalDataIndexOnClient().size();782 // const std::list<int>& ranks = client->getRanksServerLeader();783 // for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank)784 // {785 // connectedServerRank_.push_back(*itRank);786 // connectedDataSize_[*itRank] = ssize;787 // }788 // }789 // return;790 // }791 792 // // Compute mapping between client and server793 // std::vector<boost::unordered_map<size_t,std::vector<int> > > indexServerOnElement;794 // CServerDistributionDescription serverDistributionDescription(globalDim_, client->serverSize);795 // serverDistributionDescription.computeServerGlobalByElement(indexServerOnElement,796 // client->clientRank,797 // client->clientSize,798 // axis_domain_order,799 // positionDimensionDistributed_);800 // computeIndexByElement(indexServerOnElement, globalIndexOnServer_);801 802 // const CDistributionClient::GlobalLocalDataMap& globalLocalIndexSendToServer = clientDistribution_->getGlobalLocalDataSendToServer();803 // CDistributionClient::GlobalLocalDataMap::const_iterator iteGlobalLocalIndexMap = globalLocalIndexSendToServer.end(), itGlobalLocalIndexMap;804 // CClientServerMapping::GlobalIndexMap::const_iterator iteGlobalMap, itbGlobalMap, itGlobalMap;805 // itGlobalMap = itbGlobalMap = globalIndexOnServer_.begin();806 // iteGlobalMap = globalIndexOnServer_.end();807 808 // for (; itGlobalMap != iteGlobalMap; ++itGlobalMap)809 // {810 // int serverRank = itGlobalMap->first;811 // int indexSize = itGlobalMap->second.size();812 // const std::vector<size_t>& indexVec = itGlobalMap->second;813 // for (int idx = 0; idx < indexSize; ++idx)814 // {815 // itGlobalLocalIndexMap = globalLocalIndexSendToServer.find(indexVec[idx]);816 // if (iteGlobalLocalIndexMap != itGlobalLocalIndexMap)817 // {818 // if (connectedDataSize_.end() == connectedDataSize_.find(serverRank))819 // connectedDataSize_[serverRank] = 1;820 // else821 // ++connectedDataSize_[serverRank];822 // }823 // }824 // }825 826 // for (itGlobalMap = itbGlobalMap; itGlobalMap != iteGlobalMap; ++itGlobalMap) {827 // connectedServerRank_.push_back(itGlobalMap->first);828 // }829 830 // nbSenders = clientServerMap_->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_);831 743 } 832 744 … … 950 862 951 863 nbIndexOnServer = 0; 952 // for (it = itb; it != ite; ++it)953 864 for (size_t j = 0; j < globalIndexElementOnServerMap.size(); ++j) 954 865 { … … 1585 1496 nbSrvPools = 1; 1586 1497 // connectedServerRank_.resize(nbSrvPools); 1587 // nbSenders.resize(nbSrvPools);1498 nbReadSenders.resize(nbSrvPools); 1588 1499 for (int p = 0; p < nbSrvPools; ++p) 1589 1500 { 1590 1501 CContextServer* server = (!context->hasClient) ? context->server : context->serverPrimServer[p]; 1591 1502 CContextClient* client = (!context->hasClient) ? context->client : context->clientPrimServer[p]; 1503 1592 1504 // CContextServer* server = (context->hasServer) ? context->server : context->serverPrimServer[p]; 1593 1505 // CContextClient* client = (context->hasServer) ? context->client : context->clientPrimServer[p]; … … 1699 1611 std::vector<CDomain*> domainList = getDomains(); 1700 1612 std::vector<CAxis*> axisList = getAxis(); 1701 std::vector<int> nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize); 1613 int dimSize = 2 * domainList.size() + axisList.size(); 1614 std::vector<int> nBegin(dimSize), nSize(dimSize), nGlob(dimSize), nBeginGlobal(dimSize); 1702 1615 for (int i = 0; i < numElement; ++i) 1703 1616 { … … 1726 1639 else // scalar 1727 1640 { 1728 nBegin[indexMap[i]] = 0;1729 nSize[indexMap[i]] = 1;1730 nBeginGlobal[indexMap[i]] = 0;1731 nGlob[indexMap[i]] = 1;1732 1733 ++scalarId;1734 1641 } 1735 1642 } … … 1782 1689 totalNumberWrittenIndexes_ = numberWrittenIndexes_; 1783 1690 1784 // nbSenders[p] = CClientServerMappingDistributed::computeConnectedClients(client->serverSize, client->clientSize,client->intraComm, ranks);1691 nbReadSenders[p] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 1785 1692 } 1786 1693 } -
XIOS/dev/dev_olga/src/node/grid.hpp
r1129 r1136 223 223 map<int, CArray<int, 1> > storeIndex_toSrv; 224 224 map<int, CArray<int, 1> > storeIndex_fromSrv; 225 std::vector<map<int,int> > nbSenders ;225 std::vector<map<int,int> > nbSenders, nbReadSenders; 226 226 227 227 map<int, CArray<size_t, 1> > outIndexFromClient, compressedOutIndexFromClient, outGlobalIndexFromClient; -
XIOS/dev/dev_olga/src/test/test_remap.f90
r1025 r1136 176 176 ! ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj)) 177 177 178 DO ts=1, 5178 DO ts=1,1 179 179 CALL xios_recv_field("src_field_regular", tmp_field_0) 180 180 ! CALL xios_recv_field("src_field_curvilinear", tmp_field_1) … … 184 184 CALL xios_send_field("src_field_2D_clone",src_field_2D) 185 185 CALL xios_send_field("src_field_3D",src_field_3D) 186 CALL xios_send_field("src_field_4D",src_field_4D)187 CALL xios_send_field("src_field_3D_pression",src_field_pression)186 ! CALL xios_send_field("src_field_4D",src_field_4D) 187 ! CALL xios_send_field("src_field_3D_pression",src_field_pression) 188 188 CALL xios_send_field("tmp_field_0",tmp_field_0) 189 189 ! CALL xios_send_field("tmp_field_1",tmp_field_1)
Note: See TracChangeset
for help on using the changeset viewer.