UMPIRE
Umpire: resource management and provision
umpire Namespace Reference

Namespaces

 alloc
 
 detail
 
 event
 
 numa
 
 op
 
 resource
 
 strategy
 
 util
 

Classes

class  Allocator
 Provides a unified interface to allocate and free data. More...
 
class  DeviceAllocator
 Lightweight allocator for use in GPU code. More...
 
class  ResourceManager
 
class  TypedAllocator
 Allocator for objects of type T. More...
 
class  runtime_error
 
class  out_of_memory_error
 
class  unknown_pointer_error
 
class  resource_error
 
struct  MemoryResourceTraits
 

Typedefs

using Platform = camp::resources::Platform
 

Enumerations

enum class  Tracking { Tracked , Untracked }
 

Functions

std::ostream & operator<< (std::ostream &os, const Allocator &allocator)
 
std::string to_string (const Allocator &a)
 
__host__ __device__ DeviceAllocator get_device_allocator (const char *name)
 
__host__ __device__ DeviceAllocator get_device_allocator (int da_id)
 
__host__ __device__ bool is_device_allocator (const char *name)
 
__host__ __device__ bool is_device_allocator (int da_id)
 
__host__ DeviceAllocator make_device_allocator (Allocator allocator, size_t size, const std::string &name)
 Construct a new DeviceAllocator. Calls the private Device Allocator constructor that records the associated id. More...
 
__host__ void destroy_device_allocator ()
 
template<typename U , typename V >
bool operator== (const TypedAllocator< U > &, const TypedAllocator< V > &)
 
template<typename U , typename V >
bool operator!= (const TypedAllocator< U > &, const TypedAllocator< V > &)
 
void print_allocator_records (Allocator allocator, std::ostream &os=std::cout)
 Print the allocations from a specific allocator in a human-readable format. More...
 
std::vector< util::AllocationRecordget_allocator_records (Allocator allocator)
 Returns vector of AllocationRecords created by the allocator. More...
 
bool pointer_overlaps (void *left, void *right)
 Check whether the right allocation overlaps the left. More...
 
bool pointer_contains (void *left, void *right)
 Check whether the left allocation contains the right. More...
 
bool is_accessible (Platform p, Allocator a)
 Check whether or not an Allocator is accessible from a given platform. More...
 
std::string get_backtrace (void *ptr)
 Get the backtrace associated with the allocation of ptr. More...
 
std::size_t get_process_memory_usage_hwm ()
 Get high watermark memory usage of the current process (uses underlying system-dependent calls) More...
 
std::size_t get_process_memory_usage ()
 Get memory usage of the current process (uses underlying system-dependent calls) More...
 
std::size_t get_internal_memory_usage ()
 Get the current memory usage for internal Umpire data structures. More...
 
void mark_event (const std::string &event)
 Mark an application-specific event string within Umpire life cycle. More...
 
std::size_t get_total_bytes_allocated ()
 Get the total umpire memory usage in bytes across all memory resources. More...
 
std::size_t get_device_memory_usage (int device_id)
 Get memory usage of device device_id, using appropriate underlying vendor API. More...
 
std::vector< util::AllocationRecordget_leaked_allocations (Allocator allocator)
 Get all the leaked (active) allocations associated with allocator. More...
 
umpire::MemoryResourceTraits get_default_resource_traits (const std::string &name)
 Return the default traits for the given allocator string. More...
 
void * find_pointer_from_name (Allocator allocator, const std::string &name)
 Return the pointer of an allocation for the given allocator and name. More...
 
void register_external_allocation (void *ptr, util::AllocationRecord record)
 
util::AllocationRecord deregister_external_allocation (void *ptr)
 
camp::resources::Resource get_resource (Allocator a, void *ptr)
 Returns the Camp resource associated with a particular allocation This function is used mainly for testing purposes. More...
 
std::size_t get_num_pending (Allocator a)
 Returns the number of pending chunks associated with a ResourceAwarePool Allocator This function is used mainly for testing purposes. More...
 
bool try_coalesce (Allocator a)
 Attempt to coalesce Allocator a, return true if a coalesce was performed. More...
 
void coalesce (Allocator a)
 Attempt to coalesce Allocator a, throw if a does not support coalescing. More...
 
void initialize ()
 
void finalize ()
 
void * malloc (std::size_t size)
 Allocate memory in the default space, with the default allocator. More...
 
void free (void *ptr)
 Free any memory allocated with Umpire. More...
 
int get_major_version ()
 
int get_minor_version ()
 
int get_patch_version ()
 
std::string get_rc_version ()
 
MemoryResourceTraits::vendor_type cpu_vendor_type () noexcept
 
std::ostream & log ()
 
std::ostream & error ()
 
std::string to_string (const MemoryResourceTraits::shared_scope &scope)
 
std::string to_string (const MemoryResourceTraits::optimized_for &value)
 
std::string to_string (const MemoryResourceTraits::vendor_type &vendor)
 
std::string to_string (const MemoryResourceTraits::memory_type &type)
 
std::string to_string (const MemoryResourceTraits::resource_type &resource)
 
std::string to_string (const MemoryResourceTraits::granularity_type &granularity)
 
long get_page_size ()
 
std::string platform_to_string (Platform type)
 

Variables

DeviceAllocatorUMPIRE_DEV_ALLOCS_h {nullptr}
 
__device__ DeviceAllocatorUMPIRE_DEV_ALLOCS {nullptr}
 
constexpr int UMPIRE_TOTAL_DEV_ALLOCS {64}
 

Typedef Documentation

◆ Platform

using umpire::Platform = typedef camp::resources::Platform

Enumeration Type Documentation

◆ Tracking

enum umpire::Tracking
strong
Enumerator
Tracked 
Untracked 

Function Documentation

◆ operator<<()

std::ostream& umpire::operator<< ( std::ostream &  os,
const Allocator allocator 
)

◆ to_string() [1/7]

◆ get_device_allocator() [1/2]

__host__ __device__ DeviceAllocator umpire::get_device_allocator ( const char *  name)

◆ get_device_allocator() [2/2]

__host__ __device__ DeviceAllocator umpire::get_device_allocator ( int  da_id)

◆ is_device_allocator() [1/2]

__host__ __device__ bool umpire::is_device_allocator ( const char *  name)

◆ is_device_allocator() [2/2]

◆ make_device_allocator()

__host__ DeviceAllocator umpire::make_device_allocator ( Allocator  allocator,
size_t  size,
const std::string &  name 
)

Construct a new DeviceAllocator. Calls the private Device Allocator constructor that records the associated id.

Parameters
allocatorAllocator to build the DeviceAllocator from.
sizeTotal size of the DeviceAllocator.
nameof the DeviceAllocator

◆ destroy_device_allocator()

◆ operator==()

template<typename U , typename V >
bool umpire::operator== ( const TypedAllocator< U > &  lhs,
const TypedAllocator< V > &  rhs 
)

◆ operator!=()

template<typename U , typename V >
bool umpire::operator!= ( const TypedAllocator< U > &  lhs,
const TypedAllocator< V > &  rhs 
)

◆ print_allocator_records()

void umpire::print_allocator_records ( Allocator  allocator,
std::ostream &  os = std::cout 
)

Print the allocations from a specific allocator in a human-readable format.

Parameters
allocatorsource Allocator.
osoutput stream

Referenced by umpire::ResourceManager::~ResourceManager().

◆ get_allocator_records()

std::vector< util::AllocationRecord > umpire::get_allocator_records ( Allocator  allocator)

Returns vector of AllocationRecords created by the allocator.

Parameters
allocatorsource Allocator.

Referenced by umpire::ResourceManager::destroyAllocator(), and get_leaked_allocations().

◆ pointer_overlaps()

bool umpire::pointer_overlaps ( void *  left,
void *  right 
)

Check whether the right allocation overlaps the left.

right will overlap left if the right is greater than left, but less than left+size, and right+size is strictly greater than left+size.

Parameters
leftPointer to left allocation
rightPoniter to right allocation

References umpire::util::message::Error, umpire::ResourceManager::getInstance(), and UMPIRE_LOG.

Referenced by umpire_pointer_overlaps().

◆ pointer_contains()

bool umpire::pointer_contains ( void *  left,
void *  right 
)

Check whether the left allocation contains the right.

right is contained by left if right is greater than left, and right+size is greater than left+size.

Parameters
leftPointer to left allocation
rightPoniter to right allocation

References umpire::util::message::Error, umpire::ResourceManager::getInstance(), and UMPIRE_LOG.

Referenced by umpire_pointer_contains().

◆ is_accessible()

bool umpire::is_accessible ( Platform  p,
Allocator  a 
)

Check whether or not an Allocator is accessible from a given platform.

This function describes which allocators should be accessible from which CAMP platforms. Information on platform/allocator accessibility can be found at https://umpire.readthedocs.io/en/develop/features/allocator_accessibility.html

Parameters
camp::Platformp
umpire::Allocatora

References umpire::Allocator::getAllocationStrategy(), umpire::strategy::AllocationStrategy::getParent(), and umpire::resource::MemoryResource::isAccessibleFrom().

◆ get_backtrace()

std::string umpire::get_backtrace ( void *  ptr)

Get the backtrace associated with the allocation of ptr.

The string may be empty if backtraces are not enabled.

References umpire::ResourceManager::getInstance(), umpire::event::record(), and UMPIRE_USE_VAR.

Referenced by umpire_get_backtrace_bufferify().

◆ get_process_memory_usage_hwm()

std::size_t umpire::get_process_memory_usage_hwm ( )

Get high watermark memory usage of the current process (uses underlying system-dependent calls)

Referenced by umpire_get_process_memory_usage_hwm().

◆ get_process_memory_usage()

std::size_t umpire::get_process_memory_usage ( )

Get memory usage of the current process (uses underlying system-dependent calls)

Referenced by umpire_get_process_memory_usage().

◆ get_internal_memory_usage()

std::size_t umpire::get_internal_memory_usage ( )

Get the current memory usage for internal Umpire data structures.

References umpire::ResourceManager::getInstance(), and umpire::ResourceManager::getInternalMemoryUsage().

◆ mark_event()

void umpire::mark_event ( const std::string &  event)

Mark an application-specific event string within Umpire life cycle.

References umpire::event::metadata, and umpire::event::record().

◆ get_total_bytes_allocated()

std::size_t umpire::get_total_bytes_allocated ( )

Get the total umpire memory usage in bytes across all memory resources.

References umpire::Allocator::getActualSize(), and umpire::ResourceManager::getInstance().

◆ get_device_memory_usage()

std::size_t umpire::get_device_memory_usage ( int  device_id)

Get memory usage of device device_id, using appropriate underlying vendor API.

References UMPIRE_ERROR, and UMPIRE_USE_VAR.

Referenced by umpire_get_device_memory_usage().

◆ get_leaked_allocations()

std::vector< util::AllocationRecord > umpire::get_leaked_allocations ( Allocator  allocator)

Get all the leaked (active) allocations associated with allocator.

References get_allocator_records().

◆ get_default_resource_traits()

umpire::MemoryResourceTraits umpire::get_default_resource_traits ( const std::string &  name)

Return the default traits for the given allocator string.

References umpire::resource::MemoryResourceRegistry::getInstance().

Referenced by umpire::strategy::DeviceIpcAllocator::DeviceIpcAllocator().

◆ find_pointer_from_name()

void * umpire::find_pointer_from_name ( Allocator  allocator,
const std::string &  name 
)

Return the pointer of an allocation for the given allocator and name.

References umpire::resource::HostSharedMemoryResource::find_pointer_from_name(), umpire::Allocator::getName(), UMPIRE_ERROR, and UMPIRE_USE_VAR.

◆ register_external_allocation()

void umpire::register_external_allocation ( void *  ptr,
util::AllocationRecord  record 
)

◆ deregister_external_allocation()

util::AllocationRecord umpire::deregister_external_allocation ( void *  ptr)

◆ get_resource()

camp::resources::Resource umpire::get_resource ( Allocator  a,
void *  ptr 
)

Returns the Camp resource associated with a particular allocation This function is used mainly for testing purposes.

Parameters
Umpireallocator which was used to allocate the data
Pointerwhich was used for the allocation
Returns
Camp resource associated with the allocation assuming the Allocator passed in is a ResourceAwarePool strategy and the allocation is either used or pending

References umpire::Allocator::getAllocationStrategy(), umpire::Allocator::getName(), UMPIRE_ERROR, UMPIRE_LOG, and umpire::util::message::Warning.

◆ get_num_pending()

std::size_t umpire::get_num_pending ( Allocator  a)

Returns the number of pending chunks associated with a ResourceAwarePool Allocator This function is used mainly for testing purposes.

Parameters
UmpireResourceAwarePool allocator
Returns
Number of currently pending chunks in the ResourceAwarePool

References umpire::Allocator::getAllocationStrategy(), umpire::Allocator::getName(), and UMPIRE_ERROR.

◆ try_coalesce()

bool umpire::try_coalesce ( Allocator  a)

Attempt to coalesce Allocator a, return true if a coalesce was performed.

Returns
True if the Allocator was coalesced.

References umpire::strategy::DynamicPoolList::coalesce(), umpire::strategy::QuickPool::coalesce(), and umpire::Allocator::getAllocationStrategy().

Referenced by coalesce().

◆ coalesce()

void umpire::coalesce ( Allocator  a)

Attempt to coalesce Allocator a, throw if a does not support coalescing.

Exceptions
umpire::util::Exceptionif the Allocator doesn't support coalescing.

References umpire::Allocator::getName(), try_coalesce(), and UMPIRE_ERROR.

◆ initialize()

void umpire::initialize ( )
inline

◆ finalize()

void umpire::finalize ( )

◆ malloc()

void* umpire::malloc ( std::size_t  size)
inline

Allocate memory in the default space, with the default allocator.

This method is a convenience wrapper around calls to the ResourceManager to allocate memory in the default MemorySpace.

Parameters
sizeNumber of bytes to allocate.

References umpire::Allocator::allocate(), umpire::ResourceManager::getDefaultAllocator(), and umpire::ResourceManager::getInstance().

Referenced by umpire::alloc::MallocAllocator::allocate(), and StdAllocator::allocate().

◆ free()

◆ get_major_version()

int umpire::get_major_version ( )
inline

◆ get_minor_version()

int umpire::get_minor_version ( )
inline

◆ get_patch_version()

int umpire::get_patch_version ( )
inline

◆ get_rc_version()

std::string umpire::get_rc_version ( )
inline

◆ cpu_vendor_type()

◆ log()

◆ error()

◆ to_string() [2/7]

◆ to_string() [3/7]

◆ to_string() [4/7]

◆ to_string() [5/7]

◆ to_string() [6/7]

◆ to_string() [7/7]

◆ get_page_size()

long umpire::get_page_size ( )

◆ platform_to_string()

Variable Documentation

◆ UMPIRE_DEV_ALLOCS_h

◆ UMPIRE_DEV_ALLOCS

__device__ DeviceAllocator * umpire::UMPIRE_DEV_ALLOCS {nullptr}

◆ UMPIRE_TOTAL_DEV_ALLOCS

constexpr int umpire::UMPIRE_TOTAL_DEV_ALLOCS {64}
constexpr