Skip to content

Commit

Permalink
Merge pull request #240 from Exawind/klu2_solver
Browse files Browse the repository at this point in the history
CPU based runs use KLU2 rather than Basker for a Linear Solver.
  • Loading branch information
ddement authored Aug 13, 2024
2 parents 2e1f473 + ad49446 commit 463bea8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/restruct_poc/solver/solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ namespace openturbine {
/// solver variables during the simulation
struct Solver {
// Define some types for the solver to make the code more readable
using ExecutionSpace = Kokkos::DefaultExecutionSpace;
using MemorySpace = ExecutionSpace::memory_space;
using GlobalCrsMatrixType = Tpetra::CrsMatrix<>;
using ExecutionSpace = GlobalCrsMatrixType::execution_space;
using MemorySpace = GlobalCrsMatrixType::memory_space;
using GlobalMapType = GlobalCrsMatrixType::map_type;
using GlobalMultiVectorType = Tpetra::MultiVector<>;
using DualViewType = GlobalMultiVectorType::dual_view_type;
Expand Down Expand Up @@ -306,8 +306,12 @@ struct Solver {
b = Tpetra::createMultiVector<ScalarType>(A->getRangeMap(), 1);
x_mv = Tpetra::createMultiVector<ScalarType>(A->getDomainMap(), 1);

const auto solver_name = (std::is_same_v<ExecutionSpace, Kokkos::DefaultHostExecutionSpace>)
? std::string{"klu2"}
: std::string{"basker"};

amesos_solver =
Amesos2::create<GlobalCrsMatrixType, GlobalMultiVectorType>("Basker", A, x_mv, b);
Amesos2::create<GlobalCrsMatrixType, GlobalMultiVectorType>(solver_name, A, x_mv, b);
amesos_solver->symbolicFactorization();
}
};
Expand Down

0 comments on commit 463bea8

Please sign in to comment.