Skip to content

Commit

Permalink
Fix bug in sptensor create_mirror_view that wasn't handling global su…
Browse files Browse the repository at this point in the history
…bs correctly
  • Loading branch information
etphipp committed Nov 2, 2024
1 parent 62d70e3 commit d98651e
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/Genten_Sptensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,29 @@ typename SptensorT<ExecSpace>::HostMirror
create_mirror_view(const SptensorT<ExecSpace>& a)
{
typedef typename SptensorT<ExecSpace>::HostMirror HostMirror;
HostMirror hm( create_mirror_view(a.size()),
create_mirror_view(a.getValues()),
create_mirror_view(a.getSubscripts()),
create_mirror_view(a.getPerm()),
a.isSorted() );
HostMirror hm;
if (a.getGlobalSubscripts().data() == a.getSubscripts().data()) {
// When subs_gids aliases gids, don't create a new view for subs_gids
auto sv = create_mirror_view(a.getSubscripts());
hm = HostMirror( create_mirror_view(a.size()),
create_mirror_view(a.getValues()),
sv,
create_mirror_view(a.getPerm()),
a.isSorted(),
sv,
create_mirror_view(a.getLowerBounds()),
create_mirror_view(a.getUpperBounds()) );
}
else {
hm = HostMirror( create_mirror_view(a.size()),
create_mirror_view(a.getValues()),
create_mirror_view(a.getSubscripts()),
create_mirror_view(a.getPerm()),
a.isSorted(),
create_mirror_view(a.getGlobalSubscripts()),
create_mirror_view(a.getLowerBounds()),
create_mirror_view(a.getUpperBounds()) );
}
hm.copy_extra_data(a);
return hm;
}
Expand Down

0 comments on commit d98651e

Please sign in to comment.