main.cpp 1.1 KB
Newer Older
1 2 3 4 5 6 7 8
#include <pls/pls.h>
#include <pls/internal/helpers/profiler.h>
#include <pls/internal/helpers/mini_benchmark.h>

#include <iostream>
#include <vector>
#include <functional>

9
static constexpr int INPUT_SIZE = 10e7;
10 11 12 13 14 15 16 17 18 19 20

int main() {
  PROFILE_ENABLE
  std::vector<double> vec(INPUT_SIZE, 1);
  std::vector<double> out(INPUT_SIZE);

  for (int i = 0; i < INPUT_SIZE; i++) {
    vec[i] = i;
  }

  pls::internal::helpers::run_mini_benchmark([&] {
21
    pls::scan(vec.begin(), vec.end(), out.begin(), std::plus<double>(), 0.0);
22 23 24 25
  }, 8, 1000);

  PROFILE_SAVE("test_profile.prof")
}
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

//int main() {
//  PROFILE_ENABLE
//  pls::malloc_scheduler_memory my_scheduler_memory{8, 2u << 18};
//  pls::scheduler scheduler{&my_scheduler_memory, 8};
//
//  std::vector<double> vec(INPUT_SIZE, 1);
//  std::vector<double> out(INPUT_SIZE);
//
//  for (int i = 0; i < INPUT_SIZE; i++) {
//    vec[i] = 1;
//  }
//
//  scheduler.perform_work([&] {
//    PROFILE_MAIN_THREAD
//    for (int i = 0; i < 100; i++) {
//      pls::scan(vec.begin(), vec.end(), out.begin(), std::plus<double>(), 0.0);
//    }
//  });
//
//  PROFILE_SAVE("test_profile.prof")
//}