Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/TiledArray/array_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,14 @@ class ArrayImpl : public TensorImpl<Policy> {
return value;
}

/// Reports the number of live DelayedSet requests for this object's
/// DistributedStorage

/// @return const reference to the atomic counter of live DelayedSet requests
const madness::AtomicInt& num_live_ds() const {
return data_.num_live_ds();
}

}; // class ArrayImpl

#ifndef TILEDARRAY_HEADER_ONLY
Expand Down
3 changes: 3 additions & 0 deletions src/TiledArray/dist_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ class DistArray : public madness::archive::ParallelSerializableObject {
const madness::uniqueidT id = pimpl->id();
cleanup_counter_++;

// wait for all DelayedSet's to vanish
world.await([&]() { return (pimpl->num_live_ds() == 0); }, true);

try {
world.gop.lazy_sync(id, [pimpl]() {
delete pimpl;
Expand Down
6 changes: 6 additions & 0 deletions src/TiledArray/distributed_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ class DistributedStorage : public madness::WorldObject<DistributedStorage<T> > {
}
}

/// Reports the number of live DelayedSet requests

/// @return const reference to the atomic counter of live DelayedSet requests
const madness::AtomicInt& num_live_ds() const {
return num_live_ds_;
}
}; // class DistributedStorage

} // namespace detail
Expand Down