Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_Types.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_TYPES_HPP
17#define CABANA_TYPES_HPP
18
19#include <Kokkos_Core.hpp>
20
21#include <type_traits>
22
23namespace Cabana
24{
25//---------------------------------------------------------------------------//
26// Memory access tags.
27//---------------------------------------------------------------------------//
29template <class>
30struct is_memory_access_tag : public std::false_type
31{
32};
33
37{
42 Kokkos::MemoryTraits<Kokkos::Unmanaged | Kokkos::Aligned |
43 Kokkos::Restrict>;
44};
45
47template <>
48struct is_memory_access_tag<DefaultAccessMemory> : public std::true_type
49{
50};
51
54{
59 Kokkos::MemoryTraits<Kokkos::Unmanaged | Kokkos::Aligned |
60 Kokkos::RandomAccess>;
61};
62
63template <>
64struct is_memory_access_tag<RandomAccessMemory> : public std::true_type
65{
66};
67
70{
75 Kokkos::MemoryTraits<Kokkos::Unmanaged | Kokkos::Aligned |
76 Kokkos::Atomic>;
77};
78
79template <>
80struct is_memory_access_tag<AtomicAccessMemory> : public std::true_type
81{
82};
83
84// Checks whether memory space is accessible from execution space.
85// This was taken from <ArborX_DetailsKokkosExtAccessibilityTraits.hpp>
86template <typename MemorySpace, typename ExecutionSpace, typename = void>
87struct is_accessible_from : std::false_type
88{
89 static_assert( Kokkos::is_memory_space<MemorySpace>::value, "" );
90 static_assert( Kokkos::is_execution_space<ExecutionSpace>::value, "" );
91};
92
93template <typename MemorySpace, typename ExecutionSpace>
94struct is_accessible_from<MemorySpace, ExecutionSpace,
95 std::enable_if_t<Kokkos::SpaceAccessibility<
96 ExecutionSpace, MemorySpace>::accessible>>
97 : std::true_type
98{
99};
100
101//---------------------------------------------------------------------------//
102
103} // end namespace Cabana
104
105#endif // end CABANA_TYPES_HPP
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
Atomic memory access. All reads and writes are atomic.
Definition Cabana_Types.hpp:70
Kokkos::MemoryTraits< Kokkos::Unmanaged|Kokkos::Aligned| Kokkos::Atomic > kokkos_memory_traits
Kokkos traits.
Definition Cabana_Types.hpp:74
AtomicAccessMemory memory_access_type
Access type.
Definition Cabana_Types.hpp:72
Definition Cabana_Types.hpp:37
DefaultAccessMemory memory_access_type
Access type.
Definition Cabana_Types.hpp:39
Kokkos::MemoryTraits< Kokkos::Unmanaged|Kokkos::Aligned| Kokkos::Restrict > kokkos_memory_traits
Kokkos traits.
Definition Cabana_Types.hpp:41
Random access memory. Read-only and const with limited spatial locality.
Definition Cabana_Types.hpp:54
Kokkos::MemoryTraits< Kokkos::Unmanaged|Kokkos::Aligned| Kokkos::RandomAccess > kokkos_memory_traits
Kokkos traits.
Definition Cabana_Types.hpp:58
RandomAccessMemory memory_access_type
Access type.
Definition Cabana_Types.hpp:56
Definition Cabana_Types.hpp:88
Memory access type checker.
Definition Cabana_Types.hpp:31