Required changes resolved

This commit is contained in:
doinachiroiu 2020-09-03 14:59:54 +00:00
parent 7e22952c42
commit 1869fe515f
3 changed files with 26 additions and 28 deletions

View File

@ -19,8 +19,6 @@ project(pffft CXX C)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD_REQUIRED True)
set(PFFFT_ROOT_DIR https://bitbucket.org/jpommier/pffft.git)
add_library(pffft STATIC add_library(pffft STATIC
master/pffft.c master/pffft.c
master/pffft.h master/pffft.h
@ -45,7 +43,6 @@ endif()
target_link_libraries(pffft PUBLIC ${MATH_LIBS}) target_link_libraries(pffft PUBLIC ${MATH_LIBS})
# Adding dependencies # Adding dependencies
set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree") set(SAPI_ROOT "../.." CACHE PATH "Path to the Sandboxed API source tree")
# Then configure: # Then configure:

View File

@ -4,16 +4,13 @@ Build System: CMake
OS: Linux OS: Linux
### Check out the PFFFT library & CMake set up ### Check out the PFFFT library & CMake set up
`git checkout -b master` ```
git submodule update --init --recursive
`git submodule update --init --recursive`
`mkdir -p build && cd build`
`cmake .. -G Ninja -DPFFFT_ROOT_DIR=$PWD`
`ninja`
mkdir -p build && cd build
cmake .. -G Ninja -DPFFFT_ROOT_DIR=$PWD
ninjas
```
### For testing: ### For testing:
`cd build`, then `./pffft_sandboxed` `cd build`, then `./pffft_sandboxed`

View File

@ -136,51 +136,55 @@ absl::Status PffftMain() {
if (simd_size_iter == 0) simd_size_iter = 1; if (simd_size_iter == 0) simd_size_iter = 1;
if (complex) { if (complex) {
api.cffti(n, work_array.PtrBoth()).IgnoreError(); SAPI_RETURN_IF_ERROR(api.cffti(n, work_array.PtrBoth()))
} else { } else {
api.rffti(n, work_array.PtrBoth()).IgnoreError(); SAPI_RETURN_IF_ERROR(api.rffti(n, work_array.PtrBoth()));
} }
t0 = UclockSec(); t0 = UclockSec();
for (int iter = 0; iter < simd_size_iter; ++iter) { for (int iter = 0; iter < simd_size_iter; ++iter) {
if (complex) { if (complex) {
api.cfftf(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); SAPI_RETURN_IF_ERROR(
api.cfftb(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); api.cfftf(n, x_array.PtrBoth(), work_array.PtrBoth()));
SAPI_RETURN_IF_ERROR(
api.cfftb(n, x_array.PtrBoth(), work_array.PtrBoth()));
} else { } else {
api.rfftf(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); SAPI_RETURN_IF_ERROR(
api.rfftb(n, x_array.PtrBoth(), work_array.PtrBoth()).IgnoreError(); api.rfftf(n, x_array.PtrBoth(), work_array.PtrBoth()));
SAPI_RETURN_IF_ERROR(
api.rfftb(n, x_array.PtrBoth(), work_array.PtrBoth()));
} }
} }
t1 = UclockSec(); t1 = UclockSec();
flops = (simd_size_iter * 2) * flops = (simd_size_iter * 2) *
((complex ? 5 : 2.5) * n * log((double)n) / M_LN2); ((complex ? 5 : 2.5) * static_cast<double>(n) * log(static_cast<double>(n)) / M_LN2);
ShowOutput("FFTPack", n, complex, flops, t0, t1, simd_size_iter); ShowOutput("FFTPack", n, complex, flops, t0, t1, simd_size_iter);
} }
// PFFFT benchmark // PFFFT benchmark
{ {
SAPI_ASSIGN_OR_RETURN( SAPI_ASSIGN_OR_RETURN(
PFFFT_Setup *s, PFFFT_Setup * s,
api.pffft_new_setup(n, complex ? PFFFT_COMPLEX : PFFFT_REAL)); api.pffft_new_setup(n, complex ? PFFFT_COMPLEX : PFFFT_REAL));
sapi::v::RemotePtr s_reg(s); sapi::v::RemotePtr s_reg(s);
t0 = UclockSec(); t0 = UclockSec();
for (int iter = 0; iter < max_iter; ++iter) { for (int iter = 0; iter < max_iter; ++iter) {
SAPI_RETURN_IF_ERROR(
api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(), api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(),
y_array.PtrBoth(), PFFFT_FORWARD) y_array.PtrBoth(), PFFFT_FORWARD));
.IgnoreError(); SAPI_RETURN_IF_ERROR(
api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(), api.pffft_transform(&s_reg, x_array.PtrBoth(), z_array.PtrBoth(),
y_array.PtrBoth(), PFFFT_FORWARD) y_array.PtrBoth(), PFFFT_FORWARD));
.IgnoreError();
} }
t1 = UclockSec(); 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<double>(n) * flops = (max_iter * 2) * ((complex ? 5 : 2.5) * static_cast<double>(n) *
log((double)n) / M_LN2); log(static_cast<double>(n)) / M_LN2);
ShowOutput("PFFFT", n, complex, flops, t0, t1, max_iter); ShowOutput("PFFFT", n, complex, flops, t0, t1, max_iter);
LOG(INFO) << "n = " << n << " SUCCESSFULLY"; LOG(INFO) << "n = " << n << " SUCCESSFULLY";