Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8f2b9dd
add distributed spmv scaling benchmark
MarcelKoch Apr 28, 2022
3ac2a09
initializes executor in solver benchmark correctly
MarcelKoch Oct 18, 2022
659863b
extracts stencil matrix generation into separate file
MarcelKoch Oct 19, 2022
51adeef
introduces intermediate matrix_type_factory map
MarcelKoch Oct 20, 2022
46b711c
simplifies stencil generation call
MarcelKoch Oct 21, 2022
92d1a39
uses json input format for scaling benchmark
MarcelKoch Oct 21, 2022
5948494
adds support for reading matrix files in distributed scaling benchmark
MarcelKoch Oct 21, 2022
ccfc418
renames scaling -> spmv benchmark
MarcelKoch Oct 21, 2022
83947bc
update doc
MarcelKoch Oct 21, 2022
66439c9
wip
MarcelKoch Oct 21, 2022
1a7031a
refactors (seq) solver benchmark
MarcelKoch Oct 24, 2022
c9be104
templates benchmark helper functions
MarcelKoch Oct 24, 2022
86fc085
removes warnings
MarcelKoch Oct 24, 2022
279b1b3
moves json set size
MarcelKoch Oct 24, 2022
ea26669
adds distributed solver benchmark
MarcelKoch Oct 24, 2022
7cbc2e5
passes in local and non-local formats as single string
MarcelKoch Oct 25, 2022
77ed4ba
refactors spmv benchmark
MarcelKoch Oct 25, 2022
812bd7e
adds distributed spmv
MarcelKoch Oct 31, 2022
287761b
enables stencil matrices for spmv similar benchmarks
MarcelKoch Oct 31, 2022
ba4b471
enables stencil matrices for seq solver benchmark
MarcelKoch Oct 31, 2022
241e11a
refactors blas and adds distributed blas
MarcelKoch Oct 31, 2022
c11ec4c
removes old distributed benchmarks
MarcelKoch Oct 31, 2022
2cd198c
restricts printing to mpi rank 0
MarcelKoch Nov 18, 2022
dd3187d
fixup namespaces after rebase
MarcelKoch Nov 18, 2022
b3aaa68
extracts input broadcasting
MarcelKoch Nov 18, 2022
d68472c
removes some code duplication
MarcelKoch Nov 18, 2022
8aafd82
fixup rebase issues
MarcelKoch Nov 18, 2022
acee19b
throws if can't generate matrix data
MarcelKoch Nov 18, 2022
a5da60a
interprets input size as global size
MarcelKoch Nov 18, 2022
04729f1
fixes stencil generation
MarcelKoch Nov 18, 2022
530acab
fixes missing include
MarcelKoch Nov 19, 2022
40c2cf5
review updates:
MarcelKoch Nov 23, 2022
67ca237
fixes distributed stencil matrix generation
MarcelKoch Nov 25, 2022
ae25fd0
review updates:
MarcelKoch Nov 28, 2022
53e7506
fixes return type in lambda
MarcelKoch Nov 29, 2022
a089931
review updates:
MarcelKoch Nov 30, 2022
05e3d24
removes special case to generate matrix with optimal comm
MarcelKoch Nov 30, 2022
ffd82c6
review updates:
MarcelKoch Jan 26, 2023
613acb3
Format files
ginkgo-bot Jan 27, 2023
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
Prev Previous commit
Next Next commit
review updates:
- renaming
- refactor stencil neighbor check

Co-authored-by: Tobias Ribizel <ribizel@kit.edu>
  • Loading branch information
MarcelKoch and upsj committed Jan 27, 2023
commit a08993117bd44443bdd84f73ef90c1ff201fb502
40 changes: 20 additions & 20 deletions benchmark/utils/stencil_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ gko::matrix_data<ValueType, IndexType> generate_3d_stencil_box(

auto is_valid_neighbor = [&](const IndexType d_i, const IndexType d_j,
const IndexType d_k) {
return !restricted ||
((d_i == 0 && d_j == 0) || (d_i == 0 && d_k == 0) ||
(d_j == 0 && d_k == 0));
return !restricted || ((d_i == 0) + (d_j == 0) + (d_k == 0) >= 2);
};

auto nnz_in_row = [&]() {
Expand Down Expand Up @@ -395,9 +393,10 @@ gko::matrix_data<ValueType, IndexType> generate_2d_stencil_with_optimal_comm(
gko::experimental::mpi::communicator comm,
const IndexType target_local_size, bool restricted)
{
const auto dp =
const auto discretization_points =
static_cast<IndexType>(closest_nth_root(target_local_size, 2));
const auto mat_size = dp * dp * comm.size();
const auto mat_size =
discretization_points * discretization_points * comm.size();
const auto rows_per_rank = gko::ceildiv(mat_size, comm.size());
const auto start = rows_per_rank * comm.rank();
const auto end = gko::min(rows_per_rank * (comm.rank() + 1), mat_size);
Expand All @@ -424,13 +423,13 @@ gko::matrix_data<ValueType, IndexType> generate_2d_stencil_with_optimal_comm(
const auto diag_value = static_cast<ValueType>(nnz_in_row() - 1);

for (IndexType row = start; row < end; row++) {
auto i = row / dp;
auto j = row % dp;
auto i = row / discretization_points;
auto j = row % discretization_points;
for (IndexType d_i = -1; d_i <= 1; d_i++) {
for (IndexType d_j = -1; d_j <= 1; d_j++) {
if (is_valid_neighbor(d_i, d_j)) {
auto col = j + d_j + (i + d_i) * dp;
if (col >= 0 && col < mat_size) {
auto col = j + d_j + (i + d_i) * discretization_points;
if (is_in_box(col, mat_size)) {
if (col != row) {
A_data.nonzeros.emplace_back(
row, col, -gko::one<ValueType>());
Expand Down Expand Up @@ -461,9 +460,10 @@ gko::matrix_data<ValueType, IndexType> generate_3d_stencil_with_optimal_comm(
gko::experimental::mpi::communicator comm,
const IndexType target_local_size, bool restricted)
{
const auto dp =
const auto discretization_points =
static_cast<IndexType>(closest_nth_root(target_local_size, 3));
const auto mat_size = dp * dp * dp * comm.size();
const auto mat_size = discretization_points * discretization_points *
discretization_points * comm.size();
const auto rows_per_rank = gko::ceildiv(mat_size, comm.size());
const auto start = rows_per_rank * comm.rank();
const auto end = gko::min(rows_per_rank * (comm.rank() + 1), mat_size);
Expand All @@ -474,9 +474,7 @@ gko::matrix_data<ValueType, IndexType> generate_3d_stencil_with_optimal_comm(

auto is_valid_neighbor = [&](const IndexType d_i, const IndexType d_j,
const IndexType d_k) {
return !restricted ||
((d_i == 0 && d_j == 0) || (d_i == 0 && d_k == 0) ||
(d_j == 0 && d_k == 0));
return !restricted || ((d_i == 0) + (d_j == 0) + (d_k == 0) >= 2);
};

auto nnz_in_row = [&]() {
Expand All @@ -495,16 +493,18 @@ gko::matrix_data<ValueType, IndexType> generate_3d_stencil_with_optimal_comm(
const auto diag_value = static_cast<ValueType>(nnz_in_row() - 1);

for (IndexType row = start; row < end; row++) {
auto i = row / (dp * dp);
auto j = (row % (dp * dp)) / dp;
auto k = row % dp;
auto i = row / (discretization_points * discretization_points);
auto j = (row % (discretization_points * discretization_points)) /
discretization_points;
auto k = row % discretization_points;
for (IndexType d_i = -1; d_i <= 1; d_i++) {
for (IndexType d_j = -1; d_j <= 1; d_j++) {
for (IndexType d_k = -1; d_k <= 1; d_k++) {
if (is_valid_neighbor(d_i, d_j, d_k)) {
auto col =
k + d_k + (j + d_j) * dp + (i + d_i) * dp * dp;
if (col >= 0 && col < mat_size) {
auto col = k + d_k + (j + d_j) * discretization_points +
(i + d_i) * discretization_points *
discretization_points;
if (is_in_box(col, mat_size)) {
if (col != row) {
A_data.nonzeros.emplace_back(
row, col, -gko::one<ValueType>());
Expand Down