Class CPUStorage

Inheritance Relationships

Base Type

Class Documentation

class CPUStorage : public spdl::core::Storage

CPU memory storage with optional memory pinning.

CPUStorage manages a block of CPU memory with configurable allocation and deallocation functions. Supports pinned (page-locked) memory for efficient transfers to GPU.

Public Functions

virtual void *data() const override

Get pointer to the stored data.

Returns:

Pointer to the data.

bool is_pinned() const

Check if memory is pinned.

Returns:

true if memory is pinned, false otherwise.

CPUStorage() = default

Default constructor.

explicit CPUStorage(size_t size, allocator_type allocator = default_alloc, deallocator_type deallocator = default_dealloc, bool pin_memory = false)

Construct CPU storage with custom allocator.

Parameters:
  • size – Size of storage in bytes.

  • allocator – Optional custom allocator function.

  • deallocator – Optional custom deallocator function.

  • pin_memory – Whether to pin (page-lock) the memory.

CPUStorage(const CPUStorage&) = delete

Deleted copy constructor.

CPUStorage &operator=(const CPUStorage&) = delete

Deleted copy assignment operator.

CPUStorage(CPUStorage&&) noexcept

Move constructor.

CPUStorage &operator=(CPUStorage&&) noexcept

Move assignment operator.

~CPUStorage() override

Destructor.

Public Members

size_t size

Size of the storage in bytes.