Eigen::DefaultDevice Struct Reference

Public Member Functions

void * allocate (size_t num_bytes) const
 
void * allocate_temp (size_t num_bytes) const
 
void deallocate (void *buffer) const
 
void deallocate_temp (void *buffer) const
 
template<typename T >
void fill (T *begin, T *end, const T &value) const
 
size_t firstLevelCacheSize () const
 
template<typename Type >
Type get (Type data) const
 
size_t lastLevelCacheSize () const
 
int majorDeviceVersion () const
 
void memcpy (void *dst, const void *src, size_t n) const
 
void memcpyDeviceToHost (void *dst, const void *src, size_t n) const
 
void memcpyHostToDevice (void *dst, const void *src, size_t n) const
 
void memset (void *buffer, int c, size_t n) const
 
size_t numThreads () const
 
void synchronize () const
 

Detailed Description

Definition at line 19 of file TensorDeviceDefault.h.

Member Function Documentation

◆ allocate()

void* Eigen::DefaultDevice::allocate ( size_t  num_bytes) const
inline

Definition at line 20 of file TensorDeviceDefault.h.

20  {
21  return internal::aligned_malloc(num_bytes);
22  }
void * aligned_malloc(std::size_t size)

◆ allocate_temp()

void* Eigen::DefaultDevice::allocate_temp ( size_t  num_bytes) const
inline

Definition at line 26 of file TensorDeviceDefault.h.

26  {
27  return allocate(num_bytes);
28  }
void * allocate(size_t num_bytes) const

◆ deallocate()

void Eigen::DefaultDevice::deallocate ( void *  buffer) const
inline

Definition at line 23 of file TensorDeviceDefault.h.

23  {
24  internal::aligned_free(buffer);
25  }
void aligned_free(void *ptr)

◆ deallocate_temp()

void Eigen::DefaultDevice::deallocate_temp ( void *  buffer) const
inline

Definition at line 29 of file TensorDeviceDefault.h.

29  {
30  deallocate(buffer);
31  }
void deallocate(void *buffer) const

◆ fill()

template<typename T >
void Eigen::DefaultDevice::fill ( T begin,
T end,
const T value 
) const
inline

Definition at line 45 of file TensorDeviceDefault.h.

45  {
46 #ifdef EIGEN_GPU_COMPILE_PHASE
47  // std::fill is not a device function, so resort to simple loop.
48  for (T* it = begin; it != end; ++it) {
49  *it = value;
50  }
51 #else
52  std::fill(begin, end, value);
53 #endif
54  }
static const lastp1_t end

◆ firstLevelCacheSize()

size_t Eigen::DefaultDevice::firstLevelCacheSize ( ) const
inline

Definition at line 73 of file TensorDeviceDefault.h.

73  {
74 #if !defined(EIGEN_GPU_COMPILE_PHASE) && !defined(SYCL_DEVICE_ONLY)
75  // Running on the host CPU
76  return l1CacheSize();
77 #elif defined(EIGEN_HIP_DEVICE_COMPILE)
78  // Running on a HIP device
79  return 48*1024; // FIXME : update this number for HIP
80 #else
81  // Running on a CUDA device, return the amount of shared memory available.
82  return 48*1024;
83 #endif
84  }
std::ptrdiff_t l1CacheSize()

◆ get()

template<typename Type >
Type Eigen::DefaultDevice::get ( Type  data) const
inline

Definition at line 56 of file TensorDeviceDefault.h.

56  {
57  return data;
58  }
int data[]

◆ lastLevelCacheSize()

size_t Eigen::DefaultDevice::lastLevelCacheSize ( ) const
inline

Definition at line 86 of file TensorDeviceDefault.h.

86  {
87 #if !defined(EIGEN_GPU_COMPILE_PHASE) && !defined(SYCL_DEVICE_ONLY)
88  // Running single threaded on the host CPU
89  return l3CacheSize();
90 #elif defined(EIGEN_HIP_DEVICE_COMPILE)
91  // Running on a HIP device
92  return firstLevelCacheSize(); // FIXME : update this number for HIP
93 #else
94  // Running on a CUDA device
95  return firstLevelCacheSize();
96 #endif
97  }
std::ptrdiff_t l3CacheSize()
size_t firstLevelCacheSize() const

◆ majorDeviceVersion()

int Eigen::DefaultDevice::majorDeviceVersion ( ) const
inline

Definition at line 103 of file TensorDeviceDefault.h.

103  {
104 #if !defined(EIGEN_GPU_COMPILE_PHASE)
105  // Running single threaded on the host CPU
106  // Should return an enum that encodes the ISA supported by the CPU
107  return 1;
108 #elif defined(EIGEN_HIP_DEVICE_COMPILE)
109  // Running on a HIP device
110  // return 1 as major for HIP
111  return 1;
112 #else
113  // Running on a CUDA device
114  return EIGEN_CUDA_ARCH / 100;
115 #endif
116  }

◆ memcpy()

void Eigen::DefaultDevice::memcpy ( void *  dst,
const void *  src,
size_t  n 
) const
inline

Definition at line 32 of file TensorDeviceDefault.h.

32  {
33  ::memcpy(dst, src, n);
34  }
void memcpy(void *dst, const void *src, size_t n) const

◆ memcpyDeviceToHost()

void Eigen::DefaultDevice::memcpyDeviceToHost ( void *  dst,
const void *  src,
size_t  n 
) const
inline

Definition at line 38 of file TensorDeviceDefault.h.

38  {
39  memcpy(dst, src, n);
40  }

◆ memcpyHostToDevice()

void Eigen::DefaultDevice::memcpyHostToDevice ( void *  dst,
const void *  src,
size_t  n 
) const
inline

Definition at line 35 of file TensorDeviceDefault.h.

35  {
36  memcpy(dst, src, n);
37  }

◆ memset()

void Eigen::DefaultDevice::memset ( void *  buffer,
int  c,
size_t  n 
) const
inline

Definition at line 41 of file TensorDeviceDefault.h.

41  {
42  ::memset(buffer, c, n);
43  }
void memset(void *buffer, int c, size_t n) const

◆ numThreads()

size_t Eigen::DefaultDevice::numThreads ( ) const
inline

Definition at line 60 of file TensorDeviceDefault.h.

60  {
61 #if !defined(EIGEN_GPU_COMPILE_PHASE)
62  // Running on the host CPU
63  return 1;
64 #elif defined(EIGEN_HIP_DEVICE_COMPILE)
65  // Running on a HIP device
66  return 64;
67 #else
68  // Running on a CUDA device
69  return 32;
70 #endif
71  }

◆ synchronize()

void Eigen::DefaultDevice::synchronize ( ) const
inline

Definition at line 99 of file TensorDeviceDefault.h.

99  {
100  // Nothing. Default device operations are synchronous.
101  }

The documentation for this struct was generated from the following file: