Changeset 1202 for XIOS/dev/dev_olga/src/node/grid.cpp
- Timestamp:
- 07/10/17 15:16:17 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/grid.cpp
r1201 r1202 287 287 nbSrvPools = 1; 288 288 for (int p = 0; p < nbSrvPools; ++p) 289 { 290 if (isScalarGrid()) 291 { 292 if (context->hasClient) 293 if (this->isChecked && doSendingIndex && !isIndexSent) { sendIndexScalarGrid(); this->isIndexSent = true; } 294 295 if (this->isChecked) continue; 296 297 if (context->hasClient) 298 { 299 this->computeIndexScalarGrid(); 300 } 301 302 if (!(this->hasTransform() && !this->isTransformed())) 303 this->isChecked = true; 304 continue; 289 { 290 if (context->hasClient && this->isChecked && doSendingIndex && !isIndexSent) 291 { 292 if (isScalarGrid()) 293 sendIndexScalarGrid(); 294 else 295 sendIndex(); 296 this->isIndexSent = true; 305 297 } 306 298 307 if (context->hasClient) 308 { 309 if (this->isChecked && doSendingIndex && !isIndexSent) 310 {sendIndex(); this->isIndexSent = true;} 311 } 299 // Not sure about this 300 //if (!(this->hasTransform() && !this->isTransformed())) 301 // this->isChecked = true; 302 //return; 312 303 } 313 304 … … 546 537 if (computedWrittenIndex_) return; 547 538 computedWrittenIndex_ = true; 539 540 if (isScalarGrid()) 541 { 542 size_t nbWritten = 1; 543 int writtenIndex = 0; 544 545 localIndexToWriteOnClient.resize(nbWritten); 546 localIndexToWriteOnServer.resize(nbWritten); 547 localIndexToWriteOnServer(0) = writtenIndex; 548 localIndexToWriteOnClient(0) = writtenIndex; 549 550 return; 551 } 548 552 549 553 size_t nbWritten = 0, indGlo; … … 746 750 { 747 751 CContext* context = CContext::getCurrent(); 748 computeClientIndex(); 749 if (context->hasClient) 752 if (isScalarGrid()) 750 753 { 751 computeConnectedClients(); 754 computeClientIndexScalarGrid(); 755 if (context->hasClient) 756 { 757 computeConnectedClientsScalarGrid(); 758 } 759 } 760 else 761 { 762 computeClientIndex(); 763 if (context->hasClient) 764 { 765 computeConnectedClients(); 766 } 752 767 } 753 768 } … … 1171 1186 } 1172 1187 1173 void CGrid::computeIndexScalarGrid() 1188 void CGrid::computeClientIndexScalarGrid() 1189 { 1190 CContext* context = CContext::getCurrent(); 1191 int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 1192 for (int p = 0; p < nbSrvPools; ++p) 1193 { 1194 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1195 : context->client; 1196 1197 storeIndex_client.resize(1); 1198 storeIndex_client(0) = 0; 1199 1200 if (0 != serverDistribution_) 1201 { 1202 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 1203 ite = outGlobalIndexFromClient.end(), it; 1204 for (it = itb; it != ite; ++it) 1205 { 1206 int rank = it->first; 1207 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient[rank]; 1208 outLocalIndexStoreOnClient.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 1209 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient[rank]; 1210 if (1 != globalIndex.numElements()) 1211 ERROR("void CGrid::computeClientIndexScalarGrid()", 1212 << "Something wrong happened. " 1213 << "Number of received global index on scalar grid should equal to 1" 1214 << "Number of received global index " << globalIndex.numElements() << "."); 1215 1216 localIndex(0) = globalIndex(0); 1217 } 1218 } 1219 } 1220 } 1221 1222 void CGrid::computeConnectedClientsScalarGrid() 1174 1223 { 1175 1224 CContext* context = CContext::getCurrent(); … … 1181 1230 for (int p = 0; p < nbSrvPools; ++p) 1182 1231 { 1183 CContextClient* client = context->hasServer ? context->clientPrimServer[p] : context->client; 1184 1185 storeIndex_client.resize(1); 1186 storeIndex_client(0) = 0; 1232 CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 1233 : context->client; 1187 1234 1188 1235 connectedServerRank_[p].clear(); 1189 1236 1190 if (0 == client->clientRank) 1191 { 1192 for (int rank = 0; rank < client->serverSize; ++rank) 1193 { 1237 if (client->isServerLeader()) 1238 { 1239 const std::list<int>& ranks = client->getRanksServerLeader(); 1240 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1241 { 1242 int rank = *itRank; 1243 int nb = 1; 1194 1244 connectedServerRank_[p].push_back(rank); 1195 connectedDataSize_[p][rank] = 1; 1196 nbSenders[p][rank] = 1; 1197 } 1198 } 1245 connectedDataSize_[p][rank] = nb; 1246 nbSenders[p][rank] = nb; 1247 } 1248 } 1249 else 1250 { 1251 const std::list<int>& ranks = client->getRanksServerNotLeader(); 1252 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1253 { 1254 int rank = *itRank; 1255 int nb = 1; 1256 connectedServerRank_[p].push_back(rank); 1257 connectedDataSize_[p][rank] = nb; 1258 nbSenders[p][rank] = nb; 1259 } 1260 } 1261 1199 1262 isDataDistributed_ = false; 1200 1263 } … … 1433 1496 std::vector<CAxis*> axisList = getAxis(); 1434 1497 std::vector<int> nZoomBegin(ssize), nZoomSize(ssize), nGlob(ssize), nZoomBeginGlobal(ssize), nGlobElement(numElement); 1435 std::vector<CArray<int,1> > zoomIndex;1498 std::vector<CArray<int,1> > globalZoomIndex(numElement); 1436 1499 for (int i = 0; i < numElement; ++i) 1437 1500 { … … 1449 1512 nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 1450 1513 1514 { 1515 int count = 0; 1516 globalZoomIndex[i].resize(nZoomSize[indexMap[i]]*nZoomSize[indexMap[i]+1]); 1517 for (int jdx = 0; jdx < nZoomSize[indexMap[i]+1]; ++jdx) 1518 for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx) 1519 { 1520 globalZoomIndex[i](count) = (nZoomBegin[indexMap[i]] + idx) + (nZoomBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 1521 ++count; 1522 } 1523 } 1524 1451 1525 ++domainId; 1452 1526 } … … 1456 1530 nZoomSize[indexMap[i]] = axisList[axisId]->zoom_n; 1457 1531 nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin; 1458 nGlob[indexMap[i]] = axisList[axisId]->n_glo; 1532 nGlob[indexMap[i]] = axisList[axisId]->n_glo; 1533 if (axisList[axisId]->zoomByIndex()) 1534 { 1535 globalZoomIndex[i].reference(axisList[axisId]->zoom_index); 1536 } 1537 else 1538 { 1539 globalZoomIndex[i].resize(nZoomSize[indexMap[i]]); 1540 for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx) 1541 globalZoomIndex[i](idx) = nZoomBegin[indexMap[i]] + idx; 1542 } 1543 1459 1544 ++axisId; 1460 1545 } … … 1465 1550 nZoomBeginGlobal[indexMap[i]] = 0; 1466 1551 nGlob[indexMap[i]] = 1; 1467 1552 globalZoomIndex[i].resize(1); 1553 globalZoomIndex[i](0) = 0; 1468 1554 ++scalarId; 1469 1555 } … … 1473 1559 for (int i = 0; i < nZoomSize.size(); ++i) 1474 1560 dataSize *= nZoomSize[i]; 1475 serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 1476 nZoomBeginGlobal, nGlob); 1561 // serverDistribution_ = new CDistributionServer(server->intraCommRank, nZoomBegin, nZoomSize, 1562 // nZoomBeginGlobal, nGlob); 1563 serverDistribution_ = new CDistributionServer(server->intraCommRank, 1564 globalZoomIndex, axis_domain_order, 1565 nZoomBegin, nZoomSize, nZoomBeginGlobal, nGlob); 1477 1566 } 1478 1567
Note: See TracChangeset
for help on using the changeset viewer.