Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 125 array team #135

Merged
merged 7 commits into from
Nov 22, 2016
4 changes: 2 additions & 2 deletions dash/include/dash/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ class Array
m_begin = iterator(m_globmem, m_pattern);
m_end = iterator(m_begin) + m_size;
// Local iterators:
m_lbegin = m_globmem->lbegin(m_myid);
m_lbegin = m_globmem->lbegin();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not explicitly set unit id

// More efficient than using m_globmem->lend as this a second mapping
// of the local memory segment:
m_lend = m_lbegin + m_lsize;
Expand Down Expand Up @@ -1204,7 +1204,7 @@ class Array
m_begin = iterator(m_globmem, pattern);
m_end = iterator(m_begin) + m_size;
// Local iterators:
m_lbegin = m_globmem->lbegin(m_myid);
m_lbegin = m_globmem->lbegin();
// More efficient than using m_globmem->lend as this a second mapping
// of the local memory segment:
m_lend = m_lbegin + pattern.local_size();
Expand Down
8 changes: 4 additions & 4 deletions dash/include/dash/GlobMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class GlobMem
_begptr = _allocator.allocate(_nlelem);
DASH_ASSERT_MSG(!DART_GPTR_ISNULL(_begptr), "allocation failed");

_lbegin = lbegin(team.myid());
_lend = lend(team.myid());
_lbegin = lbegin(dash::myid());
_lend = lend(dash::myid());
DASH_LOG_TRACE("GlobMem(nlocal,team) >");
}

Expand Down Expand Up @@ -158,8 +158,8 @@ class GlobMem
_begptr = _allocator.allocate(_nlelem);
DASH_ASSERT_MSG(!DART_GPTR_ISNULL(_begptr), "allocation failed");

_lbegin = lbegin(team.myid());
_lend = lend(team.myid());
_lbegin = lbegin(dash::myid());
_lend = lend(dash::myid());
// Initialize allocated local elements with specified values:
auto copy_end = std::copy(local_elements.begin(),
local_elements.end(),
Expand Down
16 changes: 16 additions & 0 deletions dash/test/ArrayTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,20 @@ TEST_F(ArrayTest, ConstructorNelemInitializerList)
}
}

TEST_F(ArrayTest, TeamSplit)
{
auto & team_all = dash::Team::All();
auto ext_x = team_all.size();

if(team_all.size() < 2){
SKIP_TEST();
}

auto & myteam = team_all.split(2);
auto array_a = dash::Array<double>(ext_x, myteam);

array_a.barrier();
// Check if array is allocated
ASSERT_NE_U(array_a.lbegin(), nullptr);
team_all.barrier();
}
2 changes: 1 addition & 1 deletion dash/test/GlobMemTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ TEST_F(GlobMemTest, LocalBegin)
for (int l = 0; l < target_local_elements.size(); l++) {
EXPECT_EQ_U(*(target_local_elements.begin() + l), target.lbegin()[l]);
}
EXPECT_NE_U(target.lbegin(), nullptr);
}