cloudy  trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
t_cpu_i Class Reference

#include <cpu.h>

Collaboration diagram for t_cpu_i:
Collaboration graph
[legend]

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 setAssertAbort (bool val)
 
bool lgAssertAbort () const
 
void set_nCPU (long n)
 
long nCPU () const
 
void set_used_nCPU (long n)
 
long used_nCPU () const
 
bool lgMPI () const
 
void set_MPISingleRankMode (bool mode)
 
bool lgMPISingleRankMode () const
 
void set_nRANK (long n)
 
long nRANK () const
 
bool lgMaster () const
 
bool lgMPI_talk () const
 
const char * host_name () const
 
void printDataPath () const
 
char chDirSeparator () const
 
bool firstOpen () const
 
bool foundMD5Mismatch () const
 
const string & chExitStatus (exit_type s) const
 

Private Member Functions

void enable_traps () const
 
void getPathList (const char *fname, vector< string > &PathList, access_scheme scheme, bool lgRead) const
 
void getMD5sums (const char *fname)
 

Static Private Member Functions

static void signal_handler (int sig)
 

Private Attributes

union {
   char   c [4]
 
   int32   i
 
endian
 
sys_float test_float
 
double test_double
 
int32 Float_SNaN_Value
 
int32 Double_SNaN_Value [2]
 
bool p_lgAssertAbort
 
long n_avail_CPU
 
long n_use_CPU
 
bool p_lgMPI
 
bool p_lgMPISingleRankMode
 
long n_rank
 
char HostName [STDLEN]
 
vector< string > chSearchPath
 
char p_chDirSeparator
 
int nFileDone
 
int nMD5Mismatch
 
map< string, string > md5sum_expct
 
vector< string > p_exit_status
 

Friends

FILE * open_data (const char *fname, const char *mode, access_scheme scheme)
 
void open_data (fstream &stream, const char *fname, ios_base::openmode mode, access_scheme scheme)
 
MPI_File open_data (const char *fname, int mode, access_scheme scheme)
 
void check_data (const char *fpath, const char *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)
 

Detailed Description

Definition at line 290 of file cpu.h.

Constructor & Destructor Documentation

t_cpu_i::t_cpu_i ( )

Member Function Documentation

bool t_cpu_i::big_endian ( ) const
inline

Definition at line 354 of file cpu.h.

References endian.

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

char t_cpu_i::chDirSeparator ( ) const
inline

Definition at line 400 of file cpu.h.

References p_chDirSeparator.

Referenced by cdMain().

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

Definition at line 403 of file cpu.h.

References p_exit_status.

Referenced by SaveGrid().

void t_cpu_i::enable_traps ( ) const
private

Definition at line 340 of file cpu.cpp.

Referenced by signal_handler(), and t_cpu_i().

bool t_cpu_i::firstOpen ( ) const
inline

Definition at line 401 of file cpu.h.

References nFileDone.

Referenced by AbortErrorMessage().

bool t_cpu_i::foundMD5Mismatch ( ) const
inline

Definition at line 402 of file cpu.h.

References nMD5Mismatch.

Referenced by PrtComment().

void t_cpu_i::getMD5sums ( const char *  fname)
private

Definition at line 623 of file cpu.cpp.

References AS_DATA_ONLY_TRY, DEBUG_ENTRY, FindAndReplace(), getPathList(), md5sum_expct, mode_r, nFileDone, and p_chDirSeparator.

Referenced by t_cpu_i().

Here is the call graph for this function:

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

Definition at line 574 of file cpu.cpp.

References AS_DATA_ONLY, AS_DATA_ONLY_TRY, AS_DATA_OPTIONAL, AS_DEFAULT, AS_LOCAL_DATA, AS_LOCAL_DATA_TRY, AS_LOCAL_ONLY, AS_LOCAL_ONLY_TRY, AS_SILENT_TRY, ASSERT, chSearchPath, DEBUG_ENTRY, i, and TotalInsanity().

Referenced by getMD5sums(), and open_data().

Here is the call graph for this function:

const char* t_cpu_i::host_name ( ) const
inline

Definition at line 398 of file cpu.h.

References HostName.

Referenced by optimize_phymir().

bool t_cpu_i::lgAssertAbort ( ) const
inline

Definition at line 385 of file cpu.h.

References p_lgAssertAbort.

Referenced by OUT_OF_RANGE().

bool t_cpu_i::lgMaster ( ) const
inline
bool t_cpu_i::lgMPI ( ) const
inline
bool t_cpu_i::lgMPI_talk ( ) const
inline

Definition at line 397 of file cpu.h.

References lgMaster(), and lgMPISingleRankMode().

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

Here is the call graph for this function:

bool t_cpu_i::lgMPISingleRankMode ( ) const
inline

Definition at line 393 of file cpu.h.

References p_lgMPISingleRankMode.

Referenced by cdMain(), cdPrepareExit(), InitDefaultsPreparse(), lgMPI_talk(), and ParseOptimize().

bool t_cpu_i::little_endian ( ) const
inline

Definition at line 355 of file cpu.h.

References endian.

Referenced by MD5string(), MyIsnan(), and t_cpu_i().

double t_cpu_i::min_double ( ) const
inline

Definition at line 358 of file cpu.h.

References test_double.

Referenced by t_version::t_version().

sys_float t_cpu_i::min_float ( ) const
inline

Definition at line 357 of file cpu.h.

References test_float.

Referenced by t_version::t_version().

long t_cpu_i::nCPU ( ) const
inline
long t_cpu_i::nRANK ( ) const
inline
void t_cpu_i::printDataPath ( ) const

Definition at line 566 of file cpu.cpp.

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

Referenced by AbortErrorMessage(), and ParsePrint().

Here is the call graph for this function:

void t_cpu_i::set_MPISingleRankMode ( bool  mode)
inline

Definition at line 392 of file cpu.h.

References p_lgMPISingleRankMode.

Referenced by main().

void t_cpu_i::set_nCPU ( long  n)
inline

Definition at line 387 of file cpu.h.

References n_avail_CPU.

Referenced by main().

void t_cpu_i::set_nRANK ( long  n)
inline

Definition at line 394 of file cpu.h.

References n_rank.

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

void t_cpu_i::set_signal_handlers ( )

Definition at line 519 of file cpu.cpp.

References DEBUG_ENTRY, 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

Definition at line 389 of file cpu.h.

References n_use_CPU.

Referenced by main(), and optimize_phymir().

void t_cpu_i::setAssertAbort ( bool  val)
inline

Definition at line 367 of file cpu.h.

References p_lgAssertAbort, and signal_handler().

Referenced by cdMain(), and ParseSet().

Here is the call graph for this function:

void t_cpu_i::signal_handler ( int  sig)
staticprivate

Definition at line 554 of file cpu.cpp.

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

Referenced by set_signal_handlers(), and setAssertAbort().

Here is the call graph for this function:

long t_cpu_i::used_nCPU ( ) const
inline

Definition at line 390 of file cpu.h.

References n_use_CPU.

Referenced by cdMain().

Friends And Related Function Documentation

void check_data ( const char *  fpath,
const char *  fname 
)
friend

Definition at line 878 of file cpu.cpp.

FILE* open_data ( const char *  fname,
const char *  mode,
access_scheme  scheme 
)
friend

Definition at line 765 of file cpu.cpp.

void open_data ( fstream &  stream,
const char *  fname,
ios_base::openmode  mode,
access_scheme  scheme 
)
friend

Definition at line 803 of file cpu.cpp.

MPI_File open_data ( const char *  fname,
int  mode,
access_scheme  scheme 
)
friend

Definition at line 838 of file cpu.cpp.

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

Definition at line 906 of file cpu.cpp.

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

Definition at line 914 of file cpu.cpp.

void set_NaN ( double &  x)
friend

Definition at line 932 of file cpu.cpp.

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

Definition at line 949 of file cpu.cpp.

Field Documentation

char t_cpu_i::c[4]

Definition at line 296 of file cpu.h.

vector<string> t_cpu_i::chSearchPath
private

the default search path to the data files

Definition at line 334 of file cpu.h.

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

int32 t_cpu_i::Double_SNaN_Value[2]
private

Definition at line 307 of file cpu.h.

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

Definition at line 303 of file cpu.h.

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

Definition at line 332 of file cpu.h.

Referenced by host_name(), and t_cpu_i().

int32 t_cpu_i::i

Definition at line 297 of file cpu.h.

Referenced by getPathList(), and printDataPath().

map<string,string> t_cpu_i::md5sum_expct
private

the map of the MD5 sums of all the data files

Definition at line 342 of file cpu.h.

Referenced by check_data(), and getMD5sums().

long t_cpu_i::n_avail_CPU
private

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

Definition at line 319 of file cpu.h.

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

Definition at line 330 of file cpu.h.

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

long t_cpu_i::n_use_CPU
private

the number of used CPUs

Definition at line 321 of file cpu.h.

Referenced by set_used_nCPU(), and used_nCPU().

int t_cpu_i::nFileDone
private

how many data files have been opened?

Definition at line 338 of file cpu.h.

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

int t_cpu_i::nMD5Mismatch
private

how many modified data files were found?

Definition at line 340 of file cpu.h.

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

char t_cpu_i::p_chDirSeparator
private

the directory separator character for this OS

Definition at line 336 of file cpu.h.

Referenced by chDirSeparator(), getMD5sums(), and t_cpu_i().

vector<string> t_cpu_i::p_exit_status
private

Definition at line 347 of file cpu.h.

Referenced by chExitStatus(), and t_cpu_i().

bool t_cpu_i::p_lgAssertAbort
private

should a failed assert raise SIGABRT so that we can catch it in a debugger?

Definition at line 316 of file cpu.h.

Referenced by lgAssertAbort(), setAssertAbort(), and t_cpu_i().

bool t_cpu_i::p_lgMPI
private

flag whether we are doing an MPI run or not

Definition at line 323 of file cpu.h.

Referenced by lgMPI(), and t_cpu_i().

bool t_cpu_i::p_lgMPISingleRankMode
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

Definition at line 328 of file cpu.h.

Referenced by lgMPISingleRankMode(), set_MPISingleRankMode(), and t_cpu_i().

double t_cpu_i::test_double
private

Definition at line 301 of file cpu.h.

Referenced by min_double(), and t_cpu_i().

sys_float t_cpu_i::test_float
private

Definition at line 300 of file cpu.h.

Referenced by min_float(), and t_cpu_i().


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