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
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Both methods are supported. However, for most users we _strongly_ recommend to b
- Boost.Range: header-only, *only used for unit testing*
- [BTAS](http://github.com/ValeevGroup/BTAS), tag d7794799e4510cf66844081dd8f1f5b648112d33 . If usable BTAS installation is not found, TiledArray will download and compile
BTAS from source. *This is the recommended way to compile BTAS for all users*.
- [MADNESS](https://github.com/m-a-d-n-e-s-s/madness), tag b378fd6f1fcadf1cd1ce4541ca4100c335b874ee .
- [MADNESS](https://github.com/m-a-d-n-e-s-s/madness), tag 7ce06234c23aa8e0ab3d9e9b87eff9cd85390d80 .
Only the MADworld runtime and BLAS/LAPACK C API component of MADNESS is used by TiledArray.
If usable MADNESS installation is not found, TiledArray will download and compile
MADNESS from source. *This is the recommended way to compile MADNESS for all users*.
Expand Down
4 changes: 2 additions & 2 deletions external/versions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ set(TA_INSTALL_EIGEN_PREVIOUS_VERSION 3.3.7)
set(TA_INSTALL_EIGEN_URL_HASH b9e98a200d2455f06db9c661c5610496)
set(TA_INSTALL_EIGEN_PREVIOUS_URL_HASH b9e98a200d2455f06db9c661c5610496)

set(TA_TRACKED_MADNESS_TAG b378fd6f1fcadf1cd1ce4541ca4100c335b874ee)
set(TA_TRACKED_MADNESS_PREVIOUS_TAG dbda9f901134314eb73deb0ec5b499d178556642)
set(TA_TRACKED_MADNESS_TAG 7ce06234c23aa8e0ab3d9e9b87eff9cd85390d80)
set(TA_TRACKED_MADNESS_PREVIOUS_TAG b378fd6f1fcadf1cd1ce4541ca4100c335b874ee)
set(TA_TRACKED_MADNESS_VERSION 0.10.1)
set(TA_TRACKED_MADNESS_PREVIOUS_VERSION 0.10.1)

Expand Down
31 changes: 26 additions & 5 deletions src/TiledArray/distributed_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ class DistributedStorage : public madness::WorldObject<DistributedStorage<T> > {
DistributedStorage(const DistributedStorage_&);
DistributedStorage_& operator=(const DistributedStorage_&);

void set_handler(const size_type i, const value_type& value) {
template <typename Value>
std::enable_if_t<std::is_same_v<std::decay_t<Value>,value_type>, void>
set_handler(const size_type i, Value&& value) {
future& f = get_local(i);

// Check that the future has not been set already.
TA_ASSERT(!f.probe() && "Tile has already been assigned.");

f.set(value);
f.set(std::forward<Value>(value));
}

void get_handler(const size_type i,
Expand All @@ -87,8 +89,10 @@ class DistributedStorage : public madness::WorldObject<DistributedStorage<T> > {
remote_f.set(f);
}

void set_remote(const size_type i, const value_type& value) {
WorldObject_::task(owner(i), &DistributedStorage_::set_handler, i, value,
template <typename Value>
std::enable_if_t<std::is_same_v<std::decay_t<Value>,value_type> || std::is_same_v<std::decay_t<Value>,future>, void>
set_remote(const size_type i, Value&& value) {
WorldObject_::task(owner(i), &DistributedStorage_::set_handler<std::decay_t<value_type>&>, i, std::forward<Value>(value),
madness::TaskAttributes::hipri());
}

Expand Down Expand Up @@ -249,7 +253,8 @@ class DistributedStorage : public madness::WorldObject<DistributedStorage<T> > {
/// \param i The element to be set
/// \param value The value of element \c i
/// \throw TiledArray::Exception If \c i is greater than or equal to \c
/// max_size() . \throw madness::MadnessException If \c i has already been
/// max_size() .
/// \throw madness::MadnessException If \c i has already been
/// set.
void set(size_type i, const value_type& value) {
TA_ASSERT(i < max_size_);
Expand All @@ -259,6 +264,22 @@ class DistributedStorage : public madness::WorldObject<DistributedStorage<T> > {
set_remote(i, value);
}

/// Set element \c i with \c value

/// \param i The element to be set
/// \param value The value of element \c i
/// \throw TiledArray::Exception If \c i is greater than or equal to \c
/// max_size() .
/// \throw madness::MadnessException If \c i has already been
/// set.
void set(size_type i, value_type&& value) {
TA_ASSERT(i < max_size_);
if (is_local(i))
set_handler(i, std::move(value));
else
set_remote(i, std::move(value));
}

/// Set element \c i with a \c Future \c f

/// The owner of \c i may be local or remote. If \c i is remote, a task
Expand Down