Skip to content

Commit

Permalink
Add HypreCSRMatrix wrapper class to replace mfem::SparseMatrix
Browse files Browse the repository at this point in the history
This allows OpenMP and better GPU acceleration for ceed::Operator full assembly into a CSR matrix using Hypre's functionality.
  • Loading branch information
sebastiangrimberg committed Feb 28, 2024
1 parent 2a2f00a commit ee10c84
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 340 deletions.
4 changes: 2 additions & 2 deletions palace/fem/bilinearform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ BilinearForm::PartialAssemble(const FiniteElementSpace &trial_fespace,
return op;
}

std::unique_ptr<mfem::SparseMatrix> BilinearForm::FullAssemble(const ceed::Operator &op,
bool skip_zeros, bool set)
std::unique_ptr<hypre::HypreCSRMatrix> BilinearForm::FullAssemble(const ceed::Operator &op,
bool skip_zeros, bool set)
{
return ceed::CeedOperatorFullAssemble(op, skip_zeros, set);
}
Expand Down
17 changes: 9 additions & 8 deletions palace/fem/bilinearform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <mfem.hpp>
#include "fem/integrator.hpp"
#include "fem/libceed/operator.hpp"
#include "linalg/hypre.hpp"

namespace palace
{
Expand Down Expand Up @@ -69,19 +70,19 @@ class BilinearForm
return PartialAssemble(GetTrialSpace(), GetTestSpace());
}

std::unique_ptr<mfem::SparseMatrix> FullAssemble(bool skip_zeros) const
std::unique_ptr<hypre::HypreCSRMatrix> FullAssemble(bool skip_zeros) const
{
return FullAssemble(*PartialAssemble(), skip_zeros, false);
}

static std::unique_ptr<mfem::SparseMatrix> FullAssemble(const ceed::Operator &op,
bool skip_zeros)
static std::unique_ptr<hypre::HypreCSRMatrix> FullAssemble(const ceed::Operator &op,
bool skip_zeros)
{
return FullAssemble(op, skip_zeros, false);
}

static std::unique_ptr<mfem::SparseMatrix> FullAssemble(const ceed::Operator &op,
bool skip_zeros, bool set);
static std::unique_ptr<hypre::HypreCSRMatrix> FullAssemble(const ceed::Operator &op,
bool skip_zeros, bool set);

std::unique_ptr<Operator> Assemble(bool skip_zeros) const;

Expand Down Expand Up @@ -120,13 +121,13 @@ class DiscreteLinearOperator

std::unique_ptr<ceed::Operator> PartialAssemble() const;

std::unique_ptr<mfem::SparseMatrix> FullAssemble(bool skip_zeros) const
std::unique_ptr<hypre::HypreCSRMatrix> FullAssemble(bool skip_zeros) const
{
return BilinearForm::FullAssemble(*PartialAssemble(), skip_zeros, true);
}

static std::unique_ptr<mfem::SparseMatrix> FullAssemble(const ceed::Operator &op,
bool skip_zeros)
static std::unique_ptr<hypre::HypreCSRMatrix> FullAssemble(const ceed::Operator &op,
bool skip_zeros)
{
return BilinearForm::FullAssemble(op, skip_zeros, true);
}
Expand Down
Loading

0 comments on commit ee10c84

Please sign in to comment.