1 #ifndef DASH__ALGORITHM__BCAST_H__ 2 #define DASH__ALGORITHM__BCAST_H__ 4 #include <dash/iterator/GlobIter.h> 5 #include <dash/iterator/IteratorTraits.h> 8 #include <dash/Shared.h> 9 #include <dash/algorithm/LocalRange.h> 10 #include <dash/Coarray.h> 21 template<
class LocalInputIter>
24 LocalInputIter in_first,
25 LocalInputIter in_last,
28 std::random_access_iterator_tag)
30 using value_t =
typename std::iterator_traits<LocalInputIter>::value_type;
31 auto myid = team.myid();
40 template<
class LocalInputIter,
class IterTag>
43 LocalInputIter in_first,
44 LocalInputIter in_last,
49 using value_t =
typename std::iterator_traits<LocalInputIter>::value_type;
52 std::vector<value_t> tmp(in_first, in_last);
56 std::random_access_iterator_tag{});
59 if (team.myid() != root) {
60 std::copy(tmp.begin(), tmp.end(), in_first);
91 typename =
typename std::enable_if<
92 !dash::detail::is_global_iterator<LocalInputIter>::value
96 LocalInputIter in_first,
97 LocalInputIter in_last,
102 in_first, in_last, root, team,
103 typename std::iterator_traits<LocalInputIter>::iterator_category());
123 template <
class ValueType>
127 auto& team = shared.
team();
128 auto owner = shared.
owner();
129 ValueType *ptr = (team.myid() == owner) ? shared.
local() : std::addressof(res);
158 #endif // DASH__ALGORITHM__BCAST_H__ global_unit_t myid()
Shortcut to query the global unit ID of the calling unit.
dash::Team & team() const noexcept
The dash::Team that created this shared object.
This class is a simple memory pool which holds allocates elements of size ValueType.
RandomAccessIt::difference_type distance(const RandomAccessIt &first, const RandomAccessIt &last)
Resolve the number of elements between two iterators.
dart_ret_t dart_bcast(void *buf, size_t nelem, dart_datatype_t dtype, dart_team_unit_t root, dart_team_t team)
DART Equivalent to MPI broadcast.
A Team instance specifies a subset of all available units.
void broadcast(LocalInputIter in_first, LocalInputIter in_last, dash::team_unit_t root, dash::Team &team=dash::Team::All())
Broadcast the local range of elements [in_first, in_last) from unit root to all other units in team...
void cobroadcast(Coarray< T > &coarr, const team_unit_t &master)
Broadcasts the value on master to all other members of this co_array.
dash::team_unit_t owner() const noexcept
The unit owning the memory in the global address space.
struct dash::unit_id< dash::local_unit, dart_team_unit_t > team_unit_t
Unit ID to use for team-local IDs.
OutputIt copy(InputIt in_first, InputIt in_last, OutputIt out_first)
Copies the elements in the range, defined by [in_first, in_last), to another range beginning at out_f...
void broadcast(Coarray< T > &coarr, const team_unit_t &root)
Broadcasts the value on root to all other members of this co_array.
struct dash::dart_operation ValueType
Reduce operands to their minimum value.
Shared access to a value in global memory across a team.
constexpr value_type const * local() const noexcept
Native pointer to the starting address of the local memory of the unit that initialized this dash::Sh...
Convencience wrapper to determine the DART type and number of elements required for the given templat...
static Team & All()
The invariant Team instance containing all available units.
dart_team_t dart_id() const
Index of this team relative to global team dash::Team::All().