Skip to content

Commit a7cc103

Browse files
committed
Opt to use Kokkos::abort whenever we run into infs/NaNs in SOC measure
Signed-off-by: malphil <[email protected]>
1 parent dbd5ae9 commit a7cc103

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

packages/muelu/src/Graph/MatrixTransformation/MueLu_CoalesceDropFactory_kokkos_def.hpp

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,12 @@ std::tuple<GlobalOrdinal, typename MueLu::LWGraph_kokkos<LocalOrdinal, GlobalOrd
471471
}
472472
}
473473

474-
{
475-
int localErrorEncountered = errorEncountered;
476-
int globalErrorEncountered = localErrorEncountered;
477-
auto comm = currentLevel.GetComm();
478-
Teuchos::reduceAll(*currentLevel.GetComm(), Teuchos::REDUCE_MAX, 1, &localErrorEncountered, &globalErrorEncountered);
479-
if (globalErrorEncountered > 0) {
480-
GetOStream(Warnings0) << "Encountered error while making dropping decisions.\n"
481-
<< "This generally indicates that infs/NaNs were encountered in the dropping decisions.\n"
482-
<< "A potential fix for this is enable repartitioning and/or perform an initial rebalance.\n\n";
483-
}
474+
if (errorEncountered) {
475+
std::ostringstream ss;
476+
ss << "Encountered error while making dropping decisions.\n"
477+
<< "This generally indicates that infs/NaNs were encountered in the dropping decisions.\n"
478+
<< "A potential fix for this is enable repartitioning and/or perform an initial rebalance.\n";
479+
Kokkos::abort(ss.str().c_str());
484480
}
485481

486482
GO numDropped = lclA.nnz() - nnz_filtered;
@@ -904,16 +900,12 @@ std::tuple<GlobalOrdinal, typename MueLu::LWGraph_kokkos<LocalOrdinal, GlobalOrd
904900
}
905901
}
906902

907-
{
908-
int localErrorEncountered = errorEncountered;
909-
int globalErrorEncountered = localErrorEncountered;
910-
auto comm = currentLevel.GetComm();
911-
Teuchos::reduceAll(*currentLevel.GetComm(), Teuchos::REDUCE_MAX, 1, &localErrorEncountered, &globalErrorEncountered);
912-
if (globalErrorEncountered > 0) {
913-
GetOStream(Warnings0) << "Encountered error while making dropping decisions.\n"
914-
<< "This generally indicates that infs/NaNs were encountered in the dropping decisions.\n"
915-
<< "A potential fix for this is enable repartitioning and/or perform an initial rebalance.\n\n";
916-
}
903+
if (errorEncountered) {
904+
std::ostringstream ss;
905+
ss << "Encountered error while making dropping decisions.\n"
906+
<< "This generally indicates that infs/NaNs were encountered in the dropping decisions.\n"
907+
<< "A potential fix for this is enable repartitioning and/or perform an initial rebalance.\n";
908+
Kokkos::abort(ss.str().c_str());
917909
}
918910

919911
LocalOrdinal nnz_filtered = nnz.first;

0 commit comments

Comments
 (0)