thesis version
This commit is contained in:
57
celero/executor/common.h
Normal file
57
celero/executor/common.h
Normal file
@ -0,0 +1,57 @@
|
||||
#ifndef ALSK_CELERO_EXECUTOR_COMMON_H
|
||||
#define ALSK_CELERO_EXECUTOR_COMMON_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include <celero/Celero.h>
|
||||
|
||||
#include <alsk/alsk.h>
|
||||
|
||||
#include "../bone/common.h"
|
||||
|
||||
namespace bench {
|
||||
|
||||
constexpr auto buildExprFarm() {
|
||||
using namespace alsk::arg;
|
||||
using namespace alsk::edsl;
|
||||
return 20 * eTaskV<1000>;
|
||||
}
|
||||
|
||||
constexpr auto exprFarm = buildExprFarm();
|
||||
|
||||
constexpr auto buildExprFarmSel() {
|
||||
using namespace alsk::arg;
|
||||
using namespace alsk::edsl;
|
||||
return link<void(int, int)>(link<Data(P<0>, P<1>)>(eTask) & link<Data(R<0>)>((50 * link<Data(P<0>)>(eTaskD)) ->* eSelect));
|
||||
}
|
||||
|
||||
constexpr auto exprFarmSel = buildExprFarmSel();
|
||||
|
||||
constexpr auto buildExprTwo() {
|
||||
using namespace alsk::arg;
|
||||
using namespace alsk::edsl;
|
||||
|
||||
constexpr auto farmsel = link<Data(R<0>)>(1000 * link<Data(P<0>)>(eTaskD)) ->* eSelect;
|
||||
constexpr auto serial = link<R<1>(P<0>, P<1>)>(link<Data(P<0>, P<1>)>(eTask) & farmsel);
|
||||
return link<void(int, int)>(2 * serial);
|
||||
}
|
||||
|
||||
constexpr auto exprTwo = buildExprTwo();
|
||||
|
||||
constexpr auto buildExprTwoS() {
|
||||
using namespace alsk::arg;
|
||||
using namespace alsk::edsl;
|
||||
|
||||
constexpr auto farmsel = link<Data(Data const&)>(1000 * link<Data(P<0>)>(eTaskD)) ->* eSelect;
|
||||
constexpr auto itersel = &link<Data(R<0>)>(2 * farmsel) ->* eSelect;
|
||||
constexpr auto serial = link<R<1>(P<0>, P<1>)>(link<Data(P<0>, P<1>)>(eTask) & itersel);
|
||||
constexpr auto loop = &link<void(P<0>, P<1>)>(2 * serial);
|
||||
return link<void(int, int)>(2 * loop);
|
||||
}
|
||||
|
||||
constexpr auto exprTwoS = buildExprTwoS();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
52
celero/executor/farm.cpp
Normal file
52
celero/executor/farm.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include <celero/Celero.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
constexpr unsigned samples = 12, iterations = 10, cores = 4;
|
||||
|
||||
BASELINE(ExecFarm, Sequential, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::Sequential>(bench::exprFarm);
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, FirstLevelEqui, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelEqui>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, FirstLevelGreedy, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelGreedy>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, FirstLevelNoOpti, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelNoOpti>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, DynamicPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::DynamicPool>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, StaticPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPool>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, StaticPoolId, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPoolId>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarm, StaticThread, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticThread>(bench::exprFarm);
|
||||
f.executor.cores = cores;
|
||||
f();
|
||||
}
|
62
celero/executor/farmsel.cpp
Normal file
62
celero/executor/farmsel.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include <celero/Celero.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
constexpr unsigned samples = 12, iterations = 10, cores = 4;
|
||||
constexpr std::size_t vecSize = 100'000;
|
||||
constexpr int minValue = -250, maxValue = +250;
|
||||
|
||||
BASELINE(ExecFarmSel, Sequential, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::Sequential>(bench::exprFarmSel);
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, FirstLevelEqui, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelEqui>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, FirstLevelGreedy, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelGreedy>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, FirstLevelNoOpti, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelNoOpti>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, DynamicPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::DynamicPool>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, StaticPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPool>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, StaticPoolId, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPoolId>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecFarmSel, StaticThread, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticThread>(bench::exprFarmSel);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
3
celero/executor/sequential.cpp
Normal file
3
celero/executor/sequential.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <celero/Celero.h>
|
||||
|
||||
#include "common.h"
|
62
celero/executor/twolevels.cpp
Normal file
62
celero/executor/twolevels.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include <celero/Celero.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
constexpr unsigned samples = 12, iterations = 10, cores = 4;
|
||||
constexpr std::size_t vecSize = 1000;
|
||||
constexpr int minValue = -250, maxValue = +250;
|
||||
|
||||
BASELINE(ExecTwoLevels, Sequential, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::Sequential>(bench::exprTwo);
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, FirstLevelEqui, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelEqui>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, FirstLevelGreedy, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelGreedy>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, FirstLevelNoOpti, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelNoOpti>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, DynamicPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::DynamicPool>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, StaticPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPool>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, StaticPoolId, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPoolId>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevels, StaticThread, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticThread>(bench::exprTwo);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
62
celero/executor/twolevelshard.cpp
Normal file
62
celero/executor/twolevelshard.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include <celero/Celero.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
constexpr unsigned samples = 12, iterations = 10, cores = 4;
|
||||
constexpr std::size_t vecSize = 1'000;
|
||||
constexpr int minValue = -250, maxValue = +250;
|
||||
|
||||
BASELINE(ExecTwoLevelsHard, Sequential, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::Sequential>(bench::exprTwoS);
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, FirstLevelEqui, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelEqui>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, FirstLevelGreedy, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelGreedy>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, FirstLevelNoOpti, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::FirstLevelNoOpti>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, DynamicPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::DynamicPool>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, StaticPool, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPool>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, StaticPoolId, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticPoolId>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
||||
|
||||
BENCHMARK(ExecTwoLevelsHard, StaticThread, samples, iterations) {
|
||||
auto f = alsk::edsl::implement<alsk::exec::StaticThread>(bench::exprTwoS);
|
||||
f.executor.cores = cores;
|
||||
f.skeleton.task.task.task<0>().size = vecSize;
|
||||
f(minValue, maxValue);
|
||||
}
|
Reference in New Issue
Block a user