Skip to content

Commit

Permalink
Merge pull request #154 from dash-project/bug-153-group-units
Browse files Browse the repository at this point in the history
Fixed random unit groups in TeamLocalityTest.GroupUnits
  • Loading branch information
devreal authored Nov 23, 2016
2 parents 0aa28a0 + f22b23b commit f961685
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions dash/test/TeamLocalityTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST_F(TeamLocalityTest, SplitNUMA)
TEST_F(TeamLocalityTest, GroupUnits)
{
if (dash::size() < 4) {
return;
SKIP_TEST();
}
if (_dash_id != 0) {
return;
Expand All @@ -143,20 +143,22 @@ TEST_F(TeamLocalityTest, GroupUnits)
std::vector<std::string> group_2_tags;
std::vector<std::string> group_3_tags;

// Put the first 2 units in group 1:
group_1_units.push_back(0);
group_1_units.push_back(1);
// Put every third unit in group 2, starting at rank 3:
for (size_t u = 3; u < dash::size(); u += 3) {
group_2_units.push_back(u);
}
// Put every second unit in group 3, starting at center:
for (size_t u = dash::size() / 2; u < dash::size(); u += 2) {
// Domains must not be members of more than one group:
if (u % 3 != 0) {
group_3_units.push_back(u);
}
std::vector<dart_unit_t> shuffled_unit_ids;
for (size_t u = 0; u < dash::size(); u++) {
shuffled_unit_ids.push_back(u);
}
std::random_shuffle(shuffled_unit_ids.begin(), shuffled_unit_ids.end());

// Put the first 2 units in group 1:
group_1_units.push_back(shuffled_unit_ids.back());
shuffled_unit_ids.pop_back();
group_1_units.push_back(shuffled_unit_ids.back());
shuffled_unit_ids.pop_back();

group_2_units.push_back(shuffled_unit_ids.back());
shuffled_unit_ids.pop_back();

group_3_units = shuffled_unit_ids;

for (dart_unit_t u : group_1_units) {
group_1_tags.push_back(tloc.unit_locality(u).domain_tag());
Expand All @@ -168,9 +170,12 @@ TEST_F(TeamLocalityTest, GroupUnits)
group_3_tags.push_back(tloc.unit_locality(u).domain_tag());
}

DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group 1:", group_1_tags);
DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group 2:", group_2_tags);
DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group 3:", group_3_tags);
DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group 1:",
group_1_units, group_1_tags);
DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group 2:",
group_2_units, group_2_tags);
DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group 3:",
group_3_units, group_3_tags);

if (group_1_tags.size() > 1) {
DASH_LOG_DEBUG("TeamLocalityTest.GroupUnits", "group:", group_1_tags);
Expand Down

0 comments on commit f961685

Please sign in to comment.