This repository was archived by the owner on Sep 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Interleaved computation with communication in halo exchange #881
Draft
lslusarczyk
wants to merge
262
commits into
oneapi-src:main
Choose a base branch
from
quazuo:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,549
−17
Draft
Changes from 68 commits
Commits
Show all changes
262 commits
Select commit
Hold shift + click to select a range
e1e9910
added dual_segment and refined dual_distributed_vector
bdecda7
progress
9e81fd7
Merge remote-tracking branch 'upstream/main'
811307c
tiny fix
a5fdcf5
Merge branch 'main' of https://github.com/quazuo/distributed-ranges
5353689
prog
6701c41
prog
f79fe45
prog
b126f8b
prog
e1d50c9
prog
0da1f2c
prog
871bd58
prog
2e3c96d
prog
dff502a
prog
89f9c18
prog
2e4cc88
prog
9c37e12
prog
78cbd29
prog
e18f59a
prog
3329c97
prog
a0e067d
prog
fb05c7d
prog
ea43af7
prog
4fd4d8f
prog
95ca6cf
prog
900613e
prog
9218cd8
prog
46bfa65
prog
3d7a9a8
prog
2603a6c
prog
cdce405
prog
46f6ade
prog
e4eafa2
prog
ad460d8
prog
bd1e8ed
prog
8d0f5be
prog
046b7e4
prog
5c32e9e
prog
6e95e27
prog
46dff8e
prog
b842cc7
prog
d43b9d3
prog
1b6b21b
prog
d333564
prog
8690c17
prog
3860947
prog
6dcd2f4
prog
df55977
prog
4b0f293
prog
0fe709c
prog
05fa8f6
prog
0d94948
prog
33a1d4f
prog
8dd8a00
prog
d04461d
prog
497eb8c
prog
29759f1
prog
73c78a4
prog
02c92d8
prog
6d36592
prog
5a48300
prog
2955cdc
prog
d5ad221
prog
b02102f
prog
8d798eb
prog
d658d77
prog
4e33bd0
prog
6d108c4
prog
381159f
prog
3d2edda
prog
ccc1033
prog
3723fef
prog
6e2f48b
prog
741b0d8
prog
a1483a2
prog
ffc698d
prog
e69d371
prog
92baecf
prog
232b66f
prog
7f6adc6
prog
f1dd4c1
prog
71bff7d
prog
8b6dc9d
prog
73ffe2d
prog
4790936
prog
c25edce
prog
68cadd5
prog
7efc1dd
prog
bfcad1a
prog
6a57340
prog
b9f85f4
prog
c9f663f
prog
91bd445
prog
f17cb40
prog
c3fe0df
prog
3b2a249
prog
a0e6d1a
prog
ce168f8
prog
f49db0a
prog
650ef40
prog
ecd682b
prog
459ab92
prog
c404bf5
prog
c30485c
prog
81f646a
prog
2f8558a
prog
b517be9
prog
eef815c
prog
0c8b1df
prog
cfa249e
prog
0afa41b
prog
a8063ea
prog
175843b
prog
62b282f
prog
6cd3a48
prog
6b363de
prog
a71921b
prog
3c897e4
prog
f3f5b05
prog
bbcc376
prog
d26e451
prog
5c2a3df
prog
8811883
prog
ba753d3
prog
8deeb5d
prog
4fdb6bc
prog
ad88358
prog
af75a5c
prog
cd257c9
prog
0a3c1ee
prog
73c3b05
prog
c54b47f
prog
c5262e6
prog
0a047e0
prog
86ae201
prog
4bb8f87
prog
2f4110d
prog
5b1cc8c
prog
c1beb85
prog
f471e5f
prog
d978920
prog
0ca7b78
prog
3bb2cea
prog
8ffc59d
prog
b67c6fe
prog
0136421
prog
ef414b5
prog
063089b
prog
68d2f2c
prog
b7de0f0
prog
5b84094
prog
bb0bc6e
prog
082b0df
prog
a47f786
prog
45f6642
prog
e119607
prog
75a4ba4
prog
4c680d5
prog
3e8db87
prog
bd7d400
prog
f357509
prog
653b628
prog
02da290
prog
74ff2c1
prog
c2de659
prog
f2fcb02
prog
90eac43
prog
1e2e2ab
prog
b2d1fd2
prog
073d76b
prog
4c8d23c
prog
577d033
prog
fc6ac45
prog
f795f9a
prog
debc0b0
prog
1c3da53
prog
0a1a28a
prog
94a0b1a
prog
9914310
prog
bcc1822
prog
1694d4e
prog
1656763
prog
9c6ee90
prog
80b518f
prog
f88fbc8
prog
64b30d6
prog
c31505d
prog
f9b8b8b
prog
3cd8f1e
prog
074c4c5
prog
166cd4f
prog
c3cbd36
prog
4969774
prog
432e0a3
prog
2d29367
prog
7841ae7
prog
f221e86
prog
b1810c3
prog
1f881dd
prog
2f3099b
prog
ae84fb7
prog
1f1f744
prog
a23508c
prog
c261441
prog
b66a634
prog
42849cc
prog
166971c
prog
1bb5765
prog
8a269d5
prog
d26589f
prog
f44060d
prog
e6ab425
prog
0a75dfe
prog
b4d01e5
prog
556878c
prog
0ddda9c
prog
4b89374
prog
8f14ddc
prog
7add086
prog
efa8681
prog
235d009
prog
ccc617f
prog
d7b6e47
prog
1970ac7
prog
befee8b
prog
5ddbe41
prog
6afa00e
prog
ca18a6b
prog
8363dad
prog
16c4959
prog
2e05a6e
prog
bb1ac96
prog
3d2f698
prog
977b908
prog
83e3e5a
prog
74a5cec
prog
69dc033
prog
b68a4d6
prog
2535abb
prog
40f7975
prog
65bb87f
prog
17d288c
prog
2a26e3a
prog
38a0930
prog
8d78ed1
prog
35c65bd
prog
7e15a40
prog
81f1a6a
prog
a24d8c6
prog
89cd83f
prog
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,52 @@ | |
|
||
namespace dr::mp { | ||
|
||
/// Collective for_each on distributed range | ||
template <typename R> | ||
concept dual_vector_range = | ||
dr::distributed_range<R> && requires(R &r) { dr::ranges::segments(r)[0].is_compute(); }; | ||
|
||
void for_each(dual_vector_range auto &&dr, auto op) { | ||
partial_for_each(dr, op); | ||
partial_for_each(dr, op); | ||
} | ||
|
||
void partial_for_each(dual_vector_range auto &&dr, auto op) { | ||
dr::drlog.debug(dr::logger::for_each, "partial_for_each: parallel execution\n"); | ||
if (rng::empty(dr)) { | ||
return; | ||
} | ||
|
||
assert(aligned(dr)); | ||
|
||
for (auto &s : dr::ranges::segments(dr)) { | ||
|
||
if (!s.is_compute()) { | ||
s.swap_state(); | ||
continue; | ||
} | ||
|
||
if (mp::use_sycl()) { | ||
dr::drlog.debug(" using sycl\n"); | ||
|
||
assert(rng::distance(s) > 0); | ||
#ifdef SYCL_LANGUAGE_VERSION | ||
dr::__detail::parallel_for( | ||
dr::mp::sycl_queue(), sycl::range<1>(rng::distance(s)), | ||
[first = rng::begin(s), op](auto idx) { op(first[idx]); }) | ||
.wait(); | ||
#else | ||
assert(false); | ||
#endif | ||
} else { | ||
dr::drlog.debug(" using cpu\n"); | ||
rng::for_each(s, op); | ||
} | ||
|
||
s.swap_state(); | ||
} | ||
barrier(); | ||
} | ||
|
||
// Collective for_each on distributed range | ||
void for_each(dr::distributed_range auto &&dr, auto op) { | ||
dr::drlog.debug(dr::logger::for_each, "for_each: parallel execution\n"); | ||
if (rng::empty(dr)) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -254,7 +254,7 @@ template <typename T, class BackendT = MpiBackend> class distributed_vector { | |
if (!finalized()) { | ||
fence(); | ||
if (data_ != nullptr) { | ||
backend.deallocate(data_, data_size_ * sizeof(value_type)); | ||
backend_.deallocate(data_, data_size_ * sizeof(value_type)); | ||
} | ||
|
||
delete halo_; | ||
|
@@ -274,7 +274,14 @@ template <typename T, class BackendT = MpiBackend> class distributed_vector { | |
|
||
auto segments() const { return rng::views::all(segments_); } | ||
|
||
void fence() { backend.fence(); } | ||
void fence() { backend_.fence(); } | ||
|
||
backend_type& backend(const std::size_t segment_index) { return backend_; } | ||
|
||
const backend_type& backend(const std::size_t segment_index) const { | ||
return backend_; | ||
} | ||
|
||
T *data(const std::size_t segment_index) { return data_; } | ||
|
||
private: | ||
void init(auto size, auto dist) { | ||
|
@@ -295,7 +302,7 @@ template <typename T, class BackendT = MpiBackend> class distributed_vector { | |
data_size_ = segment_size_ + hb.prev + hb.next; | ||
|
||
if (size_ > 0) { | ||
data_ = static_cast<T *>(backend.allocate(data_size_ * sizeof(T))); | ||
data_ = static_cast<T *>(backend_.allocate(data_size_ * sizeof(T))); | ||
} | ||
|
||
halo_ = new span_halo<T>(default_comm(), data_, data_size_, hb); | ||
|
@@ -319,7 +326,7 @@ template <typename T, class BackendT = MpiBackend> class distributed_vector { | |
distribution distribution_; | ||
std::size_t size_; | ||
std::vector<dv_segment<distributed_vector>> segments_; | ||
BackendT backend; | ||
BackendT backend_; | ||
}; | ||
|
||
template <typename T, typename B> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes no sense checking this for one range, not aligned can be two or more ranges, one is always aligned