#include "pls/internal/scheduling/scheduler.h" #include "pls/internal/scheduling/static_scheduler_memory.h" #include "pls/algorithms/for_each.h" using namespace pls::internal::scheduling; #include "benchmark_runner.h" #include "benchmark_base/matrix.h" using namespace comparison_benchmarks::base; template class pls_matrix : public matrix::matrix { public: pls_matrix() : matrix::matrix() {} void multiply(const matrix::matrix &a, const matrix::matrix &b) override { pls::algorithm::for_each_range(0, SIZE, [&](int i) { this->multiply_column(i, a, b); }); } }; constexpr int MAX_NUM_THREADS = 8; constexpr int MAX_NUM_TASKS = 32; constexpr int MAX_STACK_SIZE = 1024 * 1; static_scheduler_memory global_scheduler_memory; int main(int argc, char **argv) { int num_threads; string directory; benchmark_runner::read_args(argc, argv, num_threads, directory); string test_name = to_string(num_threads) + ".csv"; string full_directory = directory + "/PLS_v3/"; benchmark_runner runner{full_directory, test_name}; pls_matrix a; pls_matrix b; pls_matrix result; scheduler scheduler{global_scheduler_memory, (unsigned) num_threads}; runner.run_iterations(matrix::NUM_ITERATIONS, [&]() { scheduler.perform_work([&]() { result.multiply(a, b); }); }, matrix::WARMUP_ITERATIONS); runner.commit_results(true); }