From c39787ddc7b874553ecd60c641ce9dd0dceb51e2 Mon Sep 17 00:00:00 2001 From: doinachiroiu Date: Mon, 17 Aug 2020 11:21:33 +0000 Subject: [PATCH] Testing pffft - elaborate output --- oss-internship-2020/pffft/README.txt | 6 ++- .../pffft/test_pffft_sandboxed.cc | 41 ++++++++++++++++--- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/oss-internship-2020/pffft/README.txt b/oss-internship-2020/pffft/README.txt index ef51f1a..5688ac9 100644 --- a/oss-internship-2020/pffft/README.txt +++ b/oss-internship-2020/pffft/README.txt @@ -16,4 +16,8 @@ CMake observations: Sandboxed main observations: * containing two testing parts (fft / pffft benchmarks) ! current stage: fft - works :) - pffft - not implemented + pffft - implemented + * pffft benchmark bug: "Sandbox not active" + => loop in pffft_transform for N = 64 (why?); + N = 64, status OK, pffft_transform generates error + N > 64, status not OK diff --git a/oss-internship-2020/pffft/test_pffft_sandboxed.cc b/oss-internship-2020/pffft/test_pffft_sandboxed.cc index d50dff3..5a56a6f 100644 --- a/oss-internship-2020/pffft/test_pffft_sandboxed.cc +++ b/oss-internship-2020/pffft/test_pffft_sandboxed.cc @@ -60,12 +60,6 @@ void show_output(const char* name, int N, int cplx, float flops, float t0, fflush(stdout); } -/* - For debug: - SAPI_VLOG_LEVEL=1 ./pffft_sandboxed --v=100 - --sandbox2_danger_danger_permit_all_and_log my_aux_file -*/ - int main(int argc, char* argv[]) { gflags::ParseCommandLineFlags(&argc, &argv, true); int Nvalues[] = {64, 96, 128, 160, 192, 256, @@ -148,6 +142,41 @@ int main(int argc, char* argv[]) { flops = (max_iter_ * 2) * ((cplx ? 5 : 2.5) * N * log((double)N) / M_LN2); show_output("FFTPack", N, cplx, flops, t0, t1, max_iter_); } + + // PFFFT benchmark + { + sapi::StatusOr s = + api.pffft_new_setup(N, cplx ? PFFFT_COMPLEX : PFFFT_REAL); + + printf("%s\n", s.status().ToString().c_str()); + + if (s.ok()) { + sapi::v::GenericPtr s_reg(s.value()); + + t0 = uclock_sec(); + for (iter = 0; iter < max_iter; ++iter) { + printf("%s\n", + api.pffft_transform(s_reg.PtrBoth(), X_.PtrBoth(), + Z_.PtrBoth(), Y_.PtrBoth(), PFFFT_FORWARD) + .ToString() + .c_str()); + printf("%s\n", + api.pffft_transform(s_reg.PtrBoth(), X_.PtrBoth(), + Z_.PtrBoth(), Y_.PtrBoth(), PFFFT_FORWARD) + .ToString() + .c_str()); + } + + t1 = uclock_sec(); + printf("%s\n", + api.pffft_destroy_setup(s_reg.PtrBoth()).ToString().c_str()); + + flops = + (max_iter * 2) * ((cplx ? 5 : 2.5) * N * log((double)N) / M_LN2); + show_output("PFFFT", N, cplx, flops, t0, t1, max_iter); + } + printf("\n\n"); + } } return 0;