MADNESS 0.10.1
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
MemoryMeasurer Class Reference

measure the memory usage of all FunctionImpl objects of all worlds More...

Classes

struct  MemInfo
 
struct  MemKey
 

Public Member Functions

void clear_map ()
 reset the memory map
 
void measure_and_print (World &world)
 measure the memory usage of all objects of all worlds
 
std::map< std::string, double > memory_per_host (World &world) const
 accumulate the memory usage of all objects of all worlds over all ranks per host
 
std::map< std::string, double > memory_per_host_local () const
 accumulate the memory usage of all objects of all worlds for this rank per host
 
void print_memory_map (World &world, std::string msg="")
 
void search_all_worlds ()
 
void search_world (World &world)
 
double total_memory (World &world) const
 return the total memory usage over all hosts
 

Static Public Member Functions

static double get_rss_usage_in_GB ()
 

Private Types

typedef std::map< MemKey, MemInfoMemInfoMapT
 

Private Member Functions

template<typename T , std::size_t NDIM>
void add_memory_to_map (const FunctionImpl< T, NDIM > &f)
 
template<typename T , std::size_t NDIM>
const FunctionImpl< T, NDIM > * cast_to_funcimpl_ptr (const uniqueidT obj_id)
 

Private Attributes

MemInfoMapT world_memory_map
 keeps track of the memory usage of all objects of one or many worlds on this rank
 

Detailed Description

measure the memory usage of all FunctionImpl objects of all worlds

Assuming FunctionImpl are the largest objects in a calculation data is kept as key-value pairs in a map: key=world_id,rank,hostname,NDIM, value=#functions,memory_GB

Member Typedef Documentation

◆ MemInfoMapT

typedef std::map<MemKey,MemInfo> MemoryMeasurer::MemInfoMapT
private

Member Function Documentation

◆ add_memory_to_map()

template<typename T , std::size_t NDIM>
void MemoryMeasurer::add_memory_to_map ( const FunctionImpl< T, NDIM > &  f)
inlineprivate

References madness::f, NDIM, madness::print(), T(), and world_memory_map.

Referenced by search_world().

◆ cast_to_funcimpl_ptr()

template<typename T , std::size_t NDIM>
const FunctionImpl< T, NDIM > * MemoryMeasurer::cast_to_funcimpl_ptr ( const uniqueidT  obj_id)
inlineprivate

◆ clear_map()

void MemoryMeasurer::clear_map ( )
inline

reset the memory map

References world_memory_map.

◆ get_rss_usage_in_GB()

static double MemoryMeasurer::get_rss_usage_in_GB ( )
inlinestatic

Referenced by print_memory_map().

◆ measure_and_print()

void MemoryMeasurer::measure_and_print ( World world)
inline

measure the memory usage of all objects of all worlds

References madness::WorldGopInterface::fence(), madness::World::gop, print_memory_map(), and search_all_worlds().

Referenced by test_size().

◆ memory_per_host()

std::map< std::string, double > MemoryMeasurer::memory_per_host ( World world) const
inline

accumulate the memory usage of all objects of all worlds over all ranks per host

References madness::World::gop, memory_per_host(), memory_per_host_local(), and madness::WorldGopInterface::sum().

Referenced by memory_per_host(), memory_per_host_local(), and print_memory_map().

◆ memory_per_host_local()

std::map< std::string, double > MemoryMeasurer::memory_per_host_local ( ) const
inline

accumulate the memory usage of all objects of all worlds for this rank per host

References memory_per_host(), and world_memory_map.

Referenced by memory_per_host(), and print_memory_map().

◆ print_memory_map()

void MemoryMeasurer::print_memory_map ( World world,
std::string  msg = "" 
)
inline

◆ search_all_worlds()

void MemoryMeasurer::search_all_worlds ( )
inline

add all FunctionImpl<T,NDIM> objects of all worlds to the memory map the memory map is a rank-local object

References madness::World::exists(), madness::World::get_world_ids(), madness::print(), search_world(), and madness::World::world_from_id().

Referenced by measure_and_print(), and test_size().

◆ search_world()

void MemoryMeasurer::search_world ( World world)
inline

add all FunctionImpl<T,NDIM> objects of the given world to the memory map the memory map is a rank-local object

References add_memory_to_map(), madness::World::get_object_ids(), madness::print(), and madness::World::rank().

Referenced by search_all_worlds(), and test_size().

◆ total_memory()

double MemoryMeasurer::total_memory ( World world) const
inline

return the total memory usage over all hosts

References madness::World::gop, madness::WorldGopInterface::sum(), total_memory(), and world_memory_map.

Referenced by test_size(), and total_memory().

Member Data Documentation

◆ world_memory_map

MemInfoMapT MemoryMeasurer::world_memory_map
private

keeps track of the memory usage of all objects of one or many worlds on this rank

Referenced by add_memory_to_map(), clear_map(), memory_per_host_local(), print_memory_map(), and total_memory().


The documentation for this class was generated from the following file: