28 #ifndef OPENRAND_UTIL_H_
29 #define OPENRAND_UTIL_H_
33 #include <type_traits>
37 #define OPENRAND_DEVICE __host__ __device__
38 #elif defined(__HIP_DEVICE_COMPILE__)
39 #define OPENRAND_DEVICE __device__ __host__
41 #define OPENRAND_DEVICE
49 constexpr uint32_t DEFAULT_GLOBAL_SEED =
53 inline OPENRAND_DEVICE T sin(T x) {
54 if constexpr (std::is_same_v<T, float>)
56 else if constexpr (std::is_same_v<T, double>)
61 inline OPENRAND_DEVICE T cos(T x) {
62 if constexpr (std::is_same_v<T, float>)
64 else if constexpr (std::is_same_v<T, double>)
69 inline OPENRAND_DEVICE T log(T x) {
70 if constexpr (std::is_same_v<T, float>)
72 else if constexpr (std::is_same_v<T, double>)
77 inline OPENRAND_DEVICE T sqrt(T x) {
78 if constexpr (std::is_same_v<T, float>)
80 else if constexpr (std::is_same_v<T, double>)
114 template <
typename T,
typename = std::
void_t<>>
117 template <
typename T>
118 struct has_counter<T, std::void_t<decltype(std::declval<T>()._ctr)>>