File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,8 @@ add_executable(example3 example3.cpp)
26
26
27
27
target_compile_definitions (example3 INTERFACE DR_FORMAT )
28
28
target_link_libraries (example3 DR::mpi fmt::fmt )
29
+
30
+ add_executable (example4 example4.cpp )
31
+
32
+ target_compile_definitions (example4 INTERFACE DR_FORMAT )
33
+ target_link_libraries (example4 DR::mpi fmt::fmt )
Original file line number Diff line number Diff line change
1
+ // SPDX-FileCopyrightText: Intel Corporation
2
+ //
3
+ // SPDX-License-Identifier: BSD-3-Clause
4
+
5
+ #include < dr/mhp.hpp>
6
+ #include < fmt/core.h>
7
+
8
+ namespace mhp = dr::mhp;
9
+ using T = int ;
10
+
11
+ int main (int argc, char **argv) {
12
+
13
+ mhp::init (sycl::default_selector_v);
14
+ std::size_t xdim = 9 , ydim = 5 ;
15
+
16
+ std::array<std::size_t , 2 > extents2d = {xdim, ydim};
17
+
18
+ mhp::distributed_mdarray<T, 2 > a (extents2d);
19
+ mhp::distributed_mdarray<T, 2 > b (extents2d);
20
+ mhp::distributed_mdarray<T, 2 > c (extents2d);
21
+ mhp::iota (a, 100 );
22
+ mhp::iota (b, 200 );
23
+
24
+ auto copy_op = [](auto v) {
25
+ auto [in1, in2, out] = v;
26
+ out = in1 + in2;
27
+ };
28
+ mhp::for_each (copy_op, a, b, c);
29
+
30
+ if (mhp::rank () == 0 ) {
31
+ fmt::print (" A:\n {}\n " , a.mdspan ());
32
+ fmt::print (" B:\n {}\n " , b.mdspan ());
33
+ fmt::print (" C:\n {}\n " , c.mdspan ());
34
+ }
35
+
36
+ mhp::finalize ();
37
+
38
+ return 0 ;
39
+ }
You can’t perform that action at this time.
0 commit comments