Category : benchmarking

#include <pthread.h> struct BenchmarkData { long long iteration_count; int core_id; }; pthread_barrier_t barrier; static inline void* incrementLoop2ForPthread(void* arg) { BenchmarkData* arg_ = static_cast<BenchmarkData*>(arg); int core_id = arg_->core_id; long long iteration_count = arg_->iteration_count; stick_this_thread_to_core(core_id); logger->info("Thread bound to core {} will now wait for barrier.", core_id); pthread_barrier_wait(&barrier); logger->info("Thread bound to core {} is done waiting for barrier.", ..

Read more

Consider the following two snippets: // Option (1). boost::mp11::mp_with_index<N>(i, [&](const auto i){ function<i>(/* args… */); }); and // Option (2). inline static const std::array<void(/* Args… */), N> functionArray{function<0>, …, function<N-1>}; functionArray[i](/* args… */); where N is a compile time size approximately in the range [0, 20], i is a runtime index between 0 and N-1, ..

Read more

I have a long vector Eigen::VectorXd X;, and I would like to update it segment-by-segment using one of the following functions: void Foo1(Eigen::Ref<Eigen::VectorXd> x) { // Update x. } Eigen::VectorXd Foo2() { Eigen::VectorXd x; // Update x. return x; } int main() { const int LARGE_NUMBER = …; // Approximately in the range ~[600, 1000]. ..

Read more

I have a very simple Google Benchmark program that benchmarks a function taking two integer arguments, I’m trying to use the benchmark to see how exactly does the time the function takes increase as the second argument’s value increases from 1 to 100, so with the first argument staying with the same value of 999999 ..

Read more