UMPIRE
Umpire: resource management and provision
umpire::util Namespace Reference

Namespaces

 detail
 
 message
 

Classes

class  AllocationMap
 
struct  AllocationRecord
 
struct  backtrace
 
struct  trace_optional
 
struct  trace_always
 
struct  backtracer
 
struct  backtracer< trace_optional >
 
struct  backtracer< trace_always >
 
class  FixedMallocPool
 Pool for fixed size allocations using malloc() More...
 
class  Logger
 
struct  iterator_begin
 
struct  iterator_end
 
class  MemoryMap
 A fast replacement for std::map<void*,Value> for a generic Value. More...
 
class  MPI
 
class  OutputBuffer
 

Functions

float relative_fragmentation (std::vector< util::AllocationRecord > &recs)
 Compute the relative fragmentation of a set of allocation records. More...
 
int find_first_set (int i)
 Find the first (least significant) bit set in i. More...
 
void initialize_io (const bool enable_log)
 Initialize the streams. This method is called when ResourceManager is initialized. Most users will not need to call this manually. More...
 
void finalize_io ()
 Counterpart of initialize_io that finalizes the streams and ensures that no live references to the buffers of standard streams exist. Most users will not need to call this manually. More...
 
void flush_files ()
 Synchronize all stream buffers to their respective output sequences. This function is usually called by exception generating code like UMPIRE_ERROR. More...
 
std::string make_unique_filename (const std::string &base_dir, const std::string &name, const int pid, const std::string &extension)
 
bool file_exists (const std::string &path)
 
bool directory_exists (const std::string &path)
 
const std::string & get_io_output_dir ()
 
const std::string & get_io_output_basename ()
 
static int case_insensitive_match (const std::string s1, const std::string s2)
 
template<typename T , typename... Args>
constexpr std::unique_ptr< T > make_unique (Args &&... args)
 
bool matchesSharedMemoryResource (const std::string &name, const std::string &resource_type) noexcept
 
template<typename Base >
std::unique_ptr< Base > do_wrap (std::unique_ptr< Base > &&allocator)
 
template<typename Base , typename Strategy , typename... Strategies>
std::unique_ptr< Base > do_wrap (std::unique_ptr< Base > &&allocator)
 
template<typename... Strategies>
std::unique_ptr< strategy::AllocationStrategywrap_allocator (std::unique_ptr< strategy::AllocationStrategy > &&allocator)
 
template<typename Strategy >
Strategy * unwrap_allocation_strategy (strategy::AllocationStrategy *base_strategy)
 
template<typename Strategy >
Strategy * unwrap_allocator (Allocator allocator)
 

Variables

static const char * env_name = "UMPIRE_LOG_LEVEL"
 
static message::Level defaultLevel = message::Info
 
static const char * MessageLevelName [message::Num_Levels] = {"ERROR", "WARNING", "INFO", "DEBUG"}
 

Function Documentation

◆ relative_fragmentation()

float umpire::util::relative_fragmentation ( std::vector< util::AllocationRecord > &  recs)

Compute the relative fragmentation of a set of allocation records.

Fragmentation = 1 - (largest free block) / (total free space)

◆ find_first_set()

int umpire::util::find_first_set ( int  i)
inline

Find the first (least significant) bit set in i.

Parameters
iBits.
Returns
Index of the first bit set. Bits are numbered starting at 1, the least significant bit. A return value of 0 means that no bits were set.

Referenced by FixedSizePool< T, MA, IA, NP >::allocInPool().

◆ initialize_io()

void umpire::util::initialize_io ( const bool  enable_log)

Initialize the streams. This method is called when ResourceManager is initialized. Most users will not need to call this manually.

Warning
This function will capture references to buffers of std::cerr and/or std::cout. If these are using custom buffers with explicitly-manager lifetime should may need to call this and finalize_io() to control explicitly initialization/finalization of Umpire I/O.

References directory_exists(), umpire::error(), get_io_output_basename(), get_io_output_dir(), umpire::util::MPI::getRank(), umpire::util::MPI::isInitialized(), umpire::log(), umpire::util::MPI::logMpiInfo(), make_unique_filename(), umpire::util::detail::s_error_buffer_accessor(), umpire::util::detail::s_log_buffer_accessor(), umpire::util::OutputBuffer::setConsoleStream(), umpire::util::OutputBuffer::setFileStream(), umpire::util::MPI::sync(), and UMPIRE_ERROR.

◆ finalize_io()

void umpire::util::finalize_io ( )

Counterpart of initialize_io that finalizes the streams and ensures that no live references to the buffers of standard streams exist. Most users will not need to call this manually.

References umpire::util::detail::s_error_buffer_accessor(), umpire::util::detail::s_log_buffer_accessor(), umpire::util::OutputBuffer::setConsoleStream(), umpire::util::OutputBuffer::setFileStream(), and umpire::util::OutputBuffer::sync().

◆ flush_files()

void umpire::util::flush_files ( )

Synchronize all stream buffers to their respective output sequences. This function is usually called by exception generating code like UMPIRE_ERROR.

References umpire::error(), and umpire::log().

◆ make_unique_filename()

std::string umpire::util::make_unique_filename ( const std::string &  base_dir,
const std::string &  name,
const int  pid,
const std::string &  extension 
)

◆ file_exists()

bool umpire::util::file_exists ( const std::string &  path)

Referenced by make_unique_filename().

◆ directory_exists()

bool umpire::util::directory_exists ( const std::string &  path)

Referenced by initialize_io().

◆ get_io_output_dir()

const std::string & umpire::util::get_io_output_dir ( )

◆ get_io_output_basename()

const std::string & umpire::util::get_io_output_basename ( )

◆ case_insensitive_match()

static int umpire::util::case_insensitive_match ( const std::string  s1,
const std::string  s2 
)
static

◆ make_unique()

template<typename T , typename... Args>
constexpr std::unique_ptr<T> umpire::util::make_unique ( Args &&...  args)
constexpr

◆ matchesSharedMemoryResource()

bool umpire::util::matchesSharedMemoryResource ( const std::string &  name,
const std::string &  resource_type 
)
inlinenoexcept

◆ do_wrap() [1/2]

template<typename Base >
std::unique_ptr<Base> umpire::util::do_wrap ( std::unique_ptr< Base > &&  allocator)

Referenced by wrap_allocator().

◆ do_wrap() [2/2]

template<typename Base , typename Strategy , typename... Strategies>
std::unique_ptr<Base> umpire::util::do_wrap ( std::unique_ptr< Base > &&  allocator)

◆ wrap_allocator()

template<typename... Strategies>
std::unique_ptr<strategy::AllocationStrategy> umpire::util::wrap_allocator ( std::unique_ptr< strategy::AllocationStrategy > &&  allocator)

References do_wrap().

◆ unwrap_allocation_strategy()

template<typename Strategy >
Strategy* umpire::util::unwrap_allocation_strategy ( strategy::AllocationStrategy base_strategy)

◆ unwrap_allocator()

template<typename Strategy >
Strategy* umpire::util::unwrap_allocator ( Allocator  allocator)

Variable Documentation

◆ env_name

const char* umpire::util::env_name = "UMPIRE_LOG_LEVEL"
static

◆ defaultLevel

message::Level umpire::util::defaultLevel = message::Info
static

◆ MessageLevelName

const char* umpire::util::MessageLevelName[message::Num_Levels] = {"ERROR", "WARNING", "INFO", "DEBUG"}
static