ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
ModuleBase::Memory Class Reference

Record memory consumption during computation. More...

#include <memory.h>

Collaboration diagram for ModuleBase::Memory:

Public Member Functions

 Memory ()
 
 ~Memory ()
 

Static Public Member Functions

static double record (const std::string &class_name, const std::string &name, const long &n, const std::string &type, const bool accumulate=false)
 Record memory consumed during computation.
 
static void record (const std::string &name_in, const size_t &n_in, const bool accumulate=false)
 Record memory consumed during computation.
 
static double & get_total (void)
 
static void finish (std::ofstream &ofs)
 
static void print_all (std::ofstream &ofs)
 Print memory consumed (> 1 MB) in a file.
 
static void print (const int find_in)
 
static double calculate_mem (const long &n, const std::string &type)
 Calculate memory requirements for various types of data.
 

Static Private Attributes

static double total = 0.0
 
static std::string * name
 
static std::string * class_name
 
static double * consume
 
static int n_memory = 1000
 
static int n_now = 0
 
static bool init_flag = false
 
static int complex_matrix_memory = 2*sizeof(double)
 
static int double_memory = sizeof(double)
 
static int int_memory = sizeof(int)
 
static int bool_memory = sizeof(bool)
 
static int short_memory = sizeof(short)
 
static int float_memory = sizeof(float)
 

Detailed Description

Record memory consumption during computation.

Author
Mohan
Note
8 bit = 1 Byte; 1024 Byte = 1 KB; 1024 KB = 1 MB; 1024 MB = 1 GB

Constructor & Destructor Documentation

◆ Memory()

ModuleBase::Memory::Memory ( )

◆ ~Memory()

ModuleBase::Memory::~Memory ( )

Member Function Documentation

◆ calculate_mem()

double ModuleBase::Memory::calculate_mem ( const long &  n,
const std::string &  type 
)
static

Calculate memory requirements for various types of data.

Parameters
nThe number of a type of data
typeThe type of data
Returns
double
Here is the caller graph for this function:

◆ finish()

void ModuleBase::Memory::finish ( std::ofstream &  ofs)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_total()

static double & ModuleBase::Memory::get_total ( void  )
inlinestatic

◆ print()

void ModuleBase::Memory::print ( const int  find_in)
static
Here is the caller graph for this function:

◆ print_all()

void ModuleBase::Memory::print_all ( std::ofstream &  ofs)
static

Print memory consumed (> 1 MB) in a file.

Parameters
ofsThe output file stream for print out memory records
Here is the call graph for this function:
Here is the caller graph for this function:

◆ record() [1/2]

double ModuleBase::Memory::record ( const std::string &  class_name,
const std::string &  name,
const long &  n,
const std::string &  type,
const bool  accumulate = false 
)
static

Record memory consumed during computation.

Parameters
class_nameThe name of a class
nameThe name of a quantity
nThe number of the quantity
typeThe type of data
accumulateUseless, always set false
Returns
double
Here is the call graph for this function:
Here is the caller graph for this function:

◆ record() [2/2]

void ModuleBase::Memory::record ( const std::string &  name_in,
const size_t &  n_in,
const bool  accumulate = false 
)
static

Record memory consumed during computation.

Parameters
nameThe name of a quantity
nThe number of the quantity
accumulateUseless, always set false
Here is the call graph for this function:

Member Data Documentation

◆ bool_memory

int ModuleBase::Memory::bool_memory = sizeof(bool)
staticprivate

◆ class_name

std::string * ModuleBase::Memory::class_name
staticprivate

◆ complex_matrix_memory

int ModuleBase::Memory::complex_matrix_memory = 2*sizeof(double)
staticprivate

◆ consume

double * ModuleBase::Memory::consume
staticprivate

◆ double_memory

int ModuleBase::Memory::double_memory = sizeof(double)
staticprivate

◆ float_memory

int ModuleBase::Memory::float_memory = sizeof(float)
staticprivate

◆ init_flag

bool ModuleBase::Memory::init_flag = false
staticprivate

◆ int_memory

int ModuleBase::Memory::int_memory = sizeof(int)
staticprivate

◆ n_memory

int ModuleBase::Memory::n_memory = 1000
staticprivate

◆ n_now

int ModuleBase::Memory::n_now = 0
staticprivate

◆ name

std::string * ModuleBase::Memory::name
staticprivate

◆ short_memory

int ModuleBase::Memory::short_memory = sizeof(short)
staticprivate

◆ total

double ModuleBase::Memory::total = 0.0
staticprivate

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