Skip to content

Commit 83a73da

Browse files
committed
fall back to ILU/IC sparselib algorithm with CPU executors
This issue was found when running the custom multigrid example with OpenMP
1 parent f62a5ef commit 83a73da

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

core/factorization/ic.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ std::unique_ptr<Composition<ValueType>> Ic<ValueType, IndexType>::generate(
103103

104104
std::shared_ptr<const matrix_type> ic;
105105
// Compute LC factorization
106-
if (parameters_.algorithm == incomplete_algorithm::syncfree) {
106+
if (parameters_.algorithm == incomplete_algorithm::syncfree ||
107+
exec == exec->get_master()) {
107108
std::unique_ptr<gko::factorization::elimination_forest<IndexType>>
108109
forest;
109110
const auto nnz = local_system_matrix->get_num_stored_elements();
@@ -143,11 +144,6 @@ std::unique_ptr<Composition<ValueType>> Ic<ValueType, IndexType>::generate(
143144
diag_idxs.get_const_data(), transpose_idxs.get_const_data(),
144145
*forest, factors.get(), false, tmp));
145146
ic = factors;
146-
} else if (std::dynamic_pointer_cast<const OmpExecutor>(exec) &&
147-
!std::dynamic_pointer_cast<const ReferenceExecutor>(exec)) {
148-
GKO_INVALID_STATE(
149-
"OmpExecutor does not support sparselib algorithm. Please use "
150-
"syncfree algorithm.");
151147
} else {
152148
exec->run(
153149
ic_factorization::make_sparselib_ic(local_system_matrix.get()));

core/factorization/ilu.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ std::unique_ptr<Composition<ValueType>> Ilu<ValueType, IndexType>::generate_l_u(
9999

100100
std::shared_ptr<const matrix_type> ilu;
101101
// Compute LU factorization
102-
if (parameters_.algorithm == incomplete_algorithm::syncfree) {
102+
if (parameters_.algorithm == incomplete_algorithm::syncfree ||
103+
exec == exec->get_master()) {
103104
const auto nnz = local_system_matrix->get_num_stored_elements();
104105
const auto num_rows = local_system_matrix->get_size()[0];
105106
auto factors = share(
@@ -126,11 +127,6 @@ std::unique_ptr<Composition<ValueType>> Ilu<ValueType, IndexType>::generate_l_u(
126127
lookup.row_descs.get_const_data(), lookup.storage.get_const_data(),
127128
diag_idxs.get_const_data(), factors.get(), false, tmp));
128129
ilu = factors;
129-
} else if (std::dynamic_pointer_cast<const OmpExecutor>(exec) &&
130-
!std::dynamic_pointer_cast<const ReferenceExecutor>(exec)) {
131-
GKO_INVALID_STATE(
132-
"OmpExecutor does not support sparselib algorithm. Please use "
133-
"syncfree algorithm.");
134130
} else {
135131
exec->run(
136132
ilu_factorization::make_sparselib_ilu(local_system_matrix.get()));

0 commit comments

Comments
 (0)