10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_DEFAULT_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_DEFAULT_H 14 #include "./InternalHeaderCheck.h" 19 struct DefaultDevice {
20 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void* allocate(
size_t num_bytes)
const {
21 return internal::aligned_malloc(num_bytes);
23 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void deallocate(
void* buffer)
const { internal::aligned_free(buffer); }
24 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void* allocate_temp(
size_t num_bytes)
const {
return allocate(num_bytes); }
25 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void deallocate_temp(
void* buffer)
const { deallocate(buffer); }
26 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void memcpy(
void* dst,
const void* src,
size_t n)
const {
27 ::memcpy(dst, src, n);
29 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void memcpyHostToDevice(
void* dst,
const void* src,
size_t n)
const {
32 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void memcpyDeviceToHost(
void* dst,
const void* src,
size_t n)
const {
35 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void memset(
void* buffer,
int c,
size_t n)
const { ::memset(buffer, c, n); }
37 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void fill(T* begin, T*
end,
const T& value)
const {
38 #ifdef EIGEN_GPU_COMPILE_PHASE 40 for (T* it = begin; it !=
end; ++it) {
44 std::fill(begin,
end, value);
47 template <
typename Type>
48 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Type
get(Type data)
const {
52 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
size_t numThreads()
const {
53 #if !defined(EIGEN_GPU_COMPILE_PHASE) 56 #elif defined(EIGEN_HIP_DEVICE_COMPILE) 65 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
size_t firstLevelCacheSize()
const {
66 #if !defined(EIGEN_GPU_COMPILE_PHASE) && !defined(SYCL_DEVICE_ONLY) 69 #elif defined(EIGEN_HIP_DEVICE_COMPILE) 78 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
size_t lastLevelCacheSize()
const {
79 #if !defined(EIGEN_GPU_COMPILE_PHASE) && !defined(SYCL_DEVICE_ONLY) 82 #elif defined(EIGEN_HIP_DEVICE_COMPILE) 84 return firstLevelCacheSize();
87 return firstLevelCacheSize();
91 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void synchronize()
const {
95 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
int majorDeviceVersion()
const {
96 #if !defined(EIGEN_GPU_COMPILE_PHASE) 100 #elif defined(EIGEN_HIP_DEVICE_COMPILE) 106 return EIGEN_CUDA_ARCH / 100;
113 #endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_DEFAULT_H static constexpr lastp1_t end
Namespace containing all symbols from the Eigen library.
std::ptrdiff_t l3CacheSize()
std::ptrdiff_t l1CacheSize()