Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
t_cpu_i Class Reference

#include <cpu.h>

Public Member Functions

 t_cpu_i ()
 
bool big_endian () const
 
bool little_endian () const
 
sys_float min_float () const
 
double min_double () const
 
void set_signal_handlers ()
 
void set_nCPU (long n)
 
long nCPU () const
 
void set_used_nCPU (long n)
 
long used_nCPU () const
 
bool lgMPI () const
 
void set_MPIMode (MPI_state mode)
 
MPI_state MPIMode () const
 
void set_nRANK (long n)
 
long nRANK () const
 
bool lgMaster () const
 
bool lgMPI_talk () const
 
void set_ExecName (const string &name)
 
void disableBacktrace ()
 
void enableBacktrace ()
 
void GenerateBacktrace (void *ptr)
 
void PrintBacktrace (const string &s, bool lgPrintSeed=true)
 
const string & ExecName () const
 
const char * host_name () const
 
void printDataPath () const
 
string chDirSeparator () const
 
void appendDirSeparator (char *path) const
 
bool firstOpen () const
 
bool foundCSMismatch () const
 
const string & chExitStatus (exit_type s) const
 
void initPath ()
 

Private Member Functions

void p_assertValidPath ()
 
void enable_traps () const
 
void getPathList (const string &fname, vector< string > &PathList, access_scheme scheme, bool lgRead) const
 
void getchecksums (const string &fname)
 

Static Private Member Functions

static void signal_handler (int sig, siginfo_t *, void *ptr)
 

Private Attributes

union {
   char   c [4]
 
   int32   i
 
endian
 
sys_float test_float
 
double test_double
 
int32 Float_SNaN_Value
 
int64 Double_SNaN_Value
 
long n_avail_CPU
 
long n_use_CPU
 
bool p_lgMPI
 
MPI_state p_MPIMode
 
long n_rank
 
string p_ExecName
 
vector< string > chTraceback
 
char HostName [STDLEN]
 
vector< string > chSearchPath
 
string p_chCloudyRoot
 
char p_chDirSeparator
 
int nFileDone
 
int nCSMismatch
 
map< string, string > checksum_expct
 
bool lgPathInitialized
 
bool p_suppressBacktrace
 
vector< string > p_exit_status
 

Friends

FILE * open_data (const string &fname, const string &mode, access_scheme scheme, string *rpath)
 
void open_data (fstream &stream, const string &fname, ios_base::openmode mode, access_scheme scheme, string *rpath)
 
MPI_File open_data (const string &fname, int mode, access_scheme scheme, string *rpath)
 
void check_data (const string &fpath, const string &fname)
 
void set_NaN (sys_float &x)
 
void set_NaN (sys_float x[], long n)
 
void set_NaN (double &x)
 
void set_NaN (double x[], long n)
 

Constructor & Destructor Documentation

Member Function Documentation

void t_cpu_i::appendDirSeparator ( char *  path) const
inline

References i, and p_chDirSeparator.

bool t_cpu_i::big_endian ( ) const
inline

References endian.

Referenced by mie_read_opc(), mie_write_opc(), SaveDo(), and t_cpu_i().

const string& t_cpu_i::chExitStatus ( exit_type  s) const
inline

References p_exit_status.

Referenced by SaveGrid().

void t_cpu_i::disableBacktrace ( )
inline

References p_suppressBacktrace.

Referenced by main().

void t_cpu_i::enable_traps ( ) const
private

Referenced by signal_handler(), and t_cpu_i().

void t_cpu_i::enableBacktrace ( )
inline

References p_suppressBacktrace.

const string& t_cpu_i::ExecName ( ) const
inline

References p_ExecName.

bool t_cpu_i::firstOpen ( ) const
inline

References nFileDone.

Referenced by ErrorMessage().

bool t_cpu_i::foundCSMismatch ( ) const
inline

References nCSMismatch.

Referenced by PrtComment().

void t_cpu_i::getchecksums ( const string &  fname)
private

References checksum_expct, DEBUG_ENTRY, FindAndReplace(), mode_r, open_data, and p_chDirSeparator.

Referenced by initPath().

Here is the call graph for this function:

void t_cpu_i::getPathList ( const string &  fname,
vector< string > &  PathList,
access_scheme  scheme,
bool  lgRead 
) const
private

References AS_LOCAL_ONLY, AS_LOCAL_ONLY_TRY, cdEXIT, chSearchPath, DEBUG_ENTRY, EXIT_FAILURE, fprintf(), i, ioQQQ, and p_chDirSeparator.

Referenced by open_data().

Here is the call graph for this function:

const char* t_cpu_i::host_name ( ) const
inline

References HostName.

Referenced by optimize_phymir().

void t_cpu_i::initPath ( )

References chSearchPath, DEBUG_ENTRY, FindAndReplace(), getchecksums(), lgPathInitialized, NULL, p_chCloudyRoot, p_chDirSeparator, Split(), and SPM_RELAX.

Referenced by cdInit(), and main().

Here is the call graph for this function:

bool t_cpu_i::lgMPI_talk ( ) const
inline

References lgMaster(), MS_GRID, and p_MPIMode.

Referenced by cdInit(), cdMain(), cdTalk(), gridXspec(), iter_end_check(), optimize_do(), ParseCommands(), and SaveDo().

Here is the call graph for this function:

bool t_cpu_i::little_endian ( ) const
inline

References endian.

Referenced by MD5string_core(), and t_cpu_i().

double t_cpu_i::min_double ( ) const
inline

References test_double.

Referenced by t_version::t_version().

sys_float t_cpu_i::min_float ( ) const
inline

References test_float.

Referenced by t_version::t_version().

MPI_state t_cpu_i::MPIMode ( ) const
inline
void t_cpu_i::p_assertValidPath ( )
private

aborts if search path is not set up

References EXIT_FAILURE, fprintf(), and lgPathInitialized.

Referenced by open_data().

Here is the call graph for this function:

void t_cpu_i::PrintBacktrace ( const string &  s,
bool  lgPrintSeed = true 
)

References chTraceback, fprintf(), i, ioQQQ, t_ran::print_seed(), and ran.

Referenced by cdBacktrace(), and cdMain().

Here is the call graph for this function:

void t_cpu_i::printDataPath ( ) const

References chSearchPath, fprintf(), i, ioQQQ, and lgPathInitialized.

Referenced by ErrorMessage(), and ParsePrint().

Here is the call graph for this function:

void t_cpu_i::set_ExecName ( const string &  name)
inline

References p_ExecName.

Referenced by main().

void t_cpu_i::set_MPIMode ( MPI_state  mode)
inline

References p_MPIMode.

Referenced by main().

void t_cpu_i::set_nCPU ( long  n)
inline

References n_avail_CPU.

Referenced by main().

void t_cpu_i::set_nRANK ( long  n)
inline

References n_rank.

Referenced by load_balance::init(), and main().

void t_cpu_i::set_signal_handlers ( )

References DEBUG_ENTRY, NULL, and signal_handler().

Referenced by main(), and t_cpu_i().

Here is the call graph for this function:

void t_cpu_i::set_used_nCPU ( long  n)
inline

References n_use_CPU.

Referenced by main(), and optimize_phymir().

void t_cpu_i::signal_handler ( int  sig,
siginfo_t *  ,
void *  ptr 
)
staticprivate

References cpu, enable_traps(), and t_cpu::i().

Referenced by set_signal_handlers().

Here is the call graph for this function:

long t_cpu_i::used_nCPU ( ) const
inline

References n_use_CPU.

Referenced by cdMain().

Friends And Related Function Documentation

void check_data ( const string &  fpath,
const string &  fname 
)
friend
FILE* open_data ( const string &  fname,
const string &  mode,
access_scheme  scheme,
string *  rpath 
)
friend

Referenced by getchecksums().

void open_data ( fstream &  stream,
const string &  fname,
ios_base::openmode  mode,
access_scheme  scheme,
string *  rpath 
)
friend
MPI_File open_data ( const string &  fname,
int  mode,
access_scheme  scheme,
string *  rpath 
)
friend
void set_NaN ( sys_float x)
friend

define routines for setting single and double precision signaling NaN The bit pattern for an SNaN is implementation defined, but this should work on most modern CPU's. The system definition is preferred, so in C++ this should be replaced by numeric_limits<TYPE>::signaling_NaN()

set_NaN - set variable or array to SNaN

void set_NaN ( sys_float  x[],
long  n 
)
friend
void set_NaN ( double &  x)
friend
void set_NaN ( double  x[],
long  n 
)
friend

Member Data Documentation

char t_cpu_i::c[4]
map<string,string> t_cpu_i::checksum_expct
private

the map of the checksums of all the data files

Referenced by check_data(), and getchecksums().

vector<string> t_cpu_i::chSearchPath
private

the default search path to the data files

Referenced by getPathList(), initPath(), and printDataPath().

vector<string> t_cpu_i::chTraceback
private

the generated traceback will be stored here to be printed later

Referenced by PrintBacktrace().

int64 t_cpu_i::Double_SNaN_Value
private

Referenced by set_NaN(), and t_cpu_i().

union { ... } t_cpu_i::endian

alias an int32 to 4 chars to test if we are on a big-endian or little-endian CPU the array cpu.endian.c[] is initialized in cdInit()

Referenced by big_endian(), little_endian(), and t_cpu_i().

int32 t_cpu_i::Float_SNaN_Value
private

Referenced by set_NaN(), and t_cpu_i().

char t_cpu_i::HostName[STDLEN]
private

the name of the computer, not detected on all systems

Referenced by host_name(), and t_cpu_i().

int32 t_cpu_i::i
bool t_cpu_i::lgPathInitialized
private

is the search path initialized?

Referenced by initPath(), p_assertValidPath(), printDataPath(), and t_cpu_i().

long t_cpu_i::n_avail_CPU
private

the number of available CPUs on the system, not detected on all systems

Referenced by nCPU(), set_nCPU(), and t_cpu_i().

long t_cpu_i::n_rank
private

the rank number in an MPI run, -1 otherwise

Referenced by lgMaster(), nRANK(), set_nRANK(), and t_cpu_i().

long t_cpu_i::n_use_CPU
private

the number of used CPUs

Referenced by set_used_nCPU(), and used_nCPU().

int t_cpu_i::nCSMismatch
private

how many modified data files were found?

Referenced by check_data(), foundCSMismatch(), and t_cpu_i().

int t_cpu_i::nFileDone
private

how many data files have been opened?

Referenced by firstOpen(), open_data(), and t_cpu_i().

string t_cpu_i::p_chCloudyRoot
private

the path to the root of the Cloudy installation

Referenced by initPath().

char t_cpu_i::p_chDirSeparator
private

the directory separator character for this OS

Referenced by appendDirSeparator(), chDirSeparator(), getchecksums(), getPathList(), initPath(), and t_cpu_i().

string t_cpu_i::p_ExecName
private

command used to start up Cloudy

Referenced by ExecName(), set_ExecName(), and t_cpu_i().

vector<string> t_cpu_i::p_exit_status
private

Referenced by chExitStatus(), and t_cpu_i().

bool t_cpu_i::p_lgMPI
private

flag whether we are doing an MPI run or not

Referenced by lgMPI(), and t_cpu_i().

MPI_state t_cpu_i::p_MPIMode
private

flag indicating whether each rank runs its own model true means that each rank runs a different sim (e.g. in a grid) false means that all ranks cooperate on the same sim this flag is moot in a non-MPI run

Referenced by lgMPI_talk(), MPIMode(), set_MPIMode(), and t_cpu_i().

bool t_cpu_i::p_suppressBacktrace
private

option to suppress backtrace

Referenced by disableBacktrace(), enableBacktrace(), and t_cpu_i().

double t_cpu_i::test_double
private

Referenced by min_double(), and t_cpu_i().

sys_float t_cpu_i::test_float
private

Referenced by min_float(), and t_cpu_i().


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