Skip to content

Commit 85599a8

Browse files
authored
Merge pull request #524 from dash-project/feat-halo
Feat halo
2 parents 81c4cc1 + 6c178e4 commit 85599a8

File tree

9 files changed

+1771
-1021
lines changed

9 files changed

+1771
-1021
lines changed

dash/examples/ex.02.matrix.halo.heat_equation/main.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ using matrix_t = dash::Matrix<
1111
double, 2,
1212
typename pattern_t::index_type,
1313
pattern_t>;
14-
using StencilT = dash::StencilPoint<2>;
15-
using StencilSpecT = dash::StencilSpec<StencilT,4>;
16-
using GlobBoundSpecT = dash::GlobalBoundarySpec<2>;
17-
using HaloMatrixWrapperT = dash::HaloMatrixWrapper<matrix_t>;
14+
using StencilT = dash::halo::StencilPoint<2>;
15+
using StencilSpecT = dash::halo::StencilSpec<StencilT,4>;
16+
using GlobBoundSpecT = dash::halo::GlobalBoundarySpec<2>;
17+
using HaloMatrixWrapperT = dash::halo::HaloMatrixWrapper<matrix_t>;
1818

1919
using array_t = dash::Array<double>;
2020

@@ -48,9 +48,6 @@ int main(int argc, char *argv[])
4848
cerr << "Not enough arguments ./<prog> matrix_ext iterations" << endl;
4949
return 1;
5050
}
51-
using HaloBlockT = dash::HaloBlock<double,pattern_t>;
52-
using HaloMemT = dash::HaloMemory<HaloBlockT>;
53-
5451
auto matrix_ext = std::atoi(argv[1]);
5552
auto iterations = std::atoi(argv[2]);
5653

@@ -87,16 +84,16 @@ int main(int argc, char *argv[])
8784

8885
StencilSpecT stencil_spec( StencilT(-1, 0), StencilT(1, 0), StencilT( 0, -1), StencilT(0, 1));
8986

90-
GlobBoundSpecT bound_spec(dash::BoundaryProp::CYCLIC, dash::BoundaryProp::CYCLIC);
87+
GlobBoundSpecT bound_spec(dash::halo::BoundaryProp::CYCLIC, dash::halo::BoundaryProp::CYCLIC);
9188

9289
HaloMatrixWrapperT halomat(matrix, bound_spec, stencil_spec);
9390
HaloMatrixWrapperT halomat2(matrix2, bound_spec, stencil_spec);
9491

9592
auto stencil_op = halomat.stencil_operator(stencil_spec);
9693
auto stencil_op2 = halomat2.stencil_operator(stencil_spec);
9794

98-
decltype(stencil_op)* current_op = &stencil_op;
99-
decltype(stencil_op2)* new_op = &stencil_op2;
95+
auto* current_op = &stencil_op;
96+
auto* new_op = &stencil_op2;
10097

10198
HaloMatrixWrapperT* current_halo = &halomat;
10299
HaloMatrixWrapperT* new_halo = &halomat2;
@@ -146,8 +143,8 @@ int main(int argc, char *argv[])
146143
}
147144
#endif
148145
// slow version
149-
auto it_end = current_op->iend();
150-
for(auto it = current_op->ibegin(); it != it_end; ++it)
146+
auto it_end = current_op->inner.end();
147+
for(auto it = current_op->inner.begin(); it != it_end; ++it)
151148
{
152149
auto core = *it;
153150
auto dtheta = (it.value_at(0) + it.value_at(1) - 2 * core) / (dx * dx) +
@@ -159,8 +156,8 @@ int main(int argc, char *argv[])
159156
current_halo->wait();
160157

161158
// Calculation of boundary Halo elements
162-
auto it_bend = current_op->bend();
163-
for (auto it = current_op->bbegin(); it != it_bend; ++it) {
159+
auto it_bend = current_op->boundary.end();
160+
for (auto it = current_op->boundary.begin(); it != it_bend; ++it) {
164161
auto core = *it;
165162
double dtheta =
166163
(it.value_at(0) + it.value_at(1) - 2 * core) / (dx * dx) +

dash/examples/ex.11.halo-stencil/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ using element_t = unsigned char;
3636
using Pattern_t = dash::Pattern<2>;
3737
using index_t = typename Pattern_t::index_type;
3838
using Array_t = dash::NArray<element_t, 2, index_t, Pattern_t>;
39-
using StencilP_t = dash::StencilPoint<2>;
40-
using StencilSpec_t = dash::StencilSpec<StencilP_t,4>;
41-
using HaloWrapper_t = dash::HaloMatrixWrapper<Array_t>;
39+
using StencilP_t = dash::halo::StencilPoint<2>;
40+
using StencilSpec_t = dash::halo::StencilSpec<StencilP_t,4>;
41+
using HaloWrapper_t = dash::halo::HaloMatrixWrapper<Array_t>;
4242

4343
void write_pgm(const std::string & filename, const Array_t & data){
4444
if(dash::myid() == 0){
@@ -151,8 +151,8 @@ void smooth(HaloWrapper_t & halo_old, HaloWrapper_t & halo_new,
151151
halo_old.wait();
152152

153153
// Calculation of boundary Halo elements
154-
auto bend = op_old.bend();
155-
for(auto it = op_old.bbegin(); it != bend; ++it)
154+
auto bend = op_old.boundary.end();
155+
for(auto it = op_old.boundary.begin(); it != bend; ++it)
156156
{
157157
auto core = *it;
158158
*(nlptr+it.lpos()) = (0.40 * core) +

0 commit comments

Comments
 (0)