22//
33// SPDX-License-Identifier: BSD-3-Clause
44
5- #include < dr/mhp .hpp>
5+ #include < dr/mp .hpp>
66#include < fmt/core.h>
77
8- namespace mhp = dr::mhp;
9-
108using T = uint16_t ;
11- using MDA = dr::mhp ::distributed_mdarray<T, 2 >;
9+ using MDA = dr::mp ::distributed_mdarray<T, 2 >;
1210
1311/* 2D pattern search in a distributed multidimensional (2D) array */
1412int main () {
15- mhp ::init (sycl::default_selector_v);
13+ dr::mp ::init (sycl::default_selector_v);
1614
1715 std::size_t arr_size = 7 ;
1816 // keep in mind that if you change the pattern size, you have to also change
@@ -22,16 +20,16 @@ int main() {
2220 std::array slice_starts{radius - 1 , radius - 1 };
2321 std::array slice_ends{arr_size - radius, arr_size - radius};
2422
25- auto dist = dr::mhp ::distribution ().halo (radius);
23+ auto dist = dr::mp ::distribution ().halo (radius);
2624 MDA a ({arr_size, arr_size}, dist);
2725 MDA occurrences_coords ({arr_size, arr_size});
2826
29- mhp ::iota (a, 1 );
30- mhp ::transform (a, a.begin (), [](auto &&v) { return v % 2 ; });
31- mhp ::fill (occurrences_coords, 0 );
27+ dr::mp ::iota (a, 1 );
28+ dr::mp ::transform (a, a.begin (), [](auto &&v) { return v % 2 ; });
29+ dr::mp ::fill (occurrences_coords, 0 );
3230
3331 auto a_submdspan =
34- dr::mhp ::views::submdspan (a.view (), slice_starts, slice_ends);
32+ dr::mp ::views::submdspan (a.view (), slice_starts, slice_ends);
3533 int pattern[pattern_size][pattern_size] = {{1 , 0 }, {0 , 1 }};
3634
3735 auto mdspan_pattern_op = [pattern](auto &&v) {
@@ -44,16 +42,16 @@ int main() {
4442 }
4543 };
4644
47- mhp ::halo (a).exchange ();
48- mhp ::stencil_for_each (mdspan_pattern_op, a_submdspan, occurrences_coords);
45+ dr::mp ::halo (a).exchange ();
46+ dr::mp ::stencil_for_each (mdspan_pattern_op, a_submdspan, occurrences_coords);
4947
50- if (mhp ::rank () == 0 ) {
48+ if (dr::mp ::rank () == 0 ) {
5149 fmt::print (" a: \n {} \n " , a.mdspan ());
5250 fmt::print (" pattern: \n {} \n " , pattern);
5351 fmt::print (" occurrences: \n {} \n " , occurrences_coords.mdspan ());
5452 }
5553
56- mhp ::finalize ();
54+ dr::mp ::finalize ();
5755
5856 return 0 ;
5957}
0 commit comments