|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file.
40 #if defined( _WIN32 ) || defined( _WIN64 )
48 # include <sys/ioctl.h>
56 #ifdef GENESIS_PTHREADS
67 #if defined( DEBUG ) && defined( NDEBUG )
68 static_assert(
false,
"Cannot compile with both DEBUG and NDEBUG flags set." );
71 #if ! defined( DEBUG ) && ! defined( NDEBUG )
72 static_assert(
false,
"Cannot compile with neiher DEBUG nor NDEBUG flag set." );
81 random_seed( std::chrono::system_clock::now().time_since_epoch().count() );
91 for (
size_t i = 0; i < command_line_.size(); ++i) {
92 std::string a = command_line_[i];
93 ret += (i==0 ?
"" :
" ") + a;
101 command_line_.clear();
102 for (
int i = 0; i < argc; i++) {
103 command_line_.push_back(argv[i]);
114 #ifdef GENESIS_PTHREADS
115 number = std::thread::hardware_concurrency();
123 number_of_threads_ = number;
125 #if defined( GENESIS_OPENMP )
128 omp_set_num_threads( number );
140 #elif defined( _WIN32 )
146 return (
bool) (
info[3] & (0x1 << 28));
155 unsigned int guess = 1;
157 #if defined( GENESIS_OPENMP )
163 guess = omp_get_max_threads();
171 #if defined( GENESIS_PTHREADS )
174 auto const lcores = std::thread::hardware_concurrency();
181 if((( lcores == guess ) || ( guess == 1 )) && ( lcores > 1 )) {
183 guess = lcores / threads_per_core;
188 assert( guess >= 1 );
199 random_engine_.seed( seed );
209 #if defined( _WIN32 ) || defined( _WIN64 )
210 return _isatty( _fileno( stdin ));
212 return isatty( fileno( stdin ));
218 #if defined( _WIN32 ) || defined( _WIN64 )
219 return _isatty( _fileno( stdout ));
221 return isatty( fileno( stdout ));
227 #if defined( _WIN32 ) || defined( _WIN64 )
228 return _isatty( _fileno( stderr ));
230 return isatty( fileno( stderr ));
236 #if defined( _WIN32 ) || defined( _WIN64 )
238 CONSOLE_SCREEN_BUFFER_INFO csbi;
240 GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
241 cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
242 rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
243 return { cols, rows };
248 ioctl( STDOUT_FILENO, TIOCGWINSZ, &w );
249 return { w.ws_col, w.ws_row };
280 #elif defined( NDEBUG )
289 static const uint16_t e = 0x1000;
290 return 0 == *
reinterpret_cast< uint8_t const*
>( &e );
295 static const uint16_t e = 0x0001;
296 return 0 == *
reinterpret_cast< uint8_t const*
>( &e );
305 #elif defined __linux__
307 #elif defined __APPLE__
309 #elif defined __unix__
318 #if defined(__clang__)
320 #elif defined(__ICC) || defined(__INTEL_COMPILER)
322 #elif defined(__GNUC__) || defined(__GNUG__)
324 #elif defined(__HP_cc) || defined(__HP_aCC)
326 #elif defined(__IBMCPP__)
328 #elif defined(_MSC_VER)
332 #elif defined(__SUNPRO_CC)
341 #if defined(__clang__)
342 return __clang_version__;
343 #elif defined(__ICC) || defined(__INTEL_COMPILER)
344 return __INTEL_COMPILER;
345 #elif defined(__GNUC__) || defined(__GNUG__)
350 #elif defined(__HP_cc) || defined(__HP_aCC)
352 #elif defined(__IBMCPP__)
354 #elif defined(_MSC_VER)
358 #elif defined(__SUNPRO_CC)
376 return std::string( __DATE__
" " __TIME__ );
381 #ifdef GENESIS_PTHREADS
390 #ifdef GENESIS_OPENMP
422 res +=
"Compile Time Options\n";
423 res +=
"=============================================\n\n";
424 res +=
"Platform: " +
platform() +
"\n";
428 res +=
"Endianness: " + std::string(
is_little_endian() ?
"little endian" :
"big endian" ) +
"\n";
429 res +=
"Using Pthreads: " + std::string(
using_pthreads() ?
"true" :
"false" ) +
"\n";
430 res +=
"Using OpenMP: " + std::string(
using_openmp() ?
"true" :
"false" ) +
"\n";
437 res +=
"Run Time Options\n";
438 res +=
"=============================================\n\n";
440 res +=
"Command line: " + ( cli_str.size() > 0 ? cli_str :
"(not available)" ) +
"\n";
std::string info() const
Return a list with compile time and run time options with their values.
static std::string compiler_version()
Return the compiler version that was used to compile genesis.
std::string info_run_time() const
Return a list of run time options.
unsigned long random_seed() const
Returns the random seed that was used to initialize the engine.
static std::string platform()
Return the platform under which genesis was compiled.
unsigned int guess_number_of_threads(bool use_openmp=true) const
Try to guess the number of hardware threads of the current system.
std::vector< std::string > command_line() const
Returns an array of strings containing the program's command line arguments.
static bool is_debug()
Return whether the binary was compiled with build type DEBUG.
std::string info_compile_time() const
Return a list of compile time options.
Some stuff that is totally not imporatant, but nice.
static bool stderr_is_terminal()
Return true iff the standard error stream is a terminal, and false if not, i.e., if it is a file or a...
static std::pair< int, int > terminal_size()
Return the width and height of the terminal that is used to run the program, in number of columns and...
static bool stdout_is_terminal()
Return true iff the standard output stream is a terminal, and false if not, i.e., if it is a file or ...
std::string to_string(GenomeLocus const &locus)
static std::string compile_date_time()
Return the date and time when genesis was compiled.
bool hyperthreads_enabled() const
Try to get whether hyperthreads are enabled in the current system.
static std::string compiler_family()
Return the compiler family (name) that was used to compile genesis.
static bool using_openmp()
Return whether the binary was compiled using OpenMP.
std::string command_line_string() const
Returns a string containing the program's command line arguments.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
static bool stdin_is_terminal()
Return true iff the standard input stream is a terminal, and false if not, i.e., if it is a file or a...
unsigned int number_of_threads() const
Returns the number of threads.
static bool is_release()
Return whether the binary was compiled with build type RELEASE.
std::string genesis_header()
Return the header for genesis.
static bool is_little_endian()
Return whether the system uses little endian memory.
static bool using_pthreads()
Return whether the binary was compiled using Pthreads.
static std::string build_type()
Return the build type that was used to compile the binary, i.e., "debug" or "release".
static bool is_big_endian()
Return whether the system uses big endian memory.
static std::string cpp_version()
Return the CPP version that was used to compile genesis.
static bool using_zlib()
Return whether the binary was compiled using zlib.