UMPIRE
Umpire: resource management and provision
umpire::op::MemoryOperationRegistry Class Reference

The MemoryOperationRegistry serves as a registry for MemoryOperation objects. It is a singleton class, typically accessed through the ResourceManager. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/op/MemoryOperationRegistry.hpp>

Public Member Functions

std::shared_ptr< umpire::op::MemoryOperationfind (const std::string &name, strategy::AllocationStrategy *source_allocator, strategy::AllocationStrategy *dst_allocator)
 Function to find a MemoryOperation object. More...
 
std::shared_ptr< umpire::op::MemoryOperationfind (const std::string &name, std::pair< Platform, Platform > platforms)
 
void registerOperation (const std::string &name, std::pair< Platform, Platform > platforms, std::shared_ptr< MemoryOperation > &&operation) noexcept
 Add a new MemoryOperation to the registry. More...
 
 MemoryOperationRegistry (const MemoryOperationRegistry &)=delete
 
MemoryOperationRegistryoperator= (const MemoryOperationRegistry &)=delete
 
 ~MemoryOperationRegistry ()=default
 

Static Public Member Functions

static MemoryOperationRegistrygetInstance () noexcept
 Get the MemoryOperationRegistry singleton instance. More...
 

Protected Member Functions

 MemoryOperationRegistry () noexcept
 

Detailed Description

The MemoryOperationRegistry serves as a registry for MemoryOperation objects. It is a singleton class, typically accessed through the ResourceManager.

The MemoryOperationRegistry class provides lookup mechanisms allowing searching for the appropriate MemoryOperation to be applied to allocations made with particular AllocationStrategy objects.

MemoryOperations provided by Umpire are registered with the MemoryOperationRegistry when it is constructed. Additional MemoryOperations can be registered later using the registerOperation method.

The following operations are pre-registered for all AllocationStrategy pairs:

  • "COPY"
  • "MEMSET"
  • "REALLOCATE"
See also
MemoryOperation
AllocationStrategy

Constructor & Destructor Documentation

◆ MemoryOperationRegistry() [1/2]

umpire::op::MemoryOperationRegistry::MemoryOperationRegistry ( const MemoryOperationRegistry )
delete

◆ ~MemoryOperationRegistry()

umpire::op::MemoryOperationRegistry::~MemoryOperationRegistry ( )
default

◆ MemoryOperationRegistry() [2/2]

umpire::op::MemoryOperationRegistry::MemoryOperationRegistry ( )
protectednoexcept

References registerOperation().

Member Function Documentation

◆ getInstance()

◆ find() [1/2]

std::shared_ptr< umpire::op::MemoryOperation > umpire::op::MemoryOperationRegistry::find ( const std::string &  name,
strategy::AllocationStrategy source_allocator,
strategy::AllocationStrategy dst_allocator 
)

Function to find a MemoryOperation object.

Finds the MemoryOperation object that matches the given name and AllocationStrategy objects. If the requested MemoryOperation is not found, this method will throw an runtime_error.

Parameters
nameName of operation.
src_allocatorAllocationStrategy of the source allocation.
dst_allocatorAllocationStrategy of the destination allocation.
Exceptions
umpire::util::runtime_errorif the requested MemoryOperation is not found.

References umpire::strategy::AllocationStrategy::getPlatform().

◆ find() [2/2]

std::shared_ptr< umpire::op::MemoryOperation > umpire::op::MemoryOperationRegistry::find ( const std::string &  name,
std::pair< Platform, Platform platforms 
)

References UMPIRE_ERROR.

◆ registerOperation()

void umpire::op::MemoryOperationRegistry::registerOperation ( const std::string &  name,
std::pair< Platform, Platform platforms,
std::shared_ptr< MemoryOperation > &&  operation 
)
noexcept

Add a new MemoryOperation to the registry.

This object will register the provided MemoryOperation, making it available for later retrieval using MemoryOperation::find

Parameters
nameName of the operation.
platformspair of Platforms for the source and destination.
operationpointer to the MemoryOperation.

Referenced by MemoryOperationRegistry().

◆ operator=()

MemoryOperationRegistry& umpire::op::MemoryOperationRegistry::operator= ( const MemoryOperationRegistry )
delete