Triumvirate C++ API 0.5.0.post1.dev301+g026f21751
Three-point clustering measurements in large-scale structure analyses.
Loading...
Searching...
No Matches
monitor.hpp File Reference

Provide tracking of program resources and exceptions. More...

#include <gsl/gsl_version.h>
#include <fftw3.h>
#include <chrono>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <regex>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
+ Include dependency graph for monitor.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  trv::sys::Logger
 Logger with logging level differentiation. More...
 
class  trv::sys::ProgressBar
 Progress bar for tracking tasks. More...
 
class  trv::sys::UnimplementedError
 Exception raised when a function or method is unimplemented. More...
 
class  trv::sys::IOError
 Exception raised when an input/output operation fails. More...
 
class  trv::sys::InvalidParameterError
 Exception raised when parameters are invalid. More...
 
class  trv::sys::InvalidDataError
 Exception raised when the data to be operated on are invalid. More...
 

Namespaces

namespace  trv
 
namespace  trv::sys
 

Enumerations

enum  trv::sys::LogLevel {
  trv::sys::NSET = 0 , trv::sys::DBUG = 10 , trv::sys::STAT = 20 , trv::sys::INFO = 30 ,
  trv::sys::WARN = 40 , trv::sys::ERRO = 50
}
 Logging levels. More...
 

Functions

bool trv::sys::has_extension (const std::string &fname, const std::string &fext)
 Check if a file has a given extension.
 
std::string trv::sys::join_strings (const std::vector< std::string > &strings, const std::string &delimiter)
 Join a vector of strings with a delimiter.
 
std::vector< std::string > trv::sys::split_string (const std::string &str, const std::string &delimiter)
 Split a string into a vector of strings.
 
template<typename T>
double trv::sys::size_in_gb (long long num)
 Return size in gibibytes.
 
template<typename T>
double trv::sys::size_in_gb (int num)
 Return size in gibibytes.
 
void trv::sys::update_maxmem (bool gpu=false)
 Update the maximum memory usage estimate.
 
void trv::sys::update_maxcntgrid ()
 Update the maximum 3-d grid counts.
 
std::string trv::sys::show_current_datetime (bool utc=false)
 Return the current datetime string.
 
std::string trv::sys::show_elapsed_time (double duration_in_seconds)
 Return the elapsed-time string in 'HH:MM:SS' format.
 
std::string trv::sys::show_timestamp ()
 Return the timestamp string including the elapsed time.
 
int trv::sys::get_gpu_count (bool sys=false)
 Get the number of GPUs available.
 
std::vector< int > trv::sys::get_gpu_ids ()
 Get the indices of GPUs available for use.
 
bool trv::sys::is_gpu_available ()
 Check if GPUs are available in the system.
 
bool trv::sys::is_gpu_enabled ()
 Check if GPU mode is enabled.
 
bool trv::sys::is_gpu_single ()
 Check if in single-GPU mode.
 
void trv::sys::exit_fatal (const std::string &msg)
 Terminate the program with exit status EXIT_FAILURE.
 
bool trv::sys::is_colourable ()
 Check if the program stdout is colourable.
 
std::vector< float > trv::sys::set_nodes_by_str (std::string interval_str)
 Set a node list possibly from a string.
 
std::string trv::sys::get_build_datetime ()
 Return the build datetime string in ISO 8601–like format.
 
void trv::sys::display_help ()
 Display help message in stdout.
 
void trv::sys::display_prog_logo ()
 Display program logo in stdout.
 
void trv::sys::display_prog_licence (bool brief=false)
 Display program licence in stdout.
 
void trv::sys::display_prog_info (bool runtime=false)
 Display program information in stdout.
 
void trv::sys::display_prog_logbars (int endpoint)
 Display program log bars in stdout.
 
void trv::sys::expand_envar_in_path (std::string &path_str)
 Expand environment variables in a path string.
 

Variables

int trv::sys::currTask = 0
 current task
 
double trv::sys::gbytesMem = 0.
 current memory usage in gibibytes
 
double trv::sys::gbytesMaxMem = 0.
 maximum memory usage in gibibytes
 
double trv::sys::gbytesMemGPU = 0.
 current (GPU) memory usage in gibibytes
 
double trv::sys::gbytesMaxMemGPU = 0.
 maximum (GPU) memory usage in gibibytes
 
int trv::sys::count_rgrid = 0
 number of 3-d real grids
 
int trv::sys::count_cgrid = 0
 number of 3-d complex grids
 
float trv::sys::count_grid = 0.
 number of grids
 
int trv::sys::max_count_rgrid = 0
 maximum number of 3-d real grids
 
int trv::sys::max_count_cgrid = 0
 maximum number of 3-d complex grids
 
float trv::sys::max_count_grid = 0.
 maximum number of grids
 
int trv::sys::count_fft = 0
 number of FFTs
 
int trv::sys::count_ifft = 0
 number of IFFTs
 
bool trv::sys::fftw_wisdom_f_imported = false
 wisdom import status for forward transform
 
bool trv::sys::fftw_wisdom_b_imported = false
 wisdom import status for backward transform
 
Logger trv::sys::logger
 default logger (at NSET logging level)
 

Detailed Description

Provide tracking of program resources and exceptions.

Authors
Mike S Wang (https://github.com/MikeSWang), Naonori S Sugiyama (https://github.com/naonori)

This module defines the global variables and functions to track time and memory usage of the program. It also defines custom exceptions used in the program.

Definition in file monitor.hpp.