Skip to content
This repository was archived by the owner on Sep 22, 2025. It is now read-only.

Commit bad5606

Browse files
author
Mikolaj Komar
committed
Add new example of not working code
1 parent ba20ee3 commit bad5606

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

examples/mp/local_issue.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ int main(int argc, char **argv) {
3030
auto [n, ma] = ind;
3131
fmt::print("some res 2 {} {} {}\n", val, n, ma);
3232

33-
auto mapper = [] (auto elem) { auto [a, b] = elem; auto [c, d] = a; return d;};
34-
auto summer = [](auto x, auto y) { return x + y;};
33+
auto mapper = [] (auto elem) { auto [a, b] = elem; auto [c, d] = a; return c;};
3534
auto z2 = dr::transform_view(m_row, mapper);
35+
for (auto x: local_segments(z2)) {
36+
for (auto z : x)
37+
{
38+
fmt::print("some res {}\n", z);
39+
}
40+
}
41+
auto summer = [](auto x, auto y) { return x + y;};
3642
auto red2 = dr::mp::reduce(z2, 0, summer);
3743
fmt::print("reduced row {} {}\n", red2, m_row.size());
3844
}

include/dr/mp/containers/matrix_formats/csr_row_distribution.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,18 @@ class csr_row_distribution {
335335
std::size_t offset = row_size * rank;
336336
auto local_vals_range = rng::subrange(local_vals, local_vals + vals_size);
337337
auto local_cols_range = rng::subrange(local_cols, local_cols + vals_size);
338-
// auto local_rows = rows_data->segments()[rank].begin().local();
338+
auto local_rows = rows_data->segments()[rank].begin().local();
339339
auto zipped_results = rng::views::zip(local_vals_range, local_cols_range);
340340
auto enumerated_zipped = rng::views::enumerate(zipped_results);
341341
auto transformer = [=](auto entry){
342342
assert(offset == 0);
343343
auto [index, pair] = entry;
344344
auto [val, column] = pair;
345-
auto row = 0;
346-
// auto row = rng::distance(
347-
// local_rows,
348-
// std::upper_bound(local_rows, local_rows + row_size, offset_ + index) -
349-
// 1);
345+
// auto row = 0;
346+
auto row = rng::distance(
347+
local_rows,
348+
std::upper_bound(local_rows, local_rows + row_size, offset + index) -
349+
1);
350350
dr::index<index_type> index_obj(row, column);
351351
value_type entry_obj(index_obj, val);
352352
return entry_obj;

0 commit comments

Comments
 (0)