2
2
//
3
3
// SPDX-License-Identifier: BSD-3-Clause
4
4
5
- #include < dr/mhp .hpp>
5
+ #include < dr/mp .hpp>
6
6
#include < fmt/core.h>
7
7
8
- namespace mhp = dr::mhp;
9
-
10
8
using T = uint16_t ;
11
- using MDA = dr::mhp ::distributed_mdarray<T, 2 >;
9
+ using MDA = dr::mp ::distributed_mdarray<T, 2 >;
12
10
13
11
/* 2D pattern search in a distributed multidimensional (2D) array */
14
12
int main () {
15
- mhp ::init (sycl::default_selector_v);
13
+ dr::mp ::init (sycl::default_selector_v);
16
14
17
15
std::size_t arr_size = 7 ;
18
16
// keep in mind that if you change the pattern size, you have to also change
@@ -22,16 +20,16 @@ int main() {
22
20
std::array slice_starts{radius - 1 , radius - 1 };
23
21
std::array slice_ends{arr_size - radius, arr_size - radius};
24
22
25
- auto dist = dr::mhp ::distribution ().halo (radius);
23
+ auto dist = dr::mp ::distribution ().halo (radius);
26
24
MDA a ({arr_size, arr_size}, dist);
27
25
MDA occurrences_coords ({arr_size, arr_size});
28
26
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 );
32
30
33
31
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);
35
33
int pattern[pattern_size][pattern_size] = {{1 , 0 }, {0 , 1 }};
36
34
37
35
auto mdspan_pattern_op = [pattern](auto &&v) {
@@ -44,16 +42,16 @@ int main() {
44
42
}
45
43
};
46
44
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);
49
47
50
- if (mhp ::rank () == 0 ) {
48
+ if (dr::mp ::rank () == 0 ) {
51
49
fmt::print (" a: \n {} \n " , a.mdspan ());
52
50
fmt::print (" pattern: \n {} \n " , pattern);
53
51
fmt::print (" occurrences: \n {} \n " , occurrences_coords.mdspan ());
54
52
}
55
53
56
- mhp ::finalize ();
54
+ dr::mp ::finalize ();
57
55
58
56
return 0 ;
59
57
}
0 commit comments