Agora
1.2.0
Agora project
|
Go to the documentation of this file.
13 #define UNUSED __attribute__((unused))
14 #define unused(x) ((void)(x))
15 #define likely(x) __builtin_expect(!!(x), 1)
16 #define unlikely(x) __builtin_expect(!!(x), 0)
32 const std::vector<size_t>& cores_to_exclude = std::vector<size_t>(1, 0));
41 size_t thread_id,
bool allow_reuse =
false,
57 static std::vector<size_t>
StrToChannels(
const std::string& channel);
59 const std::vector<std::vector<double>>& in);
61 const std::vector<std::vector<double>>& in);
63 const std::vector<uint32_t>& in,
const std::string& order);
65 const std::vector<std::complex<int16_t>>& in);
67 const std::vector<std::complex<int16_t>>& in,
bool conj,
68 const std::string& order);
70 const std::vector<std::complex<float>>& in,
bool conj,
71 const std::string& order);
72 static std::vector<std::vector<size_t>>
LoadSymbols(
73 std::vector<std::string>
const& frames,
char sym);
76 std::vector<std::complex<int16_t>>&
data,
int samples);
80 static std::vector<std::string>
Split(
const std::string&
s,
char delimiter);
81 static void PrintVector(
const std::vector<std::complex<int16_t>>&
data);
83 size_t buffer_size,
void* buff);
84 static void PrintVec(
const arma::cx_fvec& c,
const std::string& ss);
85 static void SaveVec(
const arma::cx_fvec& c,
const std::string&
filename,
86 const std::string& ,
const bool );
87 static void PrintMat(
const arma::cx_fmat& c,
const std::string& ss);
88 static void SaveMat(
const arma::cx_fmat& c,
const std::string&
filename,
89 const std::string& ss,
const bool append);
94 template <u
int64_t PowerOfTwoNumber,
typename T>
97 "PowerOfTwoNumber must be a power of 2");
98 return ((
x) +
T(PowerOfTwoNumber - 1)) & (~
T(PowerOfTwoNumber - 1));
104 static inline void RtAssert(
bool condition,
const char* throw_str) {
106 throw std::runtime_error(throw_str);
115 throw std::runtime_error(
"Error");
120 static inline void RtAssert(
bool condition,
const std::string& throw_str) {
122 throw std::runtime_error(throw_str);
127 static inline void RtAssert(
bool condition,
const std::string& throw_str,
130 throw std::runtime_error(throw_str + std::string(
s));
135 inline size_t Gcd(
size_t a,
size_t b) {
139 return Gcd(b % a, a);
143 inline size_t Lcm(
size_t a,
size_t b) {
return (a * b) /
Gcd(a, b); }
162 std::ostringstream ret;
171 std::uniform_int_distribution<uint64_t>
dist_;
191 return static_cast<uint32_t
>(
seed_ >> 32);
std::string ToString() const
Definition: utils.h:161
static std::vector< uint32_t > Cfloat32ToUint32(const std::vector< std::complex< float >> &in, bool conj, const std::string &order)
Definition: utils.cc:291
uint64_t seed_
Definition: utils.h:181
static std::vector< size_t > cpu_layout
Definition: utils.cc:44
size_t Lcm(size_t a, size_t b)
Returns the least common multiple of a and b.
Definition: utils.h:143
thread_id_t thread_id()
Definition: concurrentqueue.h:157
void PinToCoreWithOffset(ThreadType thread_type, size_t core_offset, size_t thread_id, bool allow_reuse, bool verbose)
Definition: utils.cc:157
comp
Definition: mm_gui.py:117
static void LoadDevices(std::string filename, std::vector< std::string > &data)
Definition: utils.cc:327
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
static void PrintVec(const arma::cx_fvec &c, const std::string &ss)
Definition: utils.cc:488
int PinToCore(size_t core_id)
Definition: utils.cc:143
bool operator>(const CoreInfo &comp) const
Definition: utils.cc:38
static void WriteBinaryFile(const std::string &name, size_t elem_size, size_t buffer_size, void *buff)
Definition: utils.cc:411
std::random_device rand_dev_
Definition: utils.h:169
GeneratorWrapper< T > value(T &&value)
Definition: catch.hpp:3999
static std::string ThreadTypeStr(ThreadType thread_type)
Definition: symbols.h:229
int PinToCore(size_t core_id)
Definition: utils.cc:143
static constexpr T Roundup(T x)
Definition: utils.h:95
static constexpr bool kEnableThreadPinning
Definition: symbols.h:137
app
Definition: mm_gui.py:118
static void LoadTddConfig(const std::string &filename, std::string &jconfig)
Definition: utils.cc:380
#define TOSTRING(x)
Definition: symbols.h:14
std::uniform_int_distribution< uint64_t > dist_
Definition: utils.h:171
ThreadType
Definition: symbols.h:213
int id_
Definition: utils.h:49
bool operator<(const CoreInfo &comp) const
Definition: utils.cc:34
size_t mapped_core_
Definition: utils.cc:31
static constexpr bool IsPowerOfTwo(T x)
Return true at compile time iff a constant is a power of two.
Definition: symbols.h:35
filename
Definition: parse_all_dl.m:14
static std::vector< std::complex< int16_t > > DoubleToCint16(const std::vector< std::vector< double >> &in)
Definition: utils.cc:219
std::mt19937_64 mt_
Definition: utils.h:170
auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2258
void SetCpuLayoutOnNumaNodes(bool verbose=false, const std::vector< size_t > &cores_to_exclude=std::vector< size_t >(1, 0))
Definition: utils.cc:87
CoreInfo(size_t id, size_t mapped, size_t req, ThreadType type)
Definition: utils.cc:23
#define unlikely(x)
Definition: utils.h:16
FastRand()
Create a FastRand using a seed from SlowRand.
Definition: utils.h:184
uint16_t len
Definition: eth_common.h:62
size_t thread_id_
Definition: utils.cc:29
for i
Definition: generate_data.m:107
static void PrintVector(const std::vector< std::complex< int16_t >> &data)
Definition: utils.cc:405
const size_t start_
Definition: utils.h:147
A range type with an inclusive start bound and an exclusive end bound.
Definition: utils.h:146
static std::vector< uint32_t > Cint16ToUint32(const std::vector< std::complex< int16_t >> &in, bool conj, const std::string &order)
Definition: utils.cc:275
void PinToCoreWithOffset(ThreadType thread, size_t base_core_offset, size_t thread_id, bool allow_reuse=false, bool verbose=false)
Definition: utils.cc:157
auto fprintf(std::FILE *f, const S &fmt, const T &... args) -> int
Definition: printf.h:607
static std::vector< std::complex< float > > Cint16ToCfloat32(const std::vector< std::complex< int16_t >> &in)
Definition: utils.cc:264
end start
Definition: inspect_agora_results.m:95
uint64_t NextU64()
Definition: utils.h:176
static bool cpu_layout_initialized
Definition: utils.cc:45
ThreadType type_
Definition: utils.cc:32
uint32_t NextU32()
Definition: utils.h:189
void PrintCoreAssignmentSummary()
Definition: utils.cc:85
static std::vector< size_t > StrToChannels(const std::string &channel)
Definition: utils.cc:207
size_t Gcd(size_t a, size_t b)
Returns the greatest common divisor of a and b.
Definition: utils.h:135
const size_t end_
Definition: utils.h:148
size_t GetPhysicalCoreId(size_t core_id)
Definition: utils.cc:128
static void PrintBitmask(const struct bitmask *bm)
Definition: utils.cc:79
static void SaveMat(const arma::cx_fmat &c, const std::string &filename, const std::string &ss, const bool append)
Definition: utils.cc:428
size_t GetPhysicalCoreId(size_t core_id)
Definition: utils.cc:128
bool Contains(size_t value) const
Returns true if this range contains the given value.
Definition: utils.h:157
static void PrintCoreList(const std::list< CoreInfo > &clist)
Definition: utils.cc:62
static size_t GetCoreId(size_t core)
Definition: utils.cc:51
static std::vector< std::complex< float > > Uint32tocfloat(const std::vector< uint32_t > &in, const std::string &order)
Definition: utils.cc:243
static std::mutex pin_core_mutex
Definition: utils.cc:46
static std::list< CoreInfo > core_list
Definition: utils.cc:49
verbose
Definition: inspect_agora_results.m:5
size_t requested_core_
Definition: utils.cc:30
SlowRand()
Definition: utils.h:174
fwrite(fileID, pilot_f, 'float')
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
void PrintCoreAssignmentSummary()
Definition: utils.cc:85
static std::vector< std::vector< size_t > > LoadSymbols(std::vector< std::string > const &frames, char sym)
Definition: utils.cc:310
static std::vector< std::string > Split(const std::string &s, char delimiter)
Definition: utils.cc:395
T * obj_ptr_
Definition: utils.h:48
uint16_t id
Definition: eth_common.h:65
Utility functions for file and text processing.
static constexpr float kShrtFltConvFactor
Definition: datatype_conversion.h:18
static std::vector< std::complex< float > > DoubleToCfloat(const std::vector< std::vector< double >> &in)
Definition: utils.cc:232
static void PrintMat(const arma::cx_fmat &c, const std::string &ss)
Definition: utils.cc:452
num_cores
Definition: parse_all_dl.m:3
static void LoadData(const char *filename, std::vector< std::complex< int16_t >> &data, int samples)
Definition: utils.cc:350
static void SaveVec(const arma::cx_fvec &c, const std::string &filename, const std::string &, const bool)
Definition: utils.cc:468
result
Definition: format-inl.h:640
type
Definition: core.h:1131
Range(size_t start, size_t end)
Definition: utils.h:152
void SetCpuLayoutOnNumaNodes(bool verbose, const std::vector< size_t > &cores_to_exclude)
Definition: utils.cc:87