12 #define UNUSED __attribute__ ((unused))
20 # define INT8_MIN (-INT8_MAX - 1)
23 #if SCHAR_MAX == INT8_MAX
24 typedef signed char int8;
26 # error "failed to define int8, please report this to gary@uky.edu"
30 # define UINT8_MAX 255
33 #if UCHAR_MAX == UINT8_MAX
34 typedef unsigned char uint8;
36 # error "failed to define uint8, please report this to gary@uky.edu"
40 # define INT16_MAX 32767
43 # define INT16_MIN (-INT16_MAX - 1)
46 #if SHRT_MAX == INT16_MAX
47 typedef short int int16;
48 #elif INT_MAX == INT16_MAX
51 # error "failed to define int16, please report this to gary@uky.edu"
55 # define UINT16_MAX 65535
58 #if USHRT_MAX == UINT16_MAX
59 typedef unsigned short int uint16;
60 #elif UINT_MAX == UINT16_MAX
61 typedef unsigned int uint16;
63 # error "failed to define uint16, please report this to gary@uky.edu"
67 # define INT32_MAX 2147483647L
70 # define INT32_MIN (-INT32_MAX - 1)
73 #if INT_MAX == INT32_MAX
75 #elif LONG_MAX == INT32_MAX
76 typedef long int int32;
78 # error "failed to define int32, please report this to gary@uky.edu"
82 # define UINT32_MAX 4294967295UL
85 #if UINT_MAX == UINT32_MAX
86 typedef unsigned int uint32;
87 #elif ULONG_MAX == UINT32_MAX
88 typedef unsigned long int uint32;
90 # error "failed to define uint32, please report this to gary@uky.edu"
94 # define INT64_MAX 9223372036854775807LL
97 # define INT64_MIN (-INT64_MAX - 1)
100 #if LONG_MAX == INT64_MAX
101 typedef long int int64;
102 #elif LLONG_MAX == INT64_MAX
103 typedef long long int int64;
105 # error "failed to define int64, please report this to gary@uky.edu"
109 # define UINT64_MAX 18446744073709551615ULL
112 #if ULONG_MAX == UINT64_MAX
113 typedef unsigned long int uint64;
114 #elif ULLONG_MAX == UINT64_MAX
115 typedef unsigned long long int uint64;
117 # error "failed to define uint64, please report this to gary@uky.edu"
132 inline int posix_memalign(
void **p,
size_t a,
size_t s)
134 *p = _aligned_malloc(s, a);
135 return ( *p ==
NULL ) ? errno : 0;
183 #if defined(_ARCH_PPC) || defined(__POWERPC__) || defined(__powerpc__) || defined(PPC)
194 #if defined(unix) || defined(__unix__)
200 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
205 #if defined(linux) || defined(__linux)
220 #if defined(__GNUC__) && ! ( defined(__ICC) || defined(__PATHSCALE__) || defined(__OPENCC__) || defined(__clang__) )
221 #define __GNUC_EXCL__ 1
224 #undef SIGNAL_HANDLER
225 #if defined(__linux) || defined(__APPLE__) || (defined(__CYGWIN__) && !defined(__CYGWIN32__))
226 #define SIGNAL_HANDLER 1
262 const ios_base::openmode
mode_r = ios_base::in;
263 const ios_base::openmode
mode_w = ios_base::out | ios_base::trunc;
264 const ios_base::openmode
mode_a = ios_base::out | ios_base::app;
265 const ios_base::openmode
mode_rp = ios_base::in | ios_base::out;
266 const ios_base::openmode
mode_wp = ios_base::in | ios_base::out | ios_base::trunc;
267 const ios_base::openmode
mode_ap = ios_base::in | ios_base::out | ios_base::app;
280 string* rpath=
nullptr );
282 void check_data(
const string& fpath,
const string& fname );
302 # ifdef SIGNAL_HANDLER
303 struct sigaction p_action;
304 struct sigaction p_default;
361 # ifdef SIGNAL_HANDLER
362 const struct sigaction* action()
const {
return &p_action; }
363 const struct sigaction* deflt()
const {
return &p_default; }
390 size_t i = strlen(path);
400 friend void open_data( fstream& stream,
const string& fname, ios_base::openmode mode,
access_scheme scheme,
403 friend void check_data(
const string& fpath,
const string& fname );
407 friend void set_NaN(
double &x);
408 friend void set_NaN(
double x[],
long n);
457 #define NORETURN __declspec(noreturn)
458 #elif defined(__GNUC__) || ( defined(__INTEL_COMPILER) && defined(__linux__) || defined(__SUNPRO_CC) )
459 #define NORETURN __attribute__ ((noreturn))
464 #define FALLTHROUGH (void)0
468 #define FALLTHROUGH __attribute__ ((fallthrough))
473 #define ALIGNED(X) __declspec(align(X))
475 #define ALIGNED(X) __attribute__ ((aligned(X)))
479 #define LIKELY(x) (x)
483 #define LIKELY(x) __builtin_expect((x),1)
486 #define RESTRICT __restrict
490 #define UNLIKELY(x) (x)
494 #define UNLIKELY(x) __builtin_expect((x),0)
502 #define DO_EXPAND(VAL) VAL ## 1
503 #define EXPAND(VAL) DO_EXPAND(VAL)
508 #if defined __INTEL_COMPILER
509 # define __COMP "icc"
510 # define __COMP_VER __INTEL_COMPILER
514 #elif defined __PATHSCALE__
515 # define __COMP "pathCC"
516 # define __COMP_VER __PATHCC__ * 100 + __PATHCC_MINOR__ * 10 + __PATHCC_PATCHLEVEL__
520 #elif defined __OPENCC__
521 # define __COMP "Open64"
522 # if EXPAND(__OPENCC_PATCHLEVEL__) == 1
523 # define __COMP_VER __OPENCC__ * 100 + __OPENCC_MINOR__ * 10
525 # define __COMP_VER __OPENCC__ * 100 + __OPENCC_MINOR__ * 10 + __OPENCC_PATCHLEVEL__
530 #elif defined __clang__
531 # define __COMP "clang++"
532 # define __COMP_VER __clang_major__ * 100 + __clang_minor__ * 10 + __clang_patchlevel__
535 #elif defined __GNUC__
536 # define __COMP "g++"
537 # if defined(__GNUC_PATCHLEVEL__)
538 # define __COMP_VER (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
540 # define __COMP_VER (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
544 # define __COMP "Portland Group"
545 # if defined(__PGIC__)
546 # define __COMP_VER (__PGIC__ * 100 + __PGIC_MINOR__ * 10 + __PGIC_PATCHLEVEL__)
548 # define __COMP_VER 0
553 #elif defined(__sgi) && defined(_COMPILER_VERSION)
554 # define __COMP "MIPSpro"
555 # define __COMP_VER _COMPILER_VERSION
558 #elif defined __HP_aCC
559 # define __COMP "HP aCC"
560 # define __COMP_VER __HP_aCC
564 # define __COMP "DEC CC"
565 # define __COMP_VER __DECC_VER
568 #elif defined _MSC_VER
570 # define __COMP_VER _MSC_VER
573 #elif defined __SUNPRO_CC
574 # define __COMP "Solaris Studio"
575 # define __COMP_VER __SUNPRO_CC
579 # define __COMP "unknown"
580 # define __COMP_VER 0
585 #if defined __linux__
587 # define __OS "Linux (IA32)"
588 # elif defined __amd64
589 # define __OS "Linux (AMD64)"
590 # elif defined __ia64
591 # define __OS "Linux (IA64)"
592 # elif defined __ppc__
593 # define __OS "Linux (PowerPC)"
595 # define __OS "Linux (other)"
599 #elif defined macintosh
600 # define __OS "Mac OS 9"
603 #elif defined __MACOSX__
604 # define __OS "Mac OS X"
607 #elif defined __APPLE__
608 # define __OS "Apple MacOS"
612 # define __OS "HP-UX"
616 # define __OS "Solaris"
624 # define __OS "Ultrix"
627 #elif defined __FreeBSD__
628 # define __OS "FreeBSD"
630 #elif defined __NetBSD__
631 # define __OS "NetBSD"
633 #elif defined __OpenBSD__
634 # define __OS "OpenBSD"
639 # define __OS "Win64"
643 # define __OS "Win32"
646 #elif defined __CYGWIN__
647 # define __OS "Cygwin"
655 # define __OS "unknown"
661 # if defined(__GNUC_EXCL__) && ((__GNUC__ < 4 ) || \
662 (__GNUC__ == 4 && __GNUC_MINOR__ < 8) || \
663 (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 0))
664 # error "This version of g++ cannot compile Cloudy! Version 4.8.1 or later is required. See http://wiki.nublado.org/wiki/CompileCode for more details."
667 # if defined(__clang_major__) && ((__clang_major__ < 3 ) || \
668 (__clang_major__ == 3 && __clang_minor__ < 3))
669 # error "This version of clang++ cannot compile Cloudy! Version 3.3 or later is required. See http://wiki.nublado.org/wiki/CompileCode for more details."
672 # if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1500
673 # error "This version of icc cannot compile Cloudy! Version 15.0 or later is required. See http://wiki.nublado.org/wiki/CompileCode for more details."
676 # if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140
677 # error "This version of CC cannot compile Cloudy! Version 12.5 or later is required. See http://wiki.nublado.org/wiki/CompileCode for more details."
long nRANK() const
Definition: cpu.h:376
long n_rank
Definition: cpu.h:319
const ios_base::openmode mode_wp
Definition: cpu.h:266
const string & ExecName() const
Definition: cpu.h:384
int nCSMismatch
Definition: cpu.h:335
void set_used_nCPU(long n)
Definition: cpu.h:370
void set_NaN(sys_float &x)
Definition: cpu.cpp:871
double test_double
Definition: cpu.h:297
const double BIGDOUBLE
Definition: cpu.h:238
friend void set_NaN(sys_float &x)
Definition: cpu.cpp:871
vector< string > chTraceback
Definition: cpu.h:323
MPI_state
Definition: mpi_utilities.h:7
const realnum SMALLFLOAT
Definition: cpu.h:235
map< string, string > checksum_expct
Definition: cpu.h:337
t_cpu_i & i()
Definition: cpu.h:414
FILE * open_data(const string &fname, const string &mode, access_scheme scheme=AS_DEFAULT, string *rpath=nullptr)
Definition: cpu.cpp:722
void disableBacktrace()
Definition: cpu.h:380
bool MyIsnan(const sys_float &x)
Definition: cpu.cpp:925
const double SMALLDOUBLE
Definition: cpu.h:239
MPI_state MPIMode() const
Definition: cpu.h:374
access_scheme
Definition: cpu.h:257
friend FILE * open_data(const string &fname, const string &mode, access_scheme scheme, string *rpath)
Definition: cpu.cpp:722
const ios_base::openmode UNUSED mode_wb
Definition: cpu.h:270
const int STDLEN
Definition: cpu.h:241
void GenerateBacktrace(void *ptr)
Definition: cpu.cpp:1178
static t_cpu_i * m_i
Definition: cpu.h:412
long used_nCPU() const
Definition: cpu.h:371
static void signal_handler(int sig, siginfo_t *, void *ptr)
Definition: cpu.cpp:535
void * MPI_File
Definition: mpi_utilities.h:74
const ios_base::openmode UNUSED mode_rpb
Definition: cpu.h:272
bool big_endian() const
Definition: cpu.h:355
void enableBacktrace()
Definition: cpu.h:381
void set_nRANK(long n)
Definition: cpu.h:375
double min_double() const
Definition: cpu.h:359
char HostName[STDLEN]
Definition: cpu.h:325
bool p_suppressBacktrace
Definition: cpu.h:343
exit_type
Definition: cddefines.h:151
void set_MPIMode(MPI_state mode)
Definition: cpu.h:373
static const bool value
Definition: cpu.h:447
bool little_endian() const
Definition: cpu.h:356
~t_cpu()
Definition: cpu.cpp:62
void PrintBacktrace(const string &s, bool lgPrintSeed=true)
Definition: cpu.cpp:1185
void check_data(const string &fpath, const string &fname)
Definition: cpu.cpp:838
long n_avail_CPU
Definition: cpu.h:308
const ios_base::openmode mode_a
Definition: cpu.h:264
const ios_base::openmode mode_r
Definition: cpu.h:262
string p_ExecName
Definition: cpu.h:321
void p_assertValidPath()
Definition: cpu.cpp:305
long n_use_CPU
Definition: cpu.h:310
int nFileDone
Definition: cpu.h:333
string p_chCloudyRoot
Definition: cpu.h:329
float realnum
Definition: cddefines.h:127
float sys_float
Definition: cddefines.h:130
t_cpu_i()
Definition: cpu.cpp:71
bool foundCSMismatch() const
Definition: cpu.h:395
const realnum BIGFLOAT
Definition: cpu.h:233
void printDataPath() const
Definition: cpu.cpp:547
bool lgMaster() const
Definition: cpu.h:377
int32 Float_SNaN_Value
Definition: cpu.h:299
bool lgPathInitialized
Definition: cpu.h:339
long max(int a, long b)
Definition: cddefines.h:821
bool firstOpen() const
Definition: cpu.h:394
bool lgMPI_talk() const
Definition: cpu.h:378
char p_chDirSeparator
Definition: cpu.h:331
long min(int a, long b)
Definition: cddefines.h:766
const ios_base::openmode UNUSED mode_wpb
Definition: cpu.h:273
#define NULL
Definition: cddefines.h:115
vector< string > p_exit_status
Definition: cpu.h:348
const ios_base::openmode mode_ap
Definition: cpu.h:267
void set_ExecName(const string &name)
Definition: cpu.h:379
const ios_base::openmode UNUSED mode_rb
Definition: cpu.h:269
const ios_base::openmode mode_w
Definition: cpu.h:263
MPI_state p_MPIMode
Definition: cpu.h:317
void posix_memalign_free(void *p)
Definition: cpu.h:143
sys_float min_float() const
Definition: cpu.h:358
int64 Double_SNaN_Value
Definition: cpu.h:300
void getPathList(const string &fname, vector< string > &PathList, access_scheme scheme, bool lgRead) const
Definition: cpu.cpp:558
void set_signal_handlers()
Definition: cpu.cpp:500
bool lgMPI() const
Definition: cpu.h:372
Definition: mpi_utilities.h:7
const ios_base::openmode UNUSED mode_ab
Definition: cpu.h:271
friend void check_data(const string &fpath, const string &fname)
Definition: cpu.cpp:838
void set_nCPU(long n)
Definition: cpu.h:368
char c[4]
Definition: cpu.h:292
const ios_base::openmode UNUSED mode_apb
Definition: cpu.h:274
void appendDirSeparator(char *path) const
Definition: cpu.h:388
void getchecksums(const string &fname)
Definition: cpu.cpp:588
long nCPU() const
Definition: cpu.h:369
void initPath()
Definition: cpu.cpp:239
int32 i
Definition: cpu.h:293
void enable_traps() const
Definition: cpu.cpp:321
sys_float test_float
Definition: cpu.h:296
static t_cpu cpu
Definition: cpu.h:422
bool p_lgMPI
Definition: cpu.h:312
vector< string > chSearchPath
Definition: cpu.h:327
const ios_base::openmode mode_rp
Definition: cpu.h:265
t_cpu()
Definition: cpu.cpp:55
const char * host_name() const
Definition: cpu.h:385
string chDirSeparator() const
Definition: cpu.h:387
const string & chExitStatus(exit_type s) const
Definition: cpu.h:396
#define UNUSED
Definition: cpu.h:9