File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,24 @@ class ViewBroadcast
2222 using view_type = Unmanaged<ToView>;
2323 using reference_type = typename view_type::reference_type;
2424
25+ ViewBroadcast () = default ;
26+
27+ template <typename FromView>
28+ ViewBroadcast (const FromView& from_v,
29+ const std::vector<int >& extents)
30+ {
31+ setup (from_v,extents);
32+ }
33+
2534 // Broadcast an input view to the type provided by the class template arg
2635 // - from_v: view to be broadcasted
2736 // - extents: list of extents of the outfacing view (of type ToView).
2837 // Must have rank=ToView::rank(). Must contain FromView::rank() entries
2938 // that are <=0, which signal that those dimensions' extents will be
3039 // retrieved from the input view.
3140 template <typename FromView>
32- ViewBroadcast (const FromView& from_v,
33- const std::vector<int >& extents)
41+ void setup (const FromView& from_v,
42+ const std::vector<int >& extents)
3443 {
3544 constexpr int from_rank = FromView::rank ();
3645 constexpr int to_rank = ToView::rank ();
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ TEST_CASE("view_broadcast") {
4545 SECTION (" along d0" ) {
4646 d0 = 4 ;
4747 d1 = n;
48- auto b2d = broadcast<view_2d>(orig,{d0,-1 });
48+ ViewBroadcast<view_2d> b2d;
49+ b2d.setup (orig,{d0,-1 });
4950
5051 int err = 0 ;
5152 auto lambda = KOKKOS_LAMBDA (int idx, int & l_err) {
You can’t perform that action at this time.
0 commit comments