You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extending the example in #656 even further by copying the values back to the larger team by the smaller team, reveals that the local-to-global mode of dash::copy also does not work
#include<iostream>
#include<libdash.h>intmain(int ac, char *av[])
{
using TeamSpecT = dash::TeamSpec<2>;
using MatrixT = dash::NArray<double, 2>;
using PatternT = typename MatrixT::pattern_type;
using SizeSpecT = dash::SizeSpec<2>;
using DistSpecT = dash::DistributionSpec<2>;
dash::init(&ac, &av);
auto size_spec = SizeSpecT(8, 8);
auto dist_spec = DistSpecT(dash::BLOCKED, dash::BLOCKED);
auto& team_all = dash::Team::All();
TeamSpecT team_all_spec(team_all.size(), 1);
team_all_spec.balance_extents();
MatrixT grid_more(size_spec, dist_spec, team_all, team_all_spec);
dash::fill(grid_more.begin(), grid_more.end(), (double)team_all.myid());
team_all.barrier();
auto gextents = grid_more.extents();
if (team_all.myid() == 0) {
std::cout << "init\n";
for ( uint32_t y = 0; y < gextents[0]; ++y) {
std::cout << "[" << std::setw(2) << y << "] := {";
for (uint32_t x = 0; x < gextents[1]; ++x)
std::cout << "" << std::setw(2) << (double)grid_more[y][x];
std::cout << "}\n";
}
}
dash::Team& team_fewer= team_all.split(4);
team_all.barrier();
if (!team_fewer.is_null() && 0 == team_fewer.position()) {
TeamSpecT team_fewer_spec(team_fewer.size(), 1);
team_fewer_spec.balance_extents();
MatrixT grid_fewer(size_spec, dist_spec, team_fewer, team_fewer_spec);
dash::fill(grid_fewer.begin(), grid_fewer.end(), -1.0);
auto lextents= grid_fewer.pattern().local_extents();
for (uint32_t y = 0; y < lextents[0]; ++y) {
auto gcorner_fewer = grid_fewer.pattern().global({y, 0});
auto gbegin = grid_more.begin() + grid_more.pattern().global_at(gcorner_fewer);
auto loffset = grid_fewer.pattern().local_at({y, 0});
dash::copy(gbegin, gbegin + lextents[1],
grid_fewer.lbegin() + loffset);
}
team_fewer.barrier();
if (team_fewer.myid() == 0) {
std::cout << "subteam " << 0 << "\n";
auto gextents = grid_fewer.extents();
for ( uint32_t y = 0; y < gextents[0]; ++y) {
std::cout << "[" << std::setw(2) << y << "] := {";
for (uint32_t x = 0; x < gextents[1]; ++x)
std::cout << "" << std::setw(2) << (double)grid_fewer[y][x];
std::cout << "}\n";
}
}
team_fewer.barrier();
dash::fill(grid_fewer.begin(), grid_fewer.end(), (double)team_all.myid());
for (uint32_t y = 0; y < lextents[0]; ++y) {
auto gcorner_fewer = grid_fewer.pattern().global({y, 0});
auto gbegin = grid_more.begin() + grid_more.pattern().global_at(gcorner_fewer);
auto lbegin = grid_fewer.lbegin() + grid_fewer.pattern().local_at({y, 0});
dash::copy(lbegin, lbegin + lextents[1],
gbegin);
}
team_fewer.barrier();
}
team_all.barrier();
if (team_all.myid() == 0) {
std::cout << "final\n";
for ( uint32_t y = 0; y < gextents[0]; ++y) {
std::cout << "[" << std::setw(2) << y << "] := {";
for (uint32_t x = 0; x < gextents[1]; ++x)
std::cout << "" << std::setw(2) << (double)grid_more[y][x];
std::cout << "}\n";
}
}
team_all.barrier();
dash::finalize();
return0;
}
Extending the example in #656 even further by copying the values back to the larger team by the smaller team, reveals that the local-to-global mode of
dash::copy
also does not workThe result with 4 units should be:
but I get:
For 16 units the correct result is:
The faulty result:
The text was updated successfully, but these errors were encountered: