Skip to content
Snippets Groups Projects
Commit 9963f81e authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'skynet' into 'main'

Skynet

See merge request i4/manycore/mazstab!40
parents 0d4c25c8 4d49c03e
No related branches found
No related tags found
No related merge requests found
Pipeline #95225 failed
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
/custom-meson-include/ /custom-meson-include/
/out/ /out/
/build /build
/clang-tidy-report
image: "flowdalic/debian-testing-dev:1.29" image: "flowdalic/debian-testing-dev:1.30"
cache: cache:
paths: paths:
......
...@@ -49,6 +49,14 @@ This is the [OpenMP implementation of LLVM's Clang](https://openmp.llvm.org/). ...@@ -49,6 +49,14 @@ This is the [OpenMP implementation of LLVM's Clang](https://openmp.llvm.org/).
Inspired by prior work of Oliver et al. [oliver2006uts]. Inspired by prior work of Oliver et al. [oliver2006uts].
For more information, look at the [benchmark's README](./benchmarks/uts/README.md). For more information, look at the [benchmark's README](./benchmarks/uts/README.md).
### skynet
Inspired by Alexander Temerev's [skynet](https://github.com/atemerev/skynet) micro benchmark.
Skynet creates a large number of fibers by spawning 10 fibers which itself spawn 10 more fibers until the desired number of fibers are created *on the final level*.
Then, each fiber returns its ordinal number, starting with 1, which are then summed on the previous level, which sends its sum back upstream, until the root is reached.
Therefore, calculating the "kleiner Gauß", that is, the sum of the first n subsequent natural numbers.
# Publications # Publications
[schmaus2021nowa] [schmaus2021nowa]
......
0.10.9 0.10.10
#include <cassert> #include <cassert>
#include <cstdio> #include <iostream>
#include "mazstab-backend.hpp" #include "mazstab-backend.hpp"
#include "mazstab.hpp" #include "mazstab.hpp"
...@@ -42,7 +42,7 @@ auto mzs_benchmark_verify() -> mzs::VerificationResult { ...@@ -42,7 +42,7 @@ auto mzs_benchmark_verify() -> mzs::VerificationResult {
int expect = fib_fast(n); int expect = fib_fast(n);
if (expect != m) { if (expect != m) {
fprintf(stderr, "fib(%d)=%d (expected %d)\n", n, m, expect); std::cerr << "FAILED fib(" << n << ")=" << m << " but expected" << expect << std::endl;
return mzs::VerificationResult::failed; return mzs::VerificationResult::failed;
} }
......
...@@ -4,4 +4,5 @@ subdir('integrate') ...@@ -4,4 +4,5 @@ subdir('integrate')
subdir('lu') subdir('lu')
subdir('matmul') subdir('matmul')
subdir('nqueens') subdir('nqueens')
subdir('skynet')
subdir('uts') subdir('uts')
benchmarks += {
'name': 'skynet',
'source_files': ['skynet.cc'],
'is_smoke_test': true,
}
#include <array>
#include <cassert>
#include <iostream>
#include <numeric>
#include "mazstab-backend.hpp"
#include "mazstab.hpp"
namespace mzs = mazstab;
static const uint64_t DIVISOR = 10;
static uint64_t size;
static uint64_t result;
static auto kleiner_gauß(uint64_t num) -> uint64_t {
uint64_t num_squared = num * num;
return (num_squared + num) / 2;
}
mzs_sf static void recurse_sum(uint64_t* res, uint64_t num, uint64_t size) {
if (size == 1) {
*res = num;
return;
}
mzs_sf_state sf_state;
mzs_init(&sf_state);
std::array<uint64_t, DIVISOR> myRes;
uint64_t newSize = size / DIVISOR;
for (uint64_t i = 0; i < DIVISOR; ++i) {
uint64_t newNum = num + (i * newSize);
uint64_t* newRes = &myRes[i];
mzs_spawn(&sf_state, recurse_sum, (newRes, newNum, newSize));
}
mzs_sync(&sf_state);
*res = std::reduce(myRes.begin(), myRes.end());
}
auto mzs_benchmark_verify() -> mzs::VerificationResult {
uint64_t expected = kleiner_gauß(size);
if (expected != result) {
std::cerr << "FAILED recurse_sum(" << size << ")=" << result << " but expected " << expected << std::endl;
return mzs::VerificationResult::failed;
}
return mzs::VerificationResult::successful;
}
void mzs_benchmark_run() {
assert(size > 0);
recurse_sum(&result, 1, size);
}
void mzs_benchmark_init(const mzs::ProblemSize &problem_size) {
switch (problem_size) {
case mzs::ProblemSize::xs:
size = 100;
break;
case mzs::ProblemSize::m:
case mzs::ProblemSize::nowa:
size = 1000000;
break;
}
assert(size % DIVISOR == 0);
}
[wrap-git] [wrap-git]
url = https://gitlab.cs.fau.de/i4/manycore/emper.git url = https://gitlab.cs.fau.de/i4/manycore/emper.git
revision = ee8a0192bf49d8e4f4dc2ed5651d21cf434f2d82 revision = 105e4078814c1e1abffc6b3528a91a5780f461da
depth = 1 depth = 1
...@@ -42,4 +42,5 @@ JOBS=$(nproc) ...@@ -42,4 +42,5 @@ JOBS=$(nproc)
${RUN_CLANG_TIDY} \ ${RUN_CLANG_TIDY} \
-p "${ROOTDIR}/compile_commands_wo_subprojects/" \ -p "${ROOTDIR}/compile_commands_wo_subprojects/" \
-j "${JOBS}" -j "${JOBS}" |\
tee "${ROOTDIR}/clang-tidy-report"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment