diff --git a/external/versions.cmake b/external/versions.cmake index 78c015ec79..f5565d299c 100644 --- a/external/versions.cmake +++ b/external/versions.cmake @@ -12,8 +12,8 @@ set(TA_INSTALL_EIGEN_URL_HASH SHA256=b4c198460eba6f28d34894e3a5710998818515104d6 set(TA_INSTALL_EIGEN_PREVIOUS_URL_HASH MD5=b9e98a200d2455f06db9c661c5610496) set(TA_TRACKED_MADNESS_URL https://github.com/m-a-d-n-e-s-s/madness.git CACHE STRING "GIT_REPOSITORY for cloning MADNESS source") -set(TA_TRACKED_MADNESS_TAG f7aa1401e CACHE STRING "GIT_TAG (branch or hash) for cloning MADNESS") -set(TA_TRACKED_MADNESS_PREVIOUS_TAG 7d8aaf9d51981e4accf4d84742270d1473f8ca2e) +set(TA_TRACKED_MADNESS_TAG 666765ca6 CACHE STRING "GIT_TAG (branch or hash) for cloning MADNESS") +set(TA_TRACKED_MADNESS_PREVIOUS_TAG f7aa1401e) set(TA_TRACKED_MADNESS_VERSION 0.10.1) set(TA_TRACKED_MADNESS_PREVIOUS_VERSION 0.10.1) diff --git a/src/TiledArray/array_impl.h b/src/TiledArray/array_impl.h index f6dff7f066..ecec74fc21 100644 --- a/src/TiledArray/array_impl.h +++ b/src/TiledArray/array_impl.h @@ -480,6 +480,24 @@ class ArrayImpl : public TensorImpl, // wait for all DelayedSet's to vanish world.await([&]() { return (pimpl->num_live_ds() == 0); }, true); + // Fast path when invoked from inside the fence's deferred-cleanup + // phase: the global-termination protocol has already established + // global quiescence (no in-flight AM, all ranks at the same point), + // and symmetric collective use of `defer_deleter_to_next_fence()` + // guarantees every rank has this same pimpl in its deferred list + // and so reaches this same delete in lockstep. The cross-rank + // lazy_sync handshake below is therefore redundant; it would also + // schedule a lazy_sync_children task on this world's taskq that the + // fence cannot drain (do_cleanup runs after the drain loop) and + // that would later be run by some unrelated fence -- against freed + // state if this world is destroyed before then (e.g. einsum's + // per-Hadamard sub-Worlds). + if (world.gop.is_in_do_cleanup()) { + delete pimpl; + cleanup_counter_--; + return; + } + try { world.gop.lazy_sync(id, [pimpl]() { delete pimpl;