Skip to content

Commit

Permalink
wip add all interface to sparsity pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
greole committed Oct 18, 2024
1 parent d5774a0 commit edc2420
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 165 deletions.
3 changes: 2 additions & 1 deletion include/OGL/MatrixWrapper/HostMatrix.H
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ private:
** ret = [(1,2,1),(2,20, 2), (3, 20, 2) ...]
** i0 i1, i...
*/
[[nodiscard]] std::vector<std::tuple<label, label, label, label>>
[[nodiscard]] std::pair<label,
std::vector<std::tuple<label, label, label, label>>>
collect_cells_on_non_local_interface(
const lduInterfaceFieldPtrsList &interfaces) const;

Expand Down
19 changes: 12 additions & 7 deletions src/MatrixWrapper/Distributed.C
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,24 @@ void RepartDistMatrix::write(const ExecutorHandler &exec_handler,
auto comm = exec_handler.get_gko_mpi_host_comm();
label rank{exec_handler.get_rank()};
auto partition = gko::share(
gko::experimental::distributed::build_partition_from_local_size<label, label>(ref_exec, *comm.get(), local_sparsity_->dim[0]));
gko::experimental::distributed::build_partition_from_local_size<
label, label>(ref_exec, *comm.get(), local_sparsity_->dim[0]));

label offset = partition->get_range_bounds()[rank];
label local_nnz = local_sparsity_->num_nnz;

std::transform(local->get_row_idxs(), local->get_row_idxs() + local_nnz, local->get_row_idxs(),
[&](label idx) { return idx + offset; });
std::transform(local->get_col_idxs(), local->get_col_idxs() + local_nnz, local->get_col_idxs(),
[&](label idx) { return idx + offset; });
std::transform(local->get_row_idxs(), local->get_row_idxs() + local_nnz,
local->get_row_idxs(),
[&](label idx) { return idx + offset; });
std::transform(local->get_col_idxs(), local->get_col_idxs() + local_nnz,
local->get_col_idxs(),
[&](label idx) { return idx + offset; });

label non_local_nnz = non_local_sparsity_->num_nnz;
std::transform(non_local->get_row_idxs(), non_local->get_row_idxs() + non_local_nnz, non_local->get_row_idxs(),
[&](label idx) { return idx + offset; });
std::transform(non_local->get_row_idxs(),
non_local->get_row_idxs() + non_local_nnz,
non_local->get_row_idxs(),
[&](label idx) { return idx + offset; });
}

export_mtx(field_name + "_local", local, db);
Expand Down
Loading

0 comments on commit edc2420

Please sign in to comment.