Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana_PerformanceTraits.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_PERFORMANCETRAITS_HPP
17#define CABANA_PERFORMANCETRAITS_HPP
18
19#include <Cabana_Types.hpp>
20
21#include <Kokkos_Core.hpp>
22
23namespace Cabana
24{
25namespace Impl
26{
27//---------------------------------------------------------------------------//
31template <class ExecutionSpace>
33
34//---------------------------------------------------------------------------//
35// Serial specialization.
36#if defined( KOKKOS_ENABLE_SERIAL )
37template <>
38class PerformanceTraits<Kokkos::Serial>
39{
40 public:
41 static constexpr int vector_length = 16;
42};
43#endif
44
45//---------------------------------------------------------------------------//
46// Threads specialization.
47#if defined( KOKKOS_ENABLE_THREADS )
48template <>
49class PerformanceTraits<Kokkos::Threads>
50{
51 public:
52 static constexpr int vector_length = 16;
53};
54#endif
55
56//---------------------------------------------------------------------------//
57// OpenMP specialization.
58#if defined( KOKKOS_ENABLE_OPENMP )
59template <>
60class PerformanceTraits<Kokkos::OpenMP>
61{
62 public:
63 static constexpr int vector_length = 16;
64};
65#endif
66
67//---------------------------------------------------------------------------//
68// Cuda specialization. Use the warp traits.
69#if defined( KOKKOS_ENABLE_CUDA )
70template <>
71class PerformanceTraits<Kokkos::Cuda>
72{
73 public:
74 static constexpr int vector_length = 32; // warp size
75};
76#endif
77
78//---------------------------------------------------------------------------//
79#if defined( KOKKOS_ENABLE_HIP )
80template <>
81class PerformanceTraits<Kokkos::Experimental::HIP>
82{
83 public:
84 static constexpr int vector_length = 64; // wavefront size
85};
86#endif
87
88//---------------------------------------------------------------------------//
89#if defined( KOKKOS_ENABLE_SYCL )
90template <>
91class PerformanceTraits<Kokkos::Experimental::SYCL>
92{
93 public:
94 static constexpr int vector_length = 16; // FIXME_SYCL
95};
96#endif
97
98//---------------------------------------------------------------------------//
99#if defined( KOKKOS_ENABLE_OPENMPTARGET )
100template <>
101class PerformanceTraits<Kokkos::Experimental::OpenMPTarget>
102{
103 public:
104 static constexpr int vector_length = 16; // FIXME_OPENMPTARGET
105};
106#endif
107
108//---------------------------------------------------------------------------//
109
110} // end namespace Impl
111} // end namespace Cabana
112
113#endif // end CABANA_PERFORMANCETRAITS_HPP
Memory access type checking.
Default settings for execution spaces.
Definition Cabana_PerformanceTraits.hpp:32
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36