From 1869fe515ff110f5b3b12f72ff0e5d9afd04a314 Mon Sep 17 00:00:00 2001 From: doinachiroiu Date: Thu, 3 Sep 2020 14:59:54 +0000 Subject: [PATCH] Required changes resolved --- oss-internship-2020/pffft/CMakeLists.txt | 3 -- oss-internship-2020/pffft/README.md | 15 ++++---- .../pffft/main_pffft_sandboxed.cc | 36 ++++++++++--------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/oss-internship-2020/pffft/CMakeLists.txt b/oss-internship-2020/pffft/CMakeLists.txt index be687cd..b172009 100644 --- a/oss-internship-2020/pffft/CMakeLists.txt +++ b/oss-internship-2020/pffft/CMakeLists.txt @@ -19,8 +19,6 @@ project(pffft CXX C) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(PFFFT_ROOT_DIR https://bitbucket.org/jpommier/pffft.git) - add_library(pffft STATIC master/pffft.c master/pffft.h @@ -45,7 +43,6 @@ endif() target_link_libraries(pffft PUBLIC ${MATH_LIBS}) - # Adding dependencies set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree") # Then configure: diff --git a/oss-internship-2020/pffft/README.md b/oss-internship-2020/pffft/README.md index 194c6b6..2e023c2 100644 --- a/oss-internship-2020/pffft/README.md +++ b/oss-internship-2020/pffft/README.md @@ -4,16 +4,13 @@ Build System: CMake OS: Linux ### Check out the PFFFT library & CMake set up -`git checkout -b master` - -`git submodule update --init --recursive` - -`mkdir -p build && cd build` - -`cmake .. -G Ninja -DPFFFT_ROOT_DIR=$PWD` - -`ninja` +``` +git submodule update --init --recursive +mkdir -p build && cd build +cmake .. -G Ninja -DPFFFT_ROOT_DIR=$PWD +ninjas +``` ### For testing: `cd build`, then `./pffft_sandboxed` diff --git a/oss-internship-2020/pffft/main_pffft_sandboxed.cc b/oss-internship-2020/pffft/main_pffft_sandboxed.cc index 51e271d..f922275 100644 --- a/oss-internship-2020/pffft/main_pffft_sandboxed.cc +++ b/oss-internship-2020/pffft/main_pffft_sandboxed.cc @@ -136,51 +136,55 @@ absl::Status PffftMain() { if (simd_size_iter == 0) simd_size_iter = 1; if (complex) { - api.cffti(n, work_array.PtrBoth()).IgnoreError(); + SAPI_RETURN_IF_ERROR(api.cffti(n, work_array.PtrBoth())) } else { - api.rffti(n, work_array.PtrBoth()).IgnoreError(); + SAPI_RETURN_IF_ERROR(api.rffti(n, work_array.PtrBoth())); } t0 = UclockSec(); for (int iter = 0; iter < simd_size_iter; ++iter) { if (complex) { - api.cfftf(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); - api.cfftb(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); + SAPI_RETURN_IF_ERROR( + api.cfftf(n, x_array.PtrBoth(), work_array.PtrBoth())); + SAPI_RETURN_IF_ERROR( + api.cfftb(n, x_array.PtrBoth(), work_array.PtrBoth())); } else { - api.rfftf(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); - api.rfftb(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); + SAPI_RETURN_IF_ERROR( + api.rfftf(n, x_array.PtrBoth(), work_array.PtrBoth())); + SAPI_RETURN_IF_ERROR( + api.rfftb(n, x_array.PtrBoth(), work_array.PtrBoth())); } } t1 = UclockSec(); flops = (simd_size_iter * 2) * - ((complex ? 5 : 2.5) * n * log((double)n) / M_LN2); + ((complex ? 5 : 2.5) * static_cast(n) * log(static_cast(n)) / M_LN2); ShowOutput("FFTPack", n, complex, flops, t0, t1, simd_size_iter); } // PFFFT benchmark { SAPI_ASSIGN_OR_RETURN( - PFFFT_Setup *s, + PFFFT_Setup * s, api.pffft_new_setup(n, complex ? PFFFT_COMPLEX : PFFFT_REAL)); sapi::v::RemotePtr s_reg(s); t0 = UclockSec(); for (int iter = 0; iter < max_iter; ++iter) { - api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(), - y_array.PtrBoth(), PFFFT_FORWARD) - .IgnoreError(); - api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(), - y_array.PtrBoth(), PFFFT_FORWARD) - .IgnoreError(); + SAPI_RETURN_IF_ERROR( + api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(), + y_array.PtrBoth(), PFFFT_FORWARD)); + SAPI_RETURN_IF_ERROR( + api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(), + y_array.PtrBoth(), PFFFT_FORWARD)); } t1 = UclockSec(); - api.pffft_destroy_setup(&s_reg).IgnoreError(); + SAPI_RETURN_IF_ERROR(api.pffft_destroy_setup(&s_reg)); flops = (max_iter * 2) * ((complex ? 5 : 2.5) * static_cast(n) * - log((double)n) / M_LN2); + log(static_cast(n)) / M_LN2); ShowOutput("PFFFT", n, complex, flops, t0, t1, max_iter); LOG(INFO) << "n = " << n << " SUCCESSFULLY";