Skip to content

Commit

Permalink
Add some constexpr traits to Tpetra Node types
Browse files Browse the repository at this point in the history
- is_serial: is it Kokkos::Serial
- is_cpu: is it a CPU-like device (default memspace is HostSpace)
- is_gpu: is it a GPU-like device (default memspace is something other
  than HostSpace)
  • Loading branch information
brian-kelley committed Sep 19, 2023
1 parent f70afd5 commit a49171c
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ class KokkosDeviceWrapperNode {
/// release. This Node type is safe to use.
static constexpr bool classic = false;

//! Whether the ExecutionSpace is Kokkos::Serial.
#ifdef KOKKOS_ENABLE_SERIAL
static constexpr bool is_serial = std::is_same_v<ExecutionSpace, Kokkos::Serial>;
#else
static constexpr bool is_serial = false;
#endif

//! Whether the ExecutionSpace is CPU-like (its default memory space is HostSpace)
static constexpr bool is_cpu = std::is_same_v<typename ExecutionSpace::memory_space, Kokkos::HostSpace>;
//! Whether the ExecutionSpace is GPU-like (its default memory space is not HostSpace)
static constexpr bool is_gpu = !is_cpu;

KokkosDeviceWrapperNode (Teuchos::ParameterList& /* params */) = delete;
KokkosDeviceWrapperNode () = delete;

Expand Down

0 comments on commit a49171c

Please sign in to comment.