Skip to content

Commit

Permalink
Deprecate global namespace default type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
cwpearson committed Sep 30, 2024
1 parent d3b6721 commit 2119c0f
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions common/src/KokkosKernels_default_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,61 +20,68 @@
#include "Kokkos_Core.hpp" //for LayoutLeft/LayoutRight
#include <KokkosKernels_config.h> //for all the ETI #cmakedefine macros

namespace KokkosKernels {
// define a deprecated symbol = type in the global namespace
// and a non-deprecated version in Kokkos Kernels
// these deprecations were done in 4.4.
#define KK_IMPL_MAKE_TYPE_ALIAS(symbol, type) \
using symbol [[deprecated("use KokkosKernels::" #type ".")]] = type; \
namespace KokkosKernels { \
using symbol = type; \
}

#if defined(KOKKOSKERNELS_INST_ORDINAL_INT)
using default_lno_t = int;
KK_IMPL_MAKE_TYPE_ALIAS(default_lno_t, int)
#elif defined(KOKKOSKERNELS_INST_ORDINAL_INT64_T)
using default_lno_t = int64_t;
KK_IMPL_MAKE_TYPE_ALIAS(default_lno_t, int64_t)
#else
// Non-ETI build: default to int
using default_lno_t = int;
KK_IMPL_MAKE_TYPE_ALIAS(default_lno_t, int)
#endif
// Prefer int as the default offset type, because cuSPARSE doesn't support
// size_t for rowptrs.
#if defined(KOKKOSKERNELS_INST_OFFSET_INT)
using default_size_type = int;
KK_IMPL_MAKE_TYPE_ALIAS(default_size_type, int)
#elif defined(KOKKOSKERNELS_INST_OFFSET_SIZE_T)
using default_size_type = size_t;
KK_IMPL_MAKE_TYPE_ALIAS(default_size_type, size_t)
#else
// Non-ETI build: default to int
using default_size_type = int;
KK_IMPL_MAKE_TYPE_ALIAS(default_size_type, int)
#endif

#if defined(KOKKOSKERNELS_INST_LAYOUTLEFT)
using default_layout = Kokkos::LayoutLeft;
KK_IMPL_MAKE_TYPE_ALIAS(default_layout, Kokkos::LayoutLeft)
#elif defined(KOKKOSKERNELS_INST_LAYOUTRIGHT)
using default_layout = Kokkos::LayoutRight;
KK_IMPL_MAKE_TYPE_ALIAS(default_layout, Kokkos::LayoutRight)
#else
using default_layout = Kokkos::LayoutLeft;
KK_IMPL_MAKE_TYPE_ALIAS(default_layout, Kokkos::LayoutLeft)
#endif

#if defined(KOKKOSKERNELS_INST_DOUBLE)
using default_scalar = double;
KK_IMPL_MAKE_TYPE_ALIAS(default_scalar, double)
#elif defined(KOKKOSKERNELS_INST_FLOAT)
using default_scalar = float;
KK_IMPL_MAKE_TYPE_ALIAS(default_scalar, float)
#elif defined(KOKKOSKERNELS_INST_HALF)
using default_scalar = Kokkos::Experimental::half_t;
KK_IMPL_MAKE_TYPE_ALIAS(default_scalar, Kokkos::Experimental::half_t)
#elif defined(KOKKOSKERNELS_INST_BHALF)
using default_scalar = Kokkos::Experimental::bhalf_t;
KK_IMPL_MAKE_TYPE_ALIAS(default_scalar, Kokkos::Experimental::bhalf_t)
#else
using default_scalar = double;
KK_IMPL_MAKE_TYPE_ALIAS(default_scalar, double)
#endif

#if defined(KOKKOS_ENABLE_CUDA)
using default_device = Kokkos::Cuda;
KK_IMPL_MAKE_TYPE_ALIAS(default_device, Kokkos::Cuda)
#elif defined(KOKKOS_ENABLE_HIP)
using default_device = Kokkos::HIP;
KK_IMPL_MAKE_TYPE_ALIAS(default_device, Kokkos::HIP)
#elif defined(KOKKOS_ENABLE_OPENMPTARGET)
using default_device = Kokkos::Experimental::OpenMPTarget;
KK_IMPL_MAKE_TYPE_ALIAS(default_device, Kokkos::Experimental::OpenMPTarget)
#elif defined(KOKKOS_ENABLE_OPENMP)
using default_device = Kokkos::OpenMP;
KK_IMPL_MAKE_TYPE_ALIAS(default_device, Kokkos::OpenMP)
#elif defined(KOKKOS_ENABLE_THREADS)
using default_device = Kokkos::Threads;
KK_IMPL_MAKE_TYPE_ALIAS(default_device, Kokkos::Threads)
#else
using default_device = Kokkos::Serial;
KK_IMPL_MAKE_TYPE_ALIAS(default_device, Kokkos::Serial)
#endif

} // namespace KokkosKernels
#undef KK_IMPL_MAKE_TYPE_ALIAS

#endif // KOKKOSKERNELS_DEFAULT_TYPES_H

0 comments on commit 2119c0f

Please sign in to comment.