Skip to content

Conversation

@colesbury
Copy link
Member

This adds allocators as a concept in ATen that extends deleters. An
allocator is a subclass of at::Allocator that implements the virtual
methods:

  virtual void* allocate(size_t n);
  virutal void deallocate(void* ptr);

A tensor created with a custom allocator can be resized, unlike a tensor
with a custom deleter.

cc @zdevito

@pytorchbot
Copy link
Collaborator

@colesbury, thanks for your PR! We identified @zdevito to be a potential reviewer.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This adds allocators as a concept in ATen that extends deleters. An
allocator is a subclass of at::Allocator that implements the virtual
methods:

  virtual void* allocate(size_t n);
  virutal void deallocate(void* ptr);

A tensor created with a custom allocator can be resized, unlike a tensor
with a custom deleter.
nullptr,
nullptr,
};
static cudaError_t wrapped_alloc(void * ctx, void** result, size_t size, cudaStream_t stream) {

This comment was marked as off-topic.

This comment was marked as off-topic.

nullptr,
call_deleter,
};
static void* wrapped_alloc(void * ctx, ptrdiff_t size) {

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@soumith soumith merged commit 2c71b67 into pytorch:master Dec 18, 2017
@colesbury colesbury deleted the pin_memory branch December 18, 2017 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants