Skip to content

Commit

Permalink
fix issue with wrong data access for empty cyclic bcs
Browse files Browse the repository at this point in the history
  • Loading branch information
greole committed Nov 8, 2024
1 parent eaaf348 commit 532209b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/MatrixWrapper/Distributed.C
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ void update_impl(
label tag = 0;
scalar *recv_buffer_ptr;
label remain_host_interfaces = host_A->get_num_interfaces();

for (auto [is_local, orig_rank, size, ctr] : local_interfaces) {
if (is_local) {
mtx = gko::as<LocalMatrixType>(
Expand Down Expand Up @@ -489,7 +490,6 @@ void update_impl(
local_sparsity->ldu_mapping.get_executor(), local_elements,
local_sparsity->ldu_mapping.get_data());


auto dense_vec = gko::share(gko::matrix::Dense<scalar>::create(
local->get_executor(),
gko::dim<2>{static_cast<dim_type>(local_elements), 1}, local_view,
Expand All @@ -500,6 +500,7 @@ void update_impl(
auto row_view =
gko::array<scalar>::view(local->get_executor(), local_elements,
row_collection->get_values());

local_view = row_view;

// TODO localized interfaces need to be reordered too.
Expand Down Expand Up @@ -619,12 +620,14 @@ std::shared_ptr<RepartDistMatrix> create_impl(
auto src_comm_pattern = host_A->create_communication_pattern();
if (non_local_sparsity->spans.size() !=
src_comm_pattern->target_ids.size()) {
for (auto [begin, end]: non_local_sparsity->spans) {
}
FatalErrorInFunction
<< " Inconsistency detected non_local_sparsity->spans.size() = "
<< " Inconsistency detected non_local_sparsity->spans.size()="
<< non_local_sparsity->spans.size()
<< "!=src_comm_pattern->target_ids.size() = "
<< " != src_comm_pattern->target_ids.size()="
<< src_comm_pattern->target_ids.size()
<< " on rank "
<< " on rank: "
<< rank
<< exit(FatalError);
}
Expand Down
14 changes: 14 additions & 0 deletions src/MatrixWrapper/HostMatrix.C
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ HostMatrixWrapper::HostMatrixWrapper(
continue;
}
const auto iface{interface_getter(interfaces, i)};
if (iface->interface().faceCells().size() == 0) {
continue;
}
interface_length_.push_back(iface->interface().faceCells().size());
interface_ptr_.push_back(interfaceBouCoeffs[i].begin());
}
Expand Down Expand Up @@ -343,6 +346,12 @@ std::vector<interface_locality>> HostMatrixWrapper::collect_cells_on_interfaces(
total_ctr += interface_size;

if (isA<processorFvPatch>(iface->interface())) {

if (interface_size == 0 ) {
std::cout << __FILE__ << "empty proc_interface \n";
continue;
}

const auto &patch =
refCast<const processorFvPatch>(iface->interface());
const auto &face_cells{iface->interface().faceCells()};
Expand All @@ -367,6 +376,11 @@ std::vector<interface_locality>> HostMatrixWrapper::collect_cells_on_interfaces(
}

if (isA<cyclicFvPatch>(iface->interface())) {
if (interface_size == 0 ) {
std::cout << __FILE__ << "empty cyclic interface \n";
continue;
}

const cyclicFvPatch &patch =
refCast<const cyclicFvPatch>(iface->interface());
const auto &face_cells{iface->interface().faceCells()};
Expand Down

0 comments on commit 532209b

Please sign in to comment.