Skip to content

Commit

Permalink
Fix three bugs:
Browse files Browse the repository at this point in the history
1) Insufficient memory allocation for scatter_matrix packing (needed to round up to MR/NR).
2) Calling destructor on the wrong pointers in indexed_(dpd_)?varray. Currently these are only used with scalar elements so no real error, but would be a problem if non-trivial elements were used.
3) Modify/capture race condition in indexed_dpd/mult.cxx.
  • Loading branch information
devinamatthews committed Aug 15, 2019
1 parent d25d0bb commit 922a4dc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/external/marray/include/indexed_dpd_varray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ class indexed_dpd_varray : public indexed_dpd_varray_base<Type, indexed_dpd_varr
{
if (storage_.size > 0)
{
for (stride_type i = storage_.size/dense_size();i --> 0;)
for (stride_type i = storage_.size;i --> 0;)
{
alloc_traits::destroy(storage_, data_[i]);
alloc_traits::destroy(storage_, data_[0]+i);
}
alloc_traits::deallocate(storage_, data_[0], storage_.size);
storage_.size = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/external/marray/include/indexed_varray.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class indexed_varray : public indexed_varray_base<Type, indexed_varray<Type, All
{
for (stride_type i = storage_.size;i --> 0;)
{
alloc_traits::destroy(storage_, data_[i]);
alloc_traits::destroy(storage_, data_[0]+i);
}
alloc_traits::deallocate(storage_, data_[0], storage_.size);
storage_.size = 0;
Expand Down
4 changes: 3 additions & 1 deletion src/internal/3t/indexed_dpd/mult.cxx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ void mult_block(const communicator& comm, const config& cfg,
{
if (indices_C[idx_C].factor == T(0)) return;

tasks.visit(idx++,
tasks.visit(idx,
[&,idx,idx_A,idx_B,idx_C,next_A,next_B]
(const communicator& subcomm)
{
Expand Down Expand Up @@ -982,6 +982,8 @@ void mult_block(const communicator& comm, const config& cfg,
TensorGEMM{}(subcomm, cfg, factor, at, bt, T(1), ct);
});
});

idx++;
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/nodes/matrify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ allocate_buffers(len_type MB, len_type NB, Matrify& parent, Child& child,

if (!child.pack_ptr)
{
len_type m = A.length(0);
len_type n = A.length(1);
len_type m = A.length(0) + (MB-1);
len_type n = A.length(1) + (NB-1);

if (comm.master())
{
Expand Down

0 comments on commit 922a4dc

Please sign in to comment.