MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
magma.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_MAGMA_LINALG
13#define MFEM_MAGMA_LINALG
14
15#include "batched.hpp"
16
17#ifdef MFEM_USE_MAGMA
18
19#include <magma_v2.h>
20
21namespace mfem
22{
23
25{
26public:
27 void AddMult(const DenseTensor &A, const Vector &x, Vector &y,
28 real_t alpha = 1.0, real_t beta = 1.0,
29 Op op = Op::N) const override;
30 void Invert(DenseTensor &A) const override;
31 void LUFactor(DenseTensor &A, Array<int> &P) const override;
32 void LUSolve(const DenseTensor &A, const Array<int> &P,
33 Vector &x) const override;
34};
35
36/// Singleton class for interfacing with the MAGMA library.
37class Magma
38{
39 magma_queue_t queue; ///< The default MAGMA queue.
40 Magma(); ///< Initialize the MAGMA library.
41 ~Magma(); ///< Finalize the MAGMA library.
42 static Magma &Instance(); ///< Get the unique instance of this class.
43public:
44 /// Return the queue, creating it if needed.
45 static magma_queue_t Queue();
46};
47
48} // namespace mfem
49
50#endif
51
52#endif
Abstract base clase for batched linear algebra operations.
Definition batched.hpp:122
Op
Operation type (transposed or not transposed)
Definition batched.hpp:54
Rank 3 tensor (array of matrices)
void LUSolve(const DenseTensor &A, const Array< int > &P, Vector &x) const override
See BatchedLinAlg::LUSolve.
Definition magma.cpp:105
void LUFactor(DenseTensor &A, Array< int > &P) const override
See BatchedLinAlg::LUFactor.
Definition magma.cpp:78
void AddMult(const DenseTensor &A, const Vector &x, Vector &y, real_t alpha=1.0, real_t beta=1.0, Op op=Op::N) const override
See BatchedLinAlg::AddMult.
Definition magma.cpp:56
void Invert(DenseTensor &A) const override
See BatchedLinAlg::Invert.
Definition magma.cpp:137
Singleton class for interfacing with the MAGMA library.
Definition magma.hpp:38
static magma_queue_t Queue()
Return the queue, creating it if needed.
Definition magma.cpp:51
Vector data type.
Definition vector.hpp:82
Vector beta
const real_t alpha
Definition ex15.cpp:369
float real_t
Definition config.hpp:43