mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Required changes resolved
This commit is contained in:
parent
7e22952c42
commit
1869fe515f
|
@ -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:
|
||||
|
|
|
@ -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`
|
||||
|
||||
|
|
|
@ -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<double>(n) * log(static_cast<double>(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<double>(n) *
|
||||
log((double)n) / M_LN2);
|
||||
log(static_cast<double>(n)) / M_LN2);
|
||||
ShowOutput("PFFFT", n, complex, flops, t0, t1, max_iter);
|
||||
|
||||
LOG(INFO) << "n = " << n << " SUCCESSFULLY";
|
||||
|
|
Loading…
Reference in New Issue
Block a user