Skip to content

Commit 7061962

Browse files
committed
review fixes
change to a floating point number remove unused variables
1 parent 60d1060 commit 7061962

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

.github/workflows/docker_workflow.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ jobs:
5050
mpirun -n 3 ./build/src/example1
5151
mpirun -n 3 ./build/src/example2
5252
mpirun -n 3 ./build/src/example3
53+
mpirun -n 3 ./build/src/example4
5354
mpirun -n 3 ./build/src/example5

scripts/build_run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ cmake --build build -j
1313
mpirun -n 2 ./build/src/example1
1414
mpirun -n 2 ./build/src/example2
1515
mpirun -n 2 ./build/src/example3
16+
mpirun -n 2 ./build/src/example4
1617
mpirun -n 2 ./build/src/example5

src/example5.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77

88
namespace mhp = dr::mhp;
99

10-
using T = uint16_t;
10+
using T = float;
1111
using MDA = dr::mhp::distributed_mdarray<T, 2>;
1212

13+
/* 2d stencil - simple operation on multi-dimensional array */
1314
int main() {
14-
#ifdef SYCL_LANGUAGE_VERSION
1515
mhp::init(sycl::default_selector_v);
16-
#else
17-
mhp::init();
18-
#endif
16+
1917
std::size_t arr_size = 4;
2018
std::size_t radius = 1;
2119
std::array slice_starts{radius, radius};
@@ -29,15 +27,13 @@ int main() {
2927

3028
auto in = dr::mhp::views::submdspan(a.view(), slice_starts, slice_ends);
3129
auto out = dr::mhp::views::submdspan(b.view(), slice_starts, slice_ends);
32-
auto in_array = &a;
33-
auto out_array = &b;
3430

3531
auto mdspan_stencil_op = [](auto &&v) {
3632
auto [in, out] = v;
3733
out(0, 0) = (in(-1, 0) + in(0, -1) + in(0, 0) + in(0, 1) + in(1, 0)) / 4;
3834
};
3935

40-
mhp::halo(*in_array).exchange();
36+
mhp::halo(a).exchange();
4137
mhp::stencil_for_each(mdspan_stencil_op, in, out);
4238

4339
if (mhp::rank() == 0) {

0 commit comments

Comments
 (0)