23#ifndef MORPHEUS_SPACETRAITS_HPP
24#define MORPHEUS_SPACETRAITS_HPP
26#include <Kokkos_Core.hpp>
52 U*,
typename std::enable_if<std::is_same<U, Kokkos::HostSpace>::value ||
53#
if defined(MORPHEUS_ENABLE_CUDA)
54 std::is_same<U, Kokkos::CudaSpace>::value ||
55#elif defined(MORPHEUS_ENABLE_HIP)
56 std::is_same<U, Kokkos::HIPSpace>::value ||
58 false>::type* =
nullptr);
64 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
87 U*,
typename std::enable_if<
88 is_memory_space_v<typename U::memory_space>>::type* =
nullptr);
94 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
117 U*,
typename std::enable_if<
118 std::is_same<U, Kokkos::DefaultHostExecutionSpace>::value ||
119 std::is_same<U, Kokkos::DefaultExecutionSpace>::value ||
120#
if defined(MORPHEUS_ENABLE_SERIAL)
121 std::is_same<U, Kokkos::Serial>::value ||
123#
if defined(MORPHEUS_ENABLE_OPENMP)
124 std::is_same<U, Kokkos::OpenMP>::value ||
126#
if defined(MORPHEUS_ENABLE_CUDA)
127 std::is_same<U, Kokkos::Cuda>::value ||
128#elif defined(MORPHEUS_ENABLE_HIP)
129 std::is_same<U, Kokkos::Experimental::HIP>::value ||
131 false>::type* =
nullptr);
134 static no& test(...);
137 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
161 typename std::enable_if<
162 is_execution_space_v<typename U::execution_space>>::type* =
nullptr);
165 static no& test(...);
168 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
185template <
class T1,
class T2>
190 template <
class U1,
class U2>
195 std::is_same<U1, U2>::value>::type* =
nullptr);
197 template <
class U1,
class U2>
198 static no& test(...);
201 static const bool value =
202 sizeof(test<T1, T2>(
nullptr,
nullptr)) ==
sizeof(yes);
211template <
typename T1,
typename T2>
221template <
class T1,
class T2>
226 template <
class U1,
class U2>
230 typename U1::memory_space,
typename U2::memory_space>::value>::type* =
233 template <
class U1,
class U2>
234 static no& test(...);
237 static const bool value =
238 sizeof(test<T1, T2>(
nullptr,
nullptr)) ==
sizeof(yes);
247template <
typename T1,
typename T2>
262 static yes& test(U*,
typename std::enable_if<
263#
if defined(MORPHEUS_ENABLE_SERIAL) || defined(MORPHEUS_ENABLE_OPENMP)
264 std::is_same<U, Kokkos::HostSpace>::value ||
266 false>::type* =
nullptr);
269 static no& test(...);
272 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
295 typename std::enable_if<
296#
if defined(MORPHEUS_ENABLE_SERIAL) || defined(MORPHEUS_ENABLE_OPENMP)
299 false>::type* =
nullptr);
302 static no& test(...);
305 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
328 U*,
typename std::enable_if<
329 std::is_same<U, Kokkos::DefaultHostExecutionSpace>::value ||
330#
if defined(MORPHEUS_ENABLE_SERIAL)
331 std::is_same<U, Kokkos::Serial>::value ||
333#
if defined(MORPHEUS_ENABLE_OPENMP)
334 std::is_same<U, Kokkos::OpenMP>::value ||
336 false>::type* =
nullptr);
339 static no& test(...);
342 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
366 typename U::execution_space>>::type* =
nullptr);
369 static no& test(...);
372 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
384#if defined(MORPHEUS_ENABLE_SERIAL)
396 static yes& test(U*,
typename std::enable_if<
397#
if defined(MORPHEUS_ENABLE_SERIAL)
398 std::is_same<U, Kokkos::Serial>::value ||
400 false>::type* =
nullptr);
403 static no& test(...);
406 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
430 U*,
typename std::enable_if<
431#
if defined(MORPHEUS_ENABLE_SERIAL)
434 false>::type* =
nullptr);
437 static no& test(...);
440 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
453#if defined(MORPHEUS_ENABLE_OPENMP)
465 static yes& test(U*,
typename std::enable_if<
466#
if defined(MORPHEUS_ENABLE_OPENMP)
467 std::is_same<U, Kokkos::OpenMP>::value ||
469 false>::type* =
nullptr);
472 static no& test(...);
475 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
499 U*,
typename std::enable_if<
500#
if defined(MORPHEUS_ENABLE_OPENMP)
503 false>::type* =
nullptr);
506 static no& test(...);
509 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
522#if defined(MORPHEUS_ENABLE_CUDA)
534 static yes& test(U*,
typename std::enable_if<
535#
if defined(MORPHEUS_ENABLE_CUDA)
536 std::is_same<U, Kokkos::Cuda>::value ||
538 false>::type* =
nullptr);
541 static no& test(...);
544 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
567 static yes& test(U*,
typename std::enable_if<
568#
if defined(MORPHEUS_ENABLE_CUDA)
570 typename U::execution_space>::value ||
572 false>::type* =
nullptr);
575 static no& test(...);
578 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
591#if defined(MORPHEUS_ENABLE_HIP)
603 static yes& test(U*,
typename std::enable_if<
604#
if defined(MORPHEUS_ENABLE_HIP)
605 std::is_same<U, Kokkos::HIP>::value ||
607 false>::type* =
nullptr);
610 static no& test(...);
613 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
638 typename U::execution_space>::value>::type* =
nullptr);
641 static no& test(...);
644 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
659template <
typename ExecSpace,
typename... Ts>
662template <
class T1,
class T2>
667 template <
class U1,
class U2>
670 typename std::enable_if<
671 has_execution_space_v<U1> && has_memory_space_v<U2> &&
672 Kokkos::SpaceAccessibility<
typename U1::execution_space,
673 typename U2::memory_space>::accessible>::
676 template <
class U1,
class U2>
677 static no& test(...);
680 static const bool value =
681 sizeof(test<T1, T2>(
nullptr,
nullptr)) ==
sizeof(yes);
684template <
typename ExecSpace,
typename T,
typename... Ts>
686 static const bool value =
701template <
typename ExecSpace,
typename... Ts>
703 static const bool value = Impl::has_access<ExecSpace, Ts...>::value;
712template <
typename ExecSpace,
typename... Ts>
728 typename std::enable_if<
729 Kokkos::is_space<typename U::execution_space>::value ||
730 Kokkos::is_space<typename U::memory_space>::value ||
731 Kokkos::is_space<typename U::device_type>::value ||
732 Kokkos::is_space<U>::value>::type* =
nullptr);
735 static no& test(...);
738 static const bool value =
sizeof(test<T>(
nullptr)) ==
sizeof(yes);
Checks if the given type T has a Cuda execution space.
Definition: Morpheus_SpaceTraits.hpp:562
Checks if the given type T has a valid supported execution space.
Definition: Morpheus_SpaceTraits.hpp:154
Checks if the given type T has a HIP execution space.
Definition: Morpheus_SpaceTraits.hpp:631
Checks if the given type T has a supported Host execution space.
Definition: Morpheus_SpaceTraits.hpp:360
Checks if the given type T has a valid supported Host memory space.
Definition: Morpheus_SpaceTraits.hpp:289
Checks if the given type T has a valid supported memory space.
Definition: Morpheus_SpaceTraits.hpp:81
Checks if the given type T has an OpenMP execution space.
Definition: Morpheus_SpaceTraits.hpp:493
Checks if the two types have the same valid supported memory space.
Definition: Morpheus_SpaceTraits.hpp:222
Checks if the given type T has a Serial execution space.
Definition: Morpheus_SpaceTraits.hpp:424
Checks if the given type T is a Cuda execution space.
Definition: Morpheus_SpaceTraits.hpp:529
Checks if the given type T is a valid supported execution space.
Definition: Morpheus_SpaceTraits.hpp:111
Checks if the given type T is a HIP execution space.
Definition: Morpheus_SpaceTraits.hpp:598
Checks if the given type T is a supported Host execution space.
Definition: Morpheus_SpaceTraits.hpp:322
Checks if the given type T is a valid supported Host memory space.
Definition: Morpheus_SpaceTraits.hpp:257
Checks if the given type T is a valid supported memory space.
Definition: Morpheus_SpaceTraits.hpp:46
Checks if the given type T is an OpenMP execution space.
Definition: Morpheus_SpaceTraits.hpp:460
Checks if the two types are in the same valid supported memory space.
Definition: Morpheus_SpaceTraits.hpp:186
Checks if the given type T is a Serial execution space.
Definition: Morpheus_SpaceTraits.hpp:391
Generic Morpheus interfaces.
Definition: dummy.cpp:24
constexpr bool has_memory_space_v
Short-hand to has_memory_space.
Definition: Morpheus_SpaceTraits.hpp:103
constexpr bool has_host_memory_space_v
Short-hand to has_host_memory_space.
Definition: Morpheus_SpaceTraits.hpp:314
constexpr bool is_openmp_execution_space_v
Short-hand to is_openmp_execution_space.
Definition: Morpheus_SpaceTraits.hpp:484
constexpr bool is_host_memory_space_v
Short-hand to is_host_memory_space.
Definition: Morpheus_SpaceTraits.hpp:281
constexpr bool is_same_memory_space_v
Short-hand to is_same_memory_space.
Definition: Morpheus_SpaceTraits.hpp:212
constexpr bool has_host_execution_space_v
Short-hand to has_host_execution_space.
Definition: Morpheus_SpaceTraits.hpp:381
constexpr bool has_serial_execution_space_v
Short-hand to has_serial_execution_space.
Definition: Morpheus_SpaceTraits.hpp:449
constexpr bool has_cuda_execution_space_v
Short-hand to has_cuda_execution_space.
Definition: Morpheus_SpaceTraits.hpp:587
constexpr bool is_cuda_execution_space_v
Short-hand to is_cuda_execution_space.
Definition: Morpheus_SpaceTraits.hpp:553
constexpr bool has_execution_space_v
Short-hand to has_execution_space.
Definition: Morpheus_SpaceTraits.hpp:177
constexpr bool has_hip_execution_space_v
Short-hand to has_hip_execution_space.
Definition: Morpheus_SpaceTraits.hpp:653
constexpr bool is_serial_execution_space_v
Short-hand to is_serial_execution_space.
Definition: Morpheus_SpaceTraits.hpp:415
constexpr bool is_memory_space_v
Short-hand to is_memory_space.
Definition: Morpheus_SpaceTraits.hpp:73
constexpr bool has_access_v
Short-hand to has_access.
Definition: Morpheus_SpaceTraits.hpp:713
constexpr bool has_openmp_execution_space_v
Short-hand to has_openmp_execution_space.
Definition: Morpheus_SpaceTraits.hpp:518
constexpr bool is_space_v
Short-hand to is_space.
Definition: Morpheus_SpaceTraits.hpp:747
constexpr bool is_execution_space_v
Short-hand to is_execution_space.
Definition: Morpheus_SpaceTraits.hpp:146
constexpr bool is_host_execution_space_v
Short-hand to is_host_execution_space.
Definition: Morpheus_SpaceTraits.hpp:351
constexpr bool has_same_memory_space_v
Short-hand to has_same_memory_space.
Definition: Morpheus_SpaceTraits.hpp:248
constexpr bool is_hip_execution_space_v
Short-hand to is_hip_execution_space.
Definition: Morpheus_SpaceTraits.hpp:622
Takes arbitrary number of containers and checks if ExecSpace has access to the memory space of all of...
Definition: Morpheus_SpaceTraits.hpp:702
Checks if the given type T is a valid supported space.
Definition: Morpheus_SpaceTraits.hpp:722