54 return static_cast<T*
>(ptr);
64 return device_id_ == other.device_id_;
77 template <
typename T2>
static void * Malloc(size_t byte_size, const Device &device)
static void Free(void *ptr, const Device &device)
Frees previously allocated memory at address ptr on device device.
StdAllocator(StdAllocator &&)=default
Default move constructor.
StdAllocator(const StdAllocator< U > &other)
Rebind copy constructor.
StdAllocator()=default
Default constructor.
void deallocate(T *p, std::size_t n)
Deallocates memory from pointer p of size n .
T * allocate(std::size_t n)
Allocates memory of size n.
StdAllocator(const StdAllocator &)=default
Default copy constructor.
StdAllocator & operator=(const StdAllocator &)=default
Default copy assignment operator.
bool operator!=(const StdAllocator &other) const
Returns true if the instances are not equal, false otherwise.
int GetDeviceID() const
Returns the device on which memory is allocated.
StdAllocator(int device_id)
Constructor from device.
bool operator==(const StdAllocator &other) const
Returns true if the instances are equal, false otherwise.
StdAllocator & operator=(StdAllocator &&)=default
Default move assignment operator.
Generic file read and write utility for python interface.