Utility functions for file and text processing.
More...
#include <complex>
#include <cstddef>
#include <cstdint>
#include <fstream>
#include <random>
#include <string>
#include <vector>
#include "armadillo"
#include "symbols.h"
Go to the source code of this file.
|
void | SetCpuLayoutOnNumaNodes (bool verbose=false, const std::vector< size_t > &cores_to_exclude=std::vector< size_t >(1, 0)) |
|
size_t | GetPhysicalCoreId (size_t core_id) |
|
int | PinToCore (size_t core_id) |
|
void | PinToCoreWithOffset (ThreadType thread, size_t base_core_offset, size_t thread_id, bool allow_reuse=false, bool verbose=false) |
|
void | PrintCoreAssignmentSummary () |
|
template<uint64_t PowerOfTwoNumber, typename T > |
static constexpr T | Roundup (T x) |
|
static void | RtAssert (bool condition, const char *throw_str) |
|
static void | RtAssert (bool condition) |
|
static void | RtAssert (bool condition, const std::string &throw_str) |
| Check a condition at runtime. If the condition is false, throw exception. More...
|
|
static void | RtAssert (bool condition, const std::string &throw_str, char *s) |
| Check a condition at runtime. If the condition is false, throw exception. More...
|
|
size_t | Gcd (size_t a, size_t b) |
| Returns the greatest common divisor of a and b . More...
|
|
size_t | Lcm (size_t a, size_t b) |
| Returns the least common multiple of a and b . More...
|
|
Utility functions for file and text processing.
- Author
- Rahman Doost-Mohamamdy: doost.nosp@m.@ric.nosp@m.e.edu
◆ likely
#define likely |
( |
|
x | ) |
__builtin_expect(!!(x), 1) |
◆ unlikely
#define unlikely |
( |
|
x | ) |
__builtin_expect(!!(x), 0) |
◆ UNUSED
◆ unused
#define unused |
( |
|
x | ) |
((void)(x)) |
◆ Gcd()
size_t Gcd |
( |
size_t |
a, |
|
|
size_t |
b |
|
) |
| |
|
inline |
Returns the greatest common divisor of a
and b
.
◆ GetPhysicalCoreId()
size_t GetPhysicalCoreId |
( |
size_t |
core_id | ) |
|
◆ Lcm()
size_t Lcm |
( |
size_t |
a, |
|
|
size_t |
b |
|
) |
| |
|
inline |
Returns the least common multiple of a
and b
.
◆ PinToCore()
int PinToCore |
( |
size_t |
core_id | ) |
|
◆ PinToCoreWithOffset()
void PinToCoreWithOffset |
( |
ThreadType |
thread, |
|
|
size_t |
base_core_offset, |
|
|
size_t |
thread_id, |
|
|
bool |
allow_reuse = false , |
|
|
bool |
verbose = false |
|
) |
| |
◆ PrintCoreAssignmentSummary()
void PrintCoreAssignmentSummary |
( |
| ) |
|
◆ Roundup()
template<uint64_t PowerOfTwoNumber, typename T >
static constexpr T Roundup |
( |
T |
x | ) |
|
|
staticconstexpr |
roundup<N>(x) returns x rounded up to the next multiple of N. N must be a power of two.
◆ RtAssert() [1/4]
static void RtAssert |
( |
bool |
condition | ) |
|
|
inlinestatic |
Check a condition at runtime. If the condition is false, throw exception. This is faster than rt_assert(cond, std::string) as it avoids string construction.
◆ RtAssert() [2/4]
static void RtAssert |
( |
bool |
condition, |
|
|
const char * |
throw_str |
|
) |
| |
|
inlinestatic |
Check a condition at runtime. If the condition is false, throw exception. This is faster than rt_assert(cond, std::string) as it avoids string construction.
◆ RtAssert() [3/4]
static void RtAssert |
( |
bool |
condition, |
|
|
const std::string & |
throw_str |
|
) |
| |
|
inlinestatic |
Check a condition at runtime. If the condition is false, throw exception.
◆ RtAssert() [4/4]
static void RtAssert |
( |
bool |
condition, |
|
|
const std::string & |
throw_str, |
|
|
char * |
s |
|
) |
| |
|
inlinestatic |
Check a condition at runtime. If the condition is false, throw exception.
◆ SetCpuLayoutOnNumaNodes()
void SetCpuLayoutOnNumaNodes |
( |
bool |
verbose = false , |
|
|
const std::vector< size_t > & |
cores_to_exclude = std::vector< size_t >(1, 0) |
|
) |
| |