Utils¶
Bits¶
- 
namespace paddle¶
- Functions - template <class T>
- 
constexpr std::enable_if<(std::is_integral<T>::value && std::is_unsigned<T>::value && sizeof(T) <= sizeof(unsigned int)), unsigned int>::type findLastSet(T x)¶
- From Facebook folly: https://github.com/facebook/folly/blob/master/folly/Bits.h - findLastSet: return the 1-based index of the highest bit set - for x > 0: \[ findLastSet(x) = 1 + \floor*{\log_{2}x} \]
 - template <class T>
- 
constexpr std::enable_if<(std::is_integral<T>::value && std::is_unsigned<T>::value && sizeof(T) > sizeof(unsigned int) && sizeof(T) <= sizeof(unsigned long)), unsigned int>::type findLastSet(T x)¶
 
Memory Handle¶
- 
namespace paddle¶
- Typedefs - 
typedef std::shared_ptr<MemoryHandle> MemoryHandlePtr¶
 - 
typedef std::shared_ptr<CpuMemoryHandle> CpuMemHandlePtr¶
 - 
typedef std::shared_ptr<GpuMemoryHandle> GpuMemHandlePtr¶
 - 
class CpuMemoryHandle¶
- #include <MemoryHandle.h>Wrapper class for raw cpu memory handle. The raw handle will be released at destructor Inherits from paddle::MemoryHandle 
 - 
class GpuMemoryHandle¶
- #include <MemoryHandle.h>Wrapper class for raw gpu memory handle. The raw handle will be released at destructor Inherits from paddle::MemoryHandle 
 - 
class MemoryHandle¶
- Subclassed by paddle::CpuMemoryHandle, paddle::GpuMemoryHandle 
 
- 
typedef std::shared_ptr<MemoryHandle> 
- 
namespace paddle¶
- 
class Allocator¶
- #include <Allocator.h>Allocator base class. This is the base class of all Allocator class. Subclassed by paddle::CpuAllocator, paddle::CudaHostAllocator, paddle::GpuAllocator 
 - 
class CpuAllocator¶
- #include <Allocator.h>CPU allocator implementation. Inherits from paddle::Allocator 
 - 
class CudaHostAllocator¶
- #include <Allocator.h>CPU pinned memory allocator implementation. Inherits from paddle::Allocator 
 - 
class GpuAllocator¶
- #include <Allocator.h>GPU allocator implementation. Inherits from paddle::Allocator 
 
- 
class 
- 
namespace paddle¶
- 
class PoolAllocator¶
- #include <PoolAllocator.h>Memory pool allocator implementation. Public Functions - 
PoolAllocator(Allocator *allocator, size_t sizeLimit = 0, const std::string &name = "pool")¶
- constructor. - Parameters
- allocator-- a Allocator object. 
- sizeLimit-- The maximum size memory can be managed, if sizeLimit == 0, the pool allocator is a simple wrapper of allocator. 
 
 
 - 
~PoolAllocator()¶
- destructor. 
 - 
void *alloc(size_t size)¶
 - 
void free(void *ptr, size_t size)¶
 - 
std::string getName()¶
 
- 
 
- 
class 
- 
namespace paddle¶
- 
class StorageEngine¶
- #include <Storage.h>Storage manager for multiple devices. Public Functions - 
PoolAllocator *getGpuAllocator(int deviceId)¶
- Return
- return one gpu allocator by deviceId
 
 - 
PoolAllocator *getCpuAllocator()¶
- Return
- return cpu allocator
 
 Public Static Functions - 
StorageEngine *singleton()¶
- Return
- Storage singleton
 
 
- 
PoolAllocator *
 
- 
class