My Project
Loading...
Searching...
No Matches
CuMatrixDescription.hpp
1/*
2 Copyright 2022-2023 SINTEF AS
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef CU_MATRIX_DESCRIPTION_HPP
20#define CU_MATRIX_DESCRIPTION_HPP
21#include <opm/simulators/linalg/cuistl/detail/CuSparseResource.hpp>
22#include <opm/simulators/linalg/cuistl/detail/cusparse_safe_call.hpp>
23
24namespace Opm::cuistl::detail
25{
26
31
35using CuSparseMatrixDescriptionPtr = std::shared_ptr<CuSparseResource<cusparseMatDescr_t>>;
36
43{
44 auto description = std::make_shared<CuSparseMatrixDescription>();
45
46 // Note: We always want to use zero base indexing.
47 OPM_CUSPARSE_SAFE_CALL(cusparseSetMatType(description->get(), CUSPARSE_MATRIX_TYPE_GENERAL));
48 OPM_CUSPARSE_SAFE_CALL(cusparseSetMatIndexBase(description->get(), CUSPARSE_INDEX_BASE_ZERO));
49
50 return description;
51}
52
67
83
84} // namespace Opm::cuistl::detail
85
86#endif // CU_MATRIX_DESCRIPTION_HPP
Definition AquiferInterface.hpp:35
Contains wrappers to make the CuBLAS library behave as a modern C++ library with function overlading.
Definition cublas_safe_call.hpp:32
CuSparseMatrixDescriptionPtr createLowerDiagonalDescription()
createLowerDiagonalDescription creates a lower diagonal matrix description
Definition CuMatrixDescription.hpp:60
std::shared_ptr< CuSparseResource< cusparseMatDescr_t > > CuSparseMatrixDescriptionPtr
Pointer to CuSparseMatrixDescription holder.
Definition CuMatrixDescription.hpp:35
CuSparseMatrixDescriptionPtr createMatrixDescription()
createMatrixDescription creates a default matrix description
Definition CuMatrixDescription.hpp:42
CuSparseMatrixDescriptionPtr createUpperDiagonalDescription()
createUpperDiagonalDescription creates an upper diagonal matrix description
Definition CuMatrixDescription.hpp:75