Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Grid_Hypre.hpp
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (c) 2018-2023 by the Cabana authors *
3 * All rights reserved. *
4 * *
5 * This file is part of the Cabana library. Cabana is distributed under a *
6 * BSD 3-clause license. For the licensing terms see the LICENSE file in *
7 * the top-level directory. *
8 * *
9 * SPDX-License-Identifier: BSD-3-Clause *
10 ****************************************************************************/
11
16#ifndef CABANA_GRID_HYPRE_HPP
17#define CABANA_GRID_HYPRE_HPP
18
19#include <HYPRE_config.h>
20#include <HYPRE_struct_ls.h>
21#include <HYPRE_struct_mv.h>
22
23#include <Kokkos_Core.hpp>
24
25#include <memory>
26
27namespace Cabana
28{
29namespace Grid
30{
31//---------------------------------------------------------------------------//
32// Hypre memory space selection. Don't compile if HYPRE wasn't configured to
33// use the device.
34// ---------------------------------------------------------------------------//
35
37template <class MemorySpace>
38struct HypreIsCompatibleWithMemorySpace : std::false_type
39{
40};
41
42// FIXME: This is currently written in this structure because HYPRE only has
43// compile-time switches for backends and hence only one can be used at a
44// time. Once they have a run-time switch we can use that instead.
45#ifdef HYPRE_USING_CUDA
46#ifdef KOKKOS_ENABLE_CUDA
47#ifdef HYPRE_USING_DEVICE_MEMORY
49template <>
50struct HypreIsCompatibleWithMemorySpace<Kokkos::CudaSpace> : std::true_type
51{
52};
53#endif // end HYPRE_USING_DEVICE_MEMORY
54
56#ifdef HYPRE_USING_UNIFIED_MEMORY
57template <>
58struct HypreIsCompatibleWithMemorySpace<Kokkos::CudaUVMSpace> : std::true_type
59{
60};
61#endif // end HYPRE_USING_UNIFIED_MEMORY
62#endif // end KOKKOS_ENABLE_CUDA
63#endif // end HYPRE_USING_CUDA
64
65#ifdef HYPRE_USING_HIP
66#ifdef KOKKOS_ENABLE_HIP
69template <>
70struct HypreIsCompatibleWithMemorySpace<Kokkos::ExperimentalHIPSpace>
71 : std::false_type
72{
73};
74#endif // end KOKKOS_ENABLE_HIP
75#endif // end HYPRE_USING_HIP
76
77#ifndef HYPRE_USING_GPU
79template <>
80struct HypreIsCompatibleWithMemorySpace<Kokkos::HostSpace> : std::true_type
81{
82};
83#endif // end HYPRE_USING_GPU
84} // namespace Grid
85} // namespace Cabana
86
87#endif // end CABANA_GRID_HYPRE_HPP
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
Hypre device compatibility check.
Definition Cabana_Grid_Hypre.hpp:39