| 1278 | } |
| 1279 | |
| 1280 | void |
| 1281 | DistributionMapping::SFCProcessorMapDoIt (const BoxArray& boxes, |
| 1282 | const std::vector<Long>& wgts, |
| 1283 | int /* nprocs */, |
| 1284 | bool sort, |
| 1285 | Real* eff) |
| 1286 | { |
| 1287 | if (flag_verbose_mapper) { |
| 1288 | Print() << "DM: SFCProcessorMapDoIt called..." << '\n'; |
| 1289 | } |
| 1290 | |
| 1291 | BL_PROFILE("DistributionMapping::SFCProcessorMapDoIt()"); |
| 1292 | |
| 1293 | int nprocs = ParallelContext::NProcsSub(); |
| 1294 | |
| 1295 | int nteams = nprocs; |
| 1296 | int nworkers = 1; |
| 1297 | #if defined(BL_USE_TEAM) |
| 1298 | nteams = ParallelDescriptor::NTeams(); |
| 1299 | nworkers = ParallelDescriptor::TeamSize(); |
| 1300 | #else |
| 1301 | if (node_size > 0) { |
| 1302 | nteams = nprocs/node_size; |
| 1303 | nworkers = node_size; |
| 1304 | if (nworkers*nteams != nprocs) { |
| 1305 | nteams = nprocs; |
| 1306 | nworkers = 1; |
| 1307 | } |
| 1308 | } |
| 1309 | #endif |
| 1310 | |
| 1311 | if (flag_verbose_mapper) { |
| 1312 | Print() << " (nprocs, nteams, nworkers) = (" |
| 1313 | << nprocs << ", " << nteams << ", " << nworkers << ")\n"; |
| 1314 | } |
| 1315 | |
| 1316 | const int N = static_cast<int>(boxes.size()); |
| 1317 | std::vector<SFCToken> tokens; |
| 1318 | tokens.reserve(N); |
| 1319 | for (int i = 0; i < N; ++i) |
| 1320 | { |
| 1321 | const Box& bx = boxes[i]; |
| 1322 | tokens.push_back(makeSFCToken(i, bx.smallEnd())); |
| 1323 | } |
| 1324 | // |
| 1325 | // Put'm in Morton space filling curve order. |
| 1326 | // |
| 1327 | std::ranges::sort(tokens, SFCToken::Compare()); |
| 1328 | // |
| 1329 | // Split'm up as equitably as possible per team. |
| 1330 | // |
| 1331 | Real volperteam = 0; |
| 1332 | for (Long wt : wgts) { |
| 1333 | volperteam += static_cast<Real>(wt); |
| 1334 | } |
| 1335 | volperteam /= static_cast<Real>(nteams); |
| 1336 | |
| 1337 | std::vector< std::vector<int> > vec(nteams); |
nothing calls this directly
no test coverage detected