opm-simulators
Loading...
Searching...
No Matches
gpu_type_detection.hpp
1/*
2 Copyright 2025 Equinor ASA
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
20#ifndef OPM_GPUISTL_GPU_TYPE_DETECTION_HPP
21#define OPM_GPUISTL_GPU_TYPE_DETECTION_HPP
22
23#include <type_traits>
24
25namespace Opm::gpuistl
26{
27
28// Forward declarations
29template <typename T>
31template <typename T, bool ForceLegacy>
33template <typename T>
35
39template <typename T>
40struct is_gpu_type : std::false_type {
41};
42
43// Specializations for known GPU types
44template <typename T>
45struct is_gpu_type<GpuVector<T>> : std::true_type {
46};
47
48template <typename T, bool ForceLegacy>
49struct is_gpu_type<GpuSparseMatrixWrapper<T, ForceLegacy>> : std::true_type {
50};
51
52template <typename T>
53struct is_gpu_type<GpuSparseMatrixGeneric<T>> : std::true_type {
54};
55
59template <typename T>
60inline constexpr bool is_gpu_type_v = is_gpu_type<T>::value;
61
62} // namespace Opm::gpuistl
63
64#endif // OPM_GPUISTL_GPU_TYPE_DETECTION_HPP
The GpuSparseMatrixGeneric class uses cuSPARSE Generic API for sparse matrix operations.
Definition GpuSparseMatrixGeneric.hpp:48
The GpuSparseMatrixWrapper Checks CUDA/HIP version and dispatches a version either using the old or t...
Definition GpuSparseMatrixWrapper.hpp:62
Definition gpu_type_detection.hpp:30
A small, fixed‑dimension MiniVector class backed by std::array that can be used in both host and CUDA...
Definition AmgxInterface.hpp:38
constexpr bool is_gpu_type_v
Helper variable template for easier usage.
Definition gpu_type_detection.hpp:60
Type trait to detect if a type is a GPU type.
Definition gpu_type_detection.hpp:40