Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat halo #717

Merged
merged 76 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
114ade3
name change in RegionCoords: MaxIndex is NumRegionsMax now
dhinf Jun 5, 2019
56882fe
fixed update function of inner stencil operator for 2D specialization…
dhinf Jun 5, 2019
1fec0d7
enables assignment operator for StencilIterator
dhinf Jun 5, 2019
5609247
removed reference when returning coords
dhinf Jun 5, 2019
de705d2
fixed update in inner stencil operator
dhinf Jun 5, 2019
142a78a
added boundary region dependency check for bordering halo regions
dhinf Jun 7, 2019
a0183d5
now region border indicator uses a boolean for pre and post center area
dhinf Jun 13, 2019
fdd47a1
added mapped boundary regions to support region wise boundary iterator
dhinf Jun 20, 2019
6bf2531
Now halos are packed and transfered.
dhinf Jul 2, 2019
812a547
Merge branch 'development' of https://github.com/dash-project/dash in…
dhinf Jul 5, 2019
9c01036
fixed RegionIterator operator* and method dart_gptr(); some fixes pac…
dhinf Jul 5, 2019
b59a826
fixed region Region output, added signal for non packed but used halo…
dhinf Jul 10, 2019
289004e
added missing regions to _signal_handles
dhinf Jul 10, 2019
8a847a3
replaced volatile based busy waiting with dart_get and minor code opt…
dhinf Jul 12, 2019
fe46973
fixed move constructor and move and copy assignment operator
dhinf Jul 16, 2019
e83a085
replaced RegionIter with GlobViewIter -> reduced code redundancy
dhinf Jul 16, 2019
f8c2e47
optimized inner and outer stencil iterator
dhinf Jul 23, 2019
bd88aff
fixed bugs
dhinf Aug 9, 2019
42eece3
Merge branch 'development' of https://github.com/dash-project/dash in…
dhinf Aug 9, 2019
e2a13b2
fixed merge conflicts
dhinf Aug 9, 2019
3979a3e
fixed errors for different extents between local views
dhinf Aug 19, 2019
72a6ea7
added missing include
dhinf Aug 20, 2019
735fda0
started to clean up code and fix warnings
dhinf Dec 13, 2019
74d0a16
Allocated dynamic memory at page boundaries
devreal Feb 12, 2020
6080d7d
merge memalign
dhinf Feb 12, 2020
6e932b2
added new coordinate based access for the halo wrapper
dhinf Mar 28, 2020
cfd02ef
addef factory for stencil specs, for now only full stencil can be cre…
dhinf Mar 28, 2020
1f31220
fixed constructors
dhinf Mar 30, 2020
0cb993b
fixed wrong region_number in HaloSpec
dhinf Mar 30, 2020
c6521de
fix: region wise update (blocking and async)
dhinf Apr 1, 2020
b458839
first step of restructering
dhinf Apr 23, 2020
3c29e47
merge
dhinf Apr 27, 2020
401543e
fixed alias for stencil point value
dhinf May 27, 2020
6b5bfb1
name change in RegionCoords: MaxIndex is NumRegionsMax now
dhinf Jun 5, 2019
7d4f6ac
fixed update function of inner stencil operator for 2D specialization…
dhinf Jun 5, 2019
c606809
enables assignment operator for StencilIterator
dhinf Jun 5, 2019
9fe9227
removed reference when returning coords
dhinf Jun 5, 2019
c8313c0
fixed update in inner stencil operator
dhinf Jun 5, 2019
79e1c45
added boundary region dependency check for bordering halo regions
dhinf Jun 7, 2019
201a816
now region border indicator uses a boolean for pre and post center area
dhinf Jun 13, 2019
6a29e74
added mapped boundary regions to support region wise boundary iterator
dhinf Jun 20, 2019
ac4320c
Now halos are packed and transfered.
dhinf Jul 2, 2019
db6b165
fixed RegionIterator operator* and method dart_gptr(); some fixes pac…
dhinf Jul 5, 2019
ce0affa
fixed region Region output, added signal for non packed but used halo…
dhinf Jul 10, 2019
3a0e0a5
added missing regions to _signal_handles
dhinf Jul 10, 2019
98a0df5
replaced volatile based busy waiting with dart_get and minor code opt…
dhinf Jul 12, 2019
f4339e2
fixed move constructor and move and copy assignment operator
dhinf Jul 16, 2019
afccf0e
replaced RegionIter with GlobViewIter -> reduced code redundancy
dhinf Jul 16, 2019
915fc05
optimized inner and outer stencil iterator
dhinf Jul 23, 2019
5e5e1ad
fixed bugs
dhinf Aug 9, 2019
5601fe4
fixed merge conflicts
dhinf Aug 9, 2019
9b0074e
fixed errors for different extents between local views
dhinf Aug 19, 2019
688ed2c
added missing include
dhinf Aug 20, 2019
0078535
started to clean up code and fix warnings
dhinf Dec 13, 2019
ef9abb6
Allocated dynamic memory at page boundaries
devreal Feb 12, 2020
ecf5b6b
added new coordinate based access for the halo wrapper
dhinf Mar 28, 2020
8606b04
addef factory for stencil specs, for now only full stencil can be cre…
dhinf Mar 28, 2020
5f7c907
fixed constructors
dhinf Mar 30, 2020
7f199ce
fixed wrong region_number in HaloSpec
dhinf Mar 30, 2020
e34d000
fix: region wise update (blocking and async)
dhinf Apr 1, 2020
ddc4d3f
first step of restructering
dhinf Apr 23, 2020
d3544ef
fixed alias for stencil point value
dhinf May 27, 2020
1653727
Merge branch 'feat-halo' of https://github.com/dash-project/dash into…
dhinf Jun 9, 2020
6e38c7a
Merge branch 'development' into feat-halo
dhinf Jun 16, 2020
b24c540
removed the slow vs fast solution, because iterators are fast too now
dhinf Aug 28, 2020
e70de57
removed HaloWrapper friendship in matrix
dhinf Aug 28, 2020
ac99756
fixes teamspec neighbor bug and adds array based argument to neighbor…
dhinf Aug 28, 2020
d5e1204
refactored and fixed signal and packing environment
dhinf Aug 28, 2020
0fb4dc5
restructured halo and boundary environment
dhinf Jan 29, 2021
128a8e5
fixed glob_bound ref in halo_block, unused code fragments
dhinf Jan 30, 2021
d7733a6
Updated config.yml
dhinf Jan 31, 2021
d281d99
fixed outdated extention access
dhinf Jan 31, 2021
4a5a33d
Merge branch 'development' of https://github.com/dash-project/dash in…
dhinf Jan 31, 2021
cb417dc
minor name changes, inner and inner+boundary view check to small bloc…
dhinf Feb 1, 2021
7e78d0a
adapted to new name changes in Halo.h
dhinf Feb 1, 2021
8cd2137
Merge branch 'feat-halo' of https://github.com/dash-project/dash into…
dhinf Feb 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- checkout
- run: bash dash/scripts/dash-ci.sh Release
- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
#- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed?

- run:
command: bash dash/scripts/circleci/collect-artifacts.sh
when: always
Expand All @@ -36,7 +36,7 @@ jobs:
steps:
- checkout
- run: bash dash/scripts/dash-ci.sh Release
- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
#- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
- run:
command: bash dash/scripts/circleci/collect-artifacts.sh
when: always
Expand All @@ -59,7 +59,7 @@ jobs:
steps:
- checkout
- run: bash dash/scripts/dash-ci.sh Release
- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
#- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
- run:
command: bash dash/scripts/circleci/collect-artifacts.sh
when: always
Expand All @@ -81,7 +81,7 @@ jobs:
steps:
- checkout
- run: bash dash/scripts/dash-ci.sh Release
- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
#- run: bash -c 'export DART_FORCE_C_STD=99; dash/scripts/dash-ci.sh Minimal'
- run:
command: bash dash/scripts/circleci/collect-artifacts.sh
when: always
Expand Down
27 changes: 22 additions & 5 deletions dart-impl/mpi/src/dart_globmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <stdio.h>
#include <mpi.h>
#include <stdlib.h>
#include <unistd.h>

/* For PRIu64, uint64_t in printf */
#define __STDC_FORMAT_MACROS
Expand Down Expand Up @@ -225,6 +227,13 @@ dart_team_memalloc_aligned_dynamic(
dtype_size, nelem, nbytes);


/**
* Work around a bug in Open MPI where registrations are expected to be page
* aligned: https://github.com/open-mpi/ompi/issues/7384
*/
size_t page_size = sysconf(_SC_PAGE_SIZE);
nbytes = (nbytes + ((page_size)-1)) & ~((page_size)-1);

dart_team_data_t *team_data = dart_adapt_teamlist_get(teamid);
if (team_data == NULL) {
DART_LOG_ERROR(
Expand All @@ -240,7 +249,7 @@ dart_team_memalloc_aligned_dynamic(
#if !defined(DART_MPI_DISABLE_SHARED_WINDOWS)

char ** baseptr_set = NULL;
/* Allocate shared memory on sharedmem_comm, and create the related
/* Allocate shared memory on sharedmem_comm, and create the related
* sharedmem_win */
/* NOTE:
* Windows should definitely be optimized for the concrete value type i.e.
Expand Down Expand Up @@ -331,15 +340,23 @@ dart_team_memalloc_aligned_dynamic(
} else {
baseptr_set[i] = sub_mem;
}
}
#else
if (MPI_Alloc_mem(nbytes, MPI_INFO_NULL, &sub_mem) != MPI_SUCCESS) {
}
#else // DART_MPI_DISABLE_SHARED_WINDOWS
#ifdef DYNAMIC_MEM_USE_POSIX_MEMALIGN
if (0 != posix_memalign((void**)&sub_mem, page_size, nbytes)) {
DART_LOG_ERROR(
"dart_team_memalloc_aligned_dynamic: bytes:%lu posix_memalign failed",
nbytes);
}
#else // DYNAMIC_MEM_USE_POSIX_MEMALIGN
if (MPI_Alloc_mem(nbytes, MPI_INFO_NULL, &sub_mem) != MPI_SUCCESS) {
DART_LOG_ERROR(
"dart_team_memalloc_aligned_dynamic: bytes:%lu MPI_Alloc_mem failed",
nbytes);
return DART_ERR_OTHER;
}
#endif
#endif // DYNAMIC_MEM_USE_POSIX_MEMALIGN
#endif // DART_MPI_DISABLE_SHARED_WINDOWS

MPI_Aint disp;
MPI_Win win = team_data->window;
Expand Down
21 changes: 2 additions & 19 deletions dash/examples/ex.02.matrix.halo.heat_equation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,26 +123,9 @@ int main(int argc, char *argv[])

// Update Halos asynchroniously
current_halo->update_async();

// optimized calculation of inner matrix elements
auto* current_begin = current_matrix.lbegin();

auto* new_begin = new_matrix.lbegin();
#if 0
for (auto i = inner_start; i < inner_end; i += offset) {
auto* center = current_begin + i;
auto* center_y_plus = center + offset;
auto* center_y_minus = center - offset;
for (auto j = 0; j < offset - 2;
++j, ++center, ++center_y_plus, ++center_y_minus) {
/*auto dtheta =
(*(center - 1) + *(center + 1) - 2 * (*center)) / (dx * dx) +
(*(center_y_minus) + *(center_y_plus) - 2 * (*center)) / (dy * dy);
*(new_begin + i + j) = *center + k * dtheta * dt;*/
*(new_begin + i + j) = calc(center, center_y_minus, center_y_plus, center - 1, center + 1);
}
}
#endif
// slow version

auto it_end = current_op->inner.end();
for(auto it = current_op->inner.begin(); it != it_end; ++it)
{
Expand Down
5 changes: 5 additions & 0 deletions dash/include/dash/Dimensional.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ class ViewSpec
typedef ViewRegion<NumDimensions, IndexType> region_type;
typedef ViewRange<IndexType> range_type;

using index_type = IndexType;
using size_type = SizeType;

public:
template<dim_t NDim_, typename IndexType_>
friend std::ostream& operator<<(
Expand Down Expand Up @@ -520,6 +523,8 @@ class ViewSpec
*/
self_t & operator=(self_t && other) = default;

static constexpr auto ndim() { return NumDimensions; }

/**
* Equality comparison operator.
*/
Expand Down
7 changes: 0 additions & 7 deletions dash/include/dash/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ template <
typename LocalMemSpaceT>
class LocalMatrixRef;

namespace halo {
template<class _MatrixT>
class HaloMatrixWrapper;
}

/**
* An n-dimensional array supporting subranges and sub-dimensional
* projection.
Expand Down Expand Up @@ -167,8 +162,6 @@ class Matrix
typedef PatternT
Pattern_t;

template<class MatrixT_>
friend class halo::HaloMatrixWrapper;
public:
typedef GlobStaticMem<LocalMemSpaceT>
GlobMem_t;
Expand Down
37 changes: 33 additions & 4 deletions dash/include/dash/TeamSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,20 @@ class TeamSpec :
}
++d;
}
return this->at(neighbor_coords);
return team_unit_t(static_cast<dart_unit_t>(this->at(neighbor_coords)));
}

team_unit_t neighbor(const std::array<int, MaxDimensions>& offsets) const
{
auto neighbor_coords = this->coords(_myid);
for (dim_t d = 0; d < MaxDimensions; ++d) {
neighbor_coords[d] += offsets[d];
if (neighbor_coords[d] < 0 ||
neighbor_coords[d] >= this->_extents[d]) {
return UNDEFINED_TEAM_UNIT_ID;
}
}
return team_unit_t(static_cast<dart_unit_t>(this->at(neighbor_coords)));
}

/**
Expand Down Expand Up @@ -340,13 +353,29 @@ class TeamSpec :
dim_t d = 0;
for (auto offset_d : offsets) {
neighbor_coords[d] += offset_d;
if (neighbor_coords[d] < 0 ||
neighbor_coords[d] >= this->_extents[d]) {
if (neighbor_coords[d] < 0) {
neighbor_coords[d] = this->_extents[d] + offset_d;
} else if(neighbor_coords[d] >= this->_extents[d]) {
neighbor_coords[d] %= this->_extents[d];
}
++d;
}
return at(neighbor_coords);
return team_unit_t(static_cast<dart_unit_t>(this->at(neighbor_coords)));
}

team_unit_t periodic_neighbor(const std::array<int, MaxDimensions>& offsets) const
{
auto neighbor_coords = this->coords(_myid);

for (dim_t d = 0; d < MaxDimensions; ++d) {
neighbor_coords[d] += offsets[d];
if (neighbor_coords[d] < 0) {
neighbor_coords[d] = this->_extents[d] + offsets[d];
} else if(neighbor_coords[d] >= this->_extents[d]) {
neighbor_coords[d] %= this->_extents[d];
}
}
return team_unit_t(static_cast<dart_unit_t>(this->at(neighbor_coords)));
}

/**
Expand Down
Loading