diff --git a/.gitignore b/.gitignore index 4584f2efeb5bf812922aea045d1994720fa98520..fdf457580b8c2f46878f88e0f94c0f512b37794e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /custom-meson-include/ /out/ /build +/clang-tidy-report diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f929b131d6d98e95bb172712f3029f94cb91beee..3a154d2e96564fa8d520577f3e3cbe22245e53aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "flowdalic/debian-testing-dev:1.29" +image: "flowdalic/debian-testing-dev:1.30" cache: paths: diff --git a/README.md b/README.md index a4a9dad6ab3c3bd382414c2286542d375930d850..ed3a54cfbb56651c0c3cd4c2ad010582f29335cf 100644 --- a/README.md +++ b/README.md @@ -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]. 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 [schmaus2021nowa] diff --git a/benchmark-runner/.mill-version b/benchmark-runner/.mill-version index f314d02022684fab6d1e7f36ca33fe01b8ba0003..ddf1d4ae681d5be63653a1ac935ddc80a4570337 100644 --- a/benchmark-runner/.mill-version +++ b/benchmark-runner/.mill-version @@ -1 +1 @@ -0.10.9 +0.10.10 diff --git a/benchmarks/fib/fib.cc b/benchmarks/fib/fib.cc index 5eb2d713c8c09064c5ab40466a5c79e66652bd59..1fdbd65b3137d67ba14a19297a5fd88dbd480c9f 100644 --- a/benchmarks/fib/fib.cc +++ b/benchmarks/fib/fib.cc @@ -1,5 +1,5 @@ #include <cassert> -#include <cstdio> +#include <iostream> #include "mazstab-backend.hpp" #include "mazstab.hpp" @@ -42,7 +42,7 @@ auto mzs_benchmark_verify() -> mzs::VerificationResult { int expect = fib_fast(n); 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; } diff --git a/benchmarks/meson.build b/benchmarks/meson.build index 45259e79032ae1ddf24413080501f1fe36c0594c..50985777f5b7b3323cc6d4266277772676657be3 100644 --- a/benchmarks/meson.build +++ b/benchmarks/meson.build @@ -4,4 +4,5 @@ subdir('integrate') subdir('lu') subdir('matmul') subdir('nqueens') +subdir('skynet') subdir('uts') diff --git a/benchmarks/skynet/meson.build b/benchmarks/skynet/meson.build new file mode 100644 index 0000000000000000000000000000000000000000..b1f612144dc9f2f4830847c852ba6a33e4ca1783 --- /dev/null +++ b/benchmarks/skynet/meson.build @@ -0,0 +1,5 @@ +benchmarks += { + 'name': 'skynet', + 'source_files': ['skynet.cc'], + 'is_smoke_test': true, + } diff --git a/benchmarks/skynet/skynet.cc b/benchmarks/skynet/skynet.cc new file mode 100644 index 0000000000000000000000000000000000000000..c49342e558d55906a01d85fe659ee92be9759d54 --- /dev/null +++ b/benchmarks/skynet/skynet.cc @@ -0,0 +1,68 @@ +#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); +} diff --git a/subprojects/emper.wrap b/subprojects/emper.wrap index 4ced499ed3234fd5e290e68bafb94fccfa9c622f..d9fb64798b5afe4145471a525be636e9dc4175f9 100644 --- a/subprojects/emper.wrap +++ b/subprojects/emper.wrap @@ -1,4 +1,4 @@ [wrap-git] url = https://gitlab.cs.fau.de/i4/manycore/emper.git -revision = ee8a0192bf49d8e4f4dc2ed5651d21cf434f2d82 +revision = 105e4078814c1e1abffc6b3528a91a5780f461da depth = 1 diff --git a/tools/run-clang-tidy b/tools/run-clang-tidy index ebaeb67379b6fb0b2cb198e365ad227dc084650a..e54b087bb93409a80e3b21ea46d5683c405447fa 100755 --- a/tools/run-clang-tidy +++ b/tools/run-clang-tidy @@ -42,4 +42,5 @@ JOBS=$(nproc) ${RUN_CLANG_TIDY} \ -p "${ROOTDIR}/compile_commands_wo_subprojects/" \ - -j "${JOBS}" + -j "${JOBS}" |\ + tee "${ROOTDIR}/clang-tidy-report"