Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cpu.h File Reference
#include "mpi_utilities.h"
Include dependency graph for cpu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  t_cpu_i
 
class  t_cpu
 
struct  SameType< T1, T2 >
 
struct  SameType< T, T >
 

Macros

#define UNUSED   /*@unused@*/
 
#define INT8_MAX   127
 
#define INT8_MIN   (-INT8_MAX - 1)
 
#define UINT8_MAX   255
 
#define INT16_MAX   32767
 
#define INT16_MIN   (-INT16_MAX - 1)
 
#define UINT16_MAX   65535
 
#define INT32_MAX   2147483647L
 
#define INT32_MIN   (-INT32_MAX - 1)
 
#define UINT32_MAX   4294967295UL
 
#define INT64_MAX   9223372036854775807LL
 
#define INT64_MIN   (-INT64_MAX - 1)
 
#define UINT64_MAX   18446744073709551615ULL
 
#define CD_ALIGN   16
 
#define NORETURN   /*@noreturn@*/
 
#define FALLTHROUGH   (void)0
 
#define ALIGNED(X)   __attribute__ ((aligned(X)))
 
#define RESTRICT
 
#define LIKELY(x)   (x)
 
#define UNLIKELY(x)   (x)
 
#define DO_EXPAND(VAL)   VAL ## 1
 
#define EXPAND(VAL)   DO_EXPAND(VAL)
 
#define __COMP   "unknown"
 
#define __COMP_VER   0
 
#define __OS   "unknown"
 

Enumerations

enum  access_scheme {
  AS_DEFAULT, AS_OPTIONAL, AS_TRY, AS_SILENT_TRY,
  AS_LOCAL_ONLY, AS_LOCAL_ONLY_TRY
}
 

Functions

void posix_memalign_free (void *p)
 
FILE * open_data (const string &fname, const string &mode, access_scheme scheme=AS_DEFAULT, string *rpath=nullptr)
 
void open_data (fstream &stream, const string &fname, ios_base::openmode mode, access_scheme scheme=AS_DEFAULT, string *rpath=nullptr)
 
MPI_File open_data (const string &fname, int mode, access_scheme scheme=AS_DEFAULT, string *rpath=nullptr)
 
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)
 
bool MyIsnan (const sys_float &x)
 
bool MyIsnan (const double &x)
 

Variables

const realnum BIGFLOAT = numeric_limits<realnum>::max()/realnum(100.f)
 
const realnum SMALLFLOAT = numeric_limits<realnum>::min()*realnum(100.f)
 
const double BIGDOUBLE = DBL_MAX/100.
 
const double SMALLDOUBLE = DBL_MIN*100.
 
const int STDLEN = 32
 
const ios_base::openmode mode_r = ios_base::in
 
const ios_base::openmode mode_w = ios_base::out | ios_base::trunc
 
const ios_base::openmode mode_a = ios_base::out | ios_base::app
 
const ios_base::openmode mode_rp = ios_base::in | ios_base::out
 
const ios_base::openmode mode_wp = ios_base::in | ios_base::out | ios_base::trunc
 
const ios_base::openmode mode_ap = ios_base::in | ios_base::out | ios_base::app
 
const ios_base::openmode UNUSED mode_rb = mode_r | ios_base::binary
 
const ios_base::openmode UNUSED mode_wb = mode_w | ios_base::binary
 
const ios_base::openmode UNUSED mode_ab = mode_a | ios_base::binary
 
const ios_base::openmode UNUSED mode_rpb = mode_rp | ios_base::binary
 
const ios_base::openmode UNUSED mode_wpb = mode_wp | ios_base::binary
 
const ios_base::openmode UNUSED mode_apb = mode_ap | ios_base::binary
 
static t_cpu cpu
 

Detailed Description

store CPU specific information

Macro Definition Documentation

#define __COMP   "unknown"

Referenced by t_version::t_version().

#define __COMP_VER   0

Referenced by t_version::t_version().

#define __OS   "unknown"

Referenced by t_version::t_version().

#define ALIGNED (   X)    __attribute__ ((aligned(X)))
#define DO_EXPAND (   VAL)    VAL ## 1
#define EXPAND (   VAL)    DO_EXPAND(VAL)
#define FALLTHROUGH   (void)0

Referenced by cdMain().

#define INT16_MAX   32767
#define INT16_MIN   (-INT16_MAX - 1)

Referenced by prt_constants().

#define INT32_MAX   2147483647L
#define INT32_MIN   (-INT32_MAX - 1)

Referenced by prt_constants().

#define INT64_MAX   9223372036854775807LL

Referenced by prt_constants().

#define INT64_MIN   (-INT64_MAX - 1)

Referenced by prt_constants().

#define INT8_MAX   127

some definitions for integers with a guaranteed number of bits

#define INT8_MIN   (-INT8_MAX - 1)
#define LIKELY (   x)    (x)
#define NORETURN   /*@noreturn@*/
#define RESTRICT
#define UINT16_MAX   65535

Referenced by prt_constants().

#define UINT32_MAX   4294967295UL

Referenced by prt_constants().

#define UINT64_MAX   18446744073709551615ULL

Referenced by prt_constants().

#define UINT8_MAX   255
#define UNLIKELY (   x)    (x)
#define UNUSED   /*@unused@*/

Enumeration Type Documentation

flag used as third parameter for open_data, indicates how data files are searched AS_DEFAULT: use default behavior: search along path for reading, use local dir for writing the code will print an error message and abort if opening the file failed AS_OPTIONAL: same as AS_DEFAULT, except that the precense of the file is optional a less scary error message will be printed and a NULL pointer will be returned if opening the file failed AS_TRY: same as AS_DEFAULT, except that that a NULL pointer is returned when the file is not found and nothing will be printed, it is up to the caller to decide what is the appropriate action AS_SILENT_TRY: same as AS_TRY, but does not write to ioQQQ in trace mode. this should only be used when ioQQQ does not point to a valid stream, which is almost never the case... AS_LOCAL_ONLY: search in the current working directory only. USE THIS ONLY WHEN YOU ARE READING A FILE THAT WAS PRODUCED DURING THE SAME CLOUDY RUN, e.g. during file gathering in a grid run otherwise this option behaves the same as AS_DEFAULT AS_LOCAL_ONLY_TRY: same as AS_LOCAL_ONLY, but returns NULL pointer when the file is not found

Enumerator
AS_DEFAULT 
AS_OPTIONAL 
AS_TRY 
AS_SILENT_TRY 
AS_LOCAL_ONLY 
AS_LOCAL_ONLY_TRY 

Function Documentation

void check_data ( const string &  fpath,
const string &  fname 
)
bool MyIsnan ( const sys_float x)

detect quiet and signaling NaNs in FP numbers

detect quiet and signaling NaNs in single precision FP

bool MyIsnan ( const double &  x)

detect quiet and signaling NaNs in double precision FP

FILE* open_data ( const string &  fname,
const string &  mode,
access_scheme  scheme = AS_DEFAULT,
string *  rpath = nullptr 
)

References AS_DEFAULT, AS_LOCAL_ONLY, AS_OPTIONAL, check_data(), check_mult_path(), cpu, DEBUG_ENTRY, ErrorMessage(), t_cpu_i::getPathList(), t_cpu::i(), t_cpu_i::nFileDone, NULL, t_cpu_i::p_assertValidPath(), and sys_fopen().

Referenced by save_img_matrix::addImagePop_FITS(), append_file(), atmdat_CHIANTI_readin(), atmdat_LAMDA_readin(), Badnell_rec_init(), cdInput(), cdMain(), cdOutput(), cdRead(), check_grid_file(), CloudyPrintReference(), ContBandsCreate(), CoStarInitialize(), save_img_matrix::createImage_FITS(), save_img_matrix::createImage_PPM(), DatabasePrintReference(), DumpAtmosphere(), fix_grid_file(), GetJenkins09(), GetMetalsDeplete(), GridGatherOutputParallel(), GridGatherOutputSequential(), diatomics::H2_CollidRateRead(), diatomics::H2_Read_hminus_distribution(), diatomics::H2_Read_LTE_cooling_per_H2(), diatomics::H2_ReadDissocEnergies(), diatomics::H2_ReadDissprob(), diatomics::H2_ReadEnergies(), diatomics::H2_ReadTransprob(), HyperfineCreate(), t_yield::init_yield(), InitGrid(), InterpolateGridCoStar(), InterpolateRectGrid(), iso_recomb_setup(), lgCompileAtmosphere(), lgFileReadable(), lgValidASCIIFile(), lgValidIdxFile(), bands_file::load(), LoadIsotopes(), main(), MD5datafile(), MD5file(), mie_read_mix(), mie_read_opc(), mie_read_rfi(), mie_read_szd(), mie_write_opc(), open_abn_file(), optimize_do(), optimize_phymir(), phymir_state< X, Y, NP, NSTR >::p_execute_job_parallel(), DataParser::p_open(), phymir_state< X, Y, NP, NSTR >::p_rd_state(), t_gaunt::p_read_table(), t_mesh::p_ReadResolution(), phymir_state< X, Y, NP, NSTR >::p_wr_state(), ParseInitFile(), ParseTable(), plot_sparsity(), pnegopc(), process_output(), qheat(), RauchInitialize(), RauchReadMPP(), rd_block(), read_data(), read_Helike_cross_sections(), read_Hummer_Storey(), read_level2_lines(), read_mewe_gbar(), diatomics::Read_Mol_Diss_cross_sections(), read_SH98_He1_cross_sections(), read_species_file(), read_UTA_lines(), ReadBadnellAIData(), save_opacity(), saveFITSfile(), SaveGrid(), StarburstInitialize(), t_ADfA::t_ADfA(), vary_input(), and wr_block().

Here is the call graph for this function:

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

set_NaN - set variable or array to SNaN

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()

References cpu, t_cpu_i::Float_SNaN_Value, and t_cpu::i().

Referenced by Amsterdam_Method(), ConvInitSolution(), dqc25c_(), dqc25f_(), invalidate_array(), iter_track::p_clear1(), t_gaunt::p_gauntff_vec(), ParseBlackbody(), ParseCrashDo(), qc25c_(), qc25f_(), and t_hmi::zero().

Here is the call graph for this function:

void set_NaN ( sys_float  x[],
long  n 
)

References cpu, t_cpu_i::Float_SNaN_Value, and t_cpu::i().

Here is the call graph for this function:

void set_NaN ( double &  x)

References cpu, t_cpu_i::Double_SNaN_Value, and t_cpu::i().

Here is the call graph for this function:

void set_NaN ( double  x[],
long  n 
)

References cpu, t_cpu_i::Double_SNaN_Value, and t_cpu::i().

Here is the call graph for this function:

Variable Documentation

const double BIGDOUBLE = DBL_MAX/100.
const realnum BIGFLOAT = numeric_limits<realnum>::max()/realnum(100.f)

all vendors supply predefined preprocessor symbols to help identify their hardware/operating system/compiler, the following symbols will be used to bracket hardware/OS/compiler specific code:

Sun Sparc: sun DEC Alpha: __alpha SGI Iris: __sgi HP Unix: __hpux Cray: __cray IA32: __i386 AMD64/EM64T: __amd64 UNIX: __unix (includes Linux) Linux: __linux MS Vis C: _MSC_VER Intel compiler: ICC, __INTEL_COMPILER g++/icc/pathCC: __GNUC (also set by icc and pathCC!) g++: GNUC_EXCL (excludes icc, pathCC)

NOTE: the user should NOT define these symbols at compile time.the Intel EM64T compiler does not set the amd64 flag... on some UNIX systems only the preprocessor symbol "unix" is predefined (e.g. DEC alpha), on others only "__unix" (e.g. Cray), and on yet others both... This ensures "__unix" is always defined on all UNIX systems.failsafe for obsolete or buggy systems to assure that the POSIX symbol __linux is defined on SGI IA64 systems, icc calls itself ecc... this is needed to discriminate between g++ and icc/pathCC/openCC/clang++ set something that is too small to max of quantity and SMALLFLOAT, but then compare with SMALLFLOAT

Referenced by ContSetIntensity(), ConvFail(), database_prep(), DynaNewStep(), DynaStartZone(), exp10f(), ffun(), t_LineSave::findline(), diatomics::H2_DR(), diatomics::init(), iter_end_check(), IterStart(), mole_get_equilibrium_condition(), mole_partition_function(), mole_solve(), ParseBlackbody(), ParseConstant(), ParseElement(), PrintSpectrum(), prt_constants(), SumDensities(), and t_dynamics::zero().

const ios_base::openmode mode_a = ios_base::out | ios_base::app

Referenced by fix_grid_file().

const ios_base::openmode UNUSED mode_ab = mode_a | ios_base::binary
const ios_base::openmode mode_ap = ios_base::in | ios_base::out | ios_base::app
const ios_base::openmode UNUSED mode_apb = mode_ap | ios_base::binary
const ios_base::openmode UNUSED mode_rb = mode_r | ios_base::binary
const ios_base::openmode mode_rp = ios_base::in | ios_base::out
const ios_base::openmode UNUSED mode_rpb = mode_rp | ios_base::binary
const ios_base::openmode mode_w = ios_base::out | ios_base::trunc

Referenced by vary_input().

const ios_base::openmode UNUSED mode_wb = mode_w | ios_base::binary
const ios_base::openmode mode_wp = ios_base::in | ios_base::out | ios_base::trunc
const ios_base::openmode UNUSED mode_wpb = mode_wp | ios_base::binary
const realnum SMALLFLOAT = numeric_limits<realnum>::min()*realnum(100.f)

FLT_MIN is 1.175494351e-38 on wintel, so SMALLFLOAT is 1.175e-36

Referenced by AbundancesPrt(), AbundancesSet(), AgeCheck(), avg_shield(), t_timesc::calc_therm_timesc(), cdB21cm(), cdTemp(), collision_strength_VF01(), ContCreatePointers(), ContRate(), ContSetIntensity(), ConvBase(), ConvEdenIoniz(), ConvInitSolution(), ConvPresTempEdenIoniz(), CoolSave(), CS_l_mixing_PS64(), CS_l_mixing_PS64_expI(), database_prep(), dBase_solve(), DynaNewStep(), DynaStartZone(), diatomics::H2_LevelPops(), diatomics::H2_PunchDo(), diatomics::H2_RadPress(), diatomics::H2_Solomon_rate(), hydro_transprob(), HyperfineTspin(), IncidentContinuumHere(), diatomics::init(), ion_photo(), ion_trim(), ion_trim2(), ion_trim_validate(), IonHydro(), iso_create(), iso_departure_coefficients(), iso_ionize_recombine(), iso_level(), iso_renorm(), iso_satellite_update(), iso_set_ion_rates(), iter_end_check(), IterEnd(), IterRestart(), IterStart(), lgElemsConserved(), lgStatesConserved(), lines(), t_mean::MeanInc(), t_mean::MeanIon(), t_mean::MeanMoleculeTemp(), molcol(), mole_effects(), mole_h_fixup(), mole_h_rate_diagnostics(), mole_h_reactions(), OccupationNumberLine(), OpacityAddTotal(), Atom_LevelN::operator()(), optimize_func(), TransitionProxy::outline(), ParseConstant(), ParseCosmicRays(), ParseMonitorResults(), ParseSet(), ParseStop(), PressureRadiationLine(), PresTotCurrent(), PrintRatio(), prt_constants(), prt_smooth_predictions(), PrtComment(), PrtFinal(), PrtHeader(), PrtLinePres(), radius_first(), radius_increment(), radius_next(), RT_continuum(), RT_diffuse(), RT_line_all_escape(), RT_line_fine_opacity(), RT_line_one_escape(), RT_line_one_fine(), RT_OTS(), RT_recom_effic(), RT_tau_init(), SaveDo(), SaveHeat(), SDIV(), SecIoniz(), GroupMap::setup(), setXtraRatesFe2(), stepDensity(), pseudo_cont::sumBand(), band_emission::sumBand(), t_dense::t_dense(), TexcLine(), and t_radius::zero().

const int STDLEN = 32

Referenced by t_cpu_i::t_cpu_i().