45 #ifndef KOKKOS_UNIQUE_TOKEN_HPP
46 #define KOKKOS_UNIQUE_TOKEN_HPP
48 #include <Kokkos_Macros.hpp>
51 namespace Experimental {
53 enum class UniqueTokenScope : int { Instance, Global };
60 template <
typename ExecutionSpace,
61 UniqueTokenScope = UniqueTokenScope::Instance>
64 using execution_space = ExecutionSpace;
65 using size_type =
typename execution_space::size_type;
70 UniqueToken(execution_space
const& = execution_space());
73 KOKKOS_INLINE_FUNCTION
74 size_type
size()
const;
77 KOKKOS_INLINE_FUNCTION
81 KOKKOS_INLINE_FUNCTION
88 #endif // KOKKOS_UNIQUE_TOKEN_HPP
KOKKOS_INLINE_FUNCTION size_type acquire() const
acquire value such that 0 <= value < size()
class to generate unique ids base on the required amount of concurrency
UniqueToken(execution_space const &=execution_space())
create object size for concurrency on the given instance
KOKKOS_INLINE_FUNCTION void release(size_type) const
release a value acquired by generate
KOKKOS_INLINE_FUNCTION size_type size() const
upper bound for acquired values, i.e. 0 <= value < size()