2020-08-20 19:19:49 +08:00
|
|
|
|
# Sandboxing PFFFT library
|
|
|
|
|
|
2020-08-26 22:18:31 +08:00
|
|
|
|
Build System: CMake
|
2020-08-20 19:19:49 +08:00
|
|
|
|
OS: Linux
|
|
|
|
|
|
2020-08-26 22:18:31 +08:00
|
|
|
|
### Check out the PFFFT library & CMake set up
|
2020-08-27 20:54:57 +08:00
|
|
|
|
`git clone https://github.com/doinachiroiu/sandboxed-api/tree/master/oss-internship-2020/pffft`
|
|
|
|
|
|
|
|
|
|
`git submodule update --init --recursive`
|
2020-08-26 22:18:31 +08:00
|
|
|
|
|
2020-08-26 22:56:19 +08:00
|
|
|
|
`mkdir -p build && cd build`
|
2020-08-26 22:18:31 +08:00
|
|
|
|
|
|
|
|
|
`cmake .. -G Ninja -DPFFFT_ROOT_DIR=$PWD`
|
|
|
|
|
|
|
|
|
|
`ninja`
|
|
|
|
|
|
2020-08-20 19:19:49 +08:00
|
|
|
|
### For testing:
|
|
|
|
|
`cd build`, then `./pffft_sandboxed`
|
|
|
|
|
|
|
|
|
|
### For debug:
|
2020-08-26 22:18:31 +08:00
|
|
|
|
display custom info with
|
|
|
|
|
`./pffft_sandboxed --logtostderr`
|
2020-08-20 19:19:49 +08:00
|
|
|
|
|
|
|
|
|
## ***About the project***
|
|
|
|
|
*PFFFT library is concerned with 1D Fast-Fourier Transformations finding a
|
|
|
|
|
compromise between accuracy and speed. It deals with real and complex
|
2020-08-27 20:54:57 +08:00
|
|
|
|
vectors, both cases being illustrated in the testing part (`test_pffft.c`
|
2020-08-20 19:19:49 +08:00
|
|
|
|
for initially and original version, `main_pffft_sandboxed.cc` for our
|
|
|
|
|
currently implemented sandboxed version).
|
|
|
|
|
The original files can be found at: https://bitbucket.org/jpommier/pffft/src.*
|
|
|
|
|
|
|
|
|
|
*The purpose of sandboxing is to limit the permissions and capabilities of
|
|
|
|
|
library’s methods, in order to secure the usage of them.
|
|
|
|
|
After obtaining the sandbox, the functions will be called through an
|
|
|
|
|
Sandbox API (being called `api` in the current test) and so, the
|
|
|
|
|
operations, system calls or namspaces access may be controlled.
|
|
|
|
|
From both `pffft.h` and `fftpack.h` headers, useful methods are added to
|
|
|
|
|
sapi library builded with CMake. There is also a need to link math library
|
|
|
|
|
as the transformations made require mathematical operators.
|
|
|
|
|
Regarding the testing of the methods, one main is doing this job by
|
|
|
|
|
iterating through a set of values, that represents the accuracy of
|
|
|
|
|
transformations and print the speed for each value and type of
|
|
|
|
|
transformation. More specifically, the input length is the target for
|
2020-08-28 00:59:58 +08:00
|
|
|
|
accuracy (named as `n`) and it stands for the number of data points from
|
2020-08-20 19:19:49 +08:00
|
|
|
|
the series that calculate the result of transformation. It is also
|
2020-08-28 00:55:55 +08:00
|
|
|
|
important to mention that the `complex` variable stands for a boolean value
|
2020-08-20 19:19:49 +08:00
|
|
|
|
that tells the type of transformation (0 for REAL and 1 for COMPLEX) and
|
|
|
|
|
it is taken into account while testing.
|
2020-08-28 00:46:59 +08:00
|
|
|
|
In the end, the performance of PFFFT library it is outlined by the output.
|
2020-08-28 00:49:09 +08:00
|
|
|
|
There are two output formats available, from which you can choose through
|
|
|
|
|
`--output_format=` command-line flag.
|
2020-08-28 00:46:59 +08:00
|
|
|
|
Without using this type of argument when running, the output format is set
|
|
|
|
|
by default.*
|
2020-08-20 19:19:49 +08:00
|
|
|
|
|
|
|
|
|
#### CMake observations resume:
|
2020-08-26 22:18:31 +08:00
|
|
|
|
* linking pffft and fftpack (which contains necessary functions for pffft)
|
|
|
|
|
* set math library
|
2020-08-20 19:19:49 +08:00
|
|
|
|
|
|
|
|
|
#### Sandboxed main observations resume:
|
2020-08-26 22:18:31 +08:00
|
|
|
|
* containing two testing parts (fft / pffft benchmarks)
|
|
|
|
|
* showing the performance of the transformations implies
|
2020-08-20 19:19:49 +08:00
|
|
|
|
testing them through various FFT dimenstions.
|
2020-08-28 00:59:58 +08:00
|
|
|
|
Variable n, the input length, will take specific values
|
2020-08-20 19:19:49 +08:00
|
|
|
|
meaning the number of points to which it is set the calculus
|
2020-08-28 00:59:58 +08:00
|
|
|
|
(more details of mathematical purpose of n - https://en.wikipedia.org/wiki/Cooley%E2%80%93Tukey_FFT_algorithm).
|
2020-08-26 22:18:31 +08:00
|
|
|
|
* output shows speed depending on the input length
|
2020-08-28 00:46:59 +08:00
|
|
|
|
* use `--output_format=0` or `--output_format=1` arguments to choose between output formats.
|
|
|
|
|
`0` is for a detailed output, while `1` is only displaying each transformation process speed.
|
2020-08-20 19:19:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Bugs history
|
2020-08-27 20:54:57 +08:00
|
|
|
|
1. [Solved] pffft benchmark bug: "Sandbox not active"
|
|
|
|
|
|
2020-08-28 00:59:58 +08:00
|
|
|
|
n = 64, status OK, pffft_transform generates error
|
|
|
|
|
n > 64, status not OK
|
2020-08-27 20:54:57 +08:00
|
|
|
|
Problem on initialising sapi::StatusOr<PFFFT_Setup *> s; the memory that stays
|
|
|
|
|
for s is not the same with the address passed in pffft_transform function.
|
|
|
|
|
(sapi::v::GenericPtr - to be changed)
|
2020-08-20 19:19:49 +08:00
|
|
|
|
|
2020-08-27 20:54:57 +08:00
|
|
|
|
Temporary solution: change the generated files to accept
|
|
|
|
|
uintptr_t instead of PFFFT_Setup
|
2020-08-20 19:19:49 +08:00
|
|
|
|
|
2020-08-27 20:54:57 +08:00
|
|
|
|
Solution: using "sapi::v::RemotePtr" instead of "sapi::v::GenericPtr"
|
|
|
|
|
to access the memory of object s
|
2020-08-20 20:37:34 +08:00
|
|
|
|
|
2020-08-27 20:54:57 +08:00
|
|
|
|
2. [Unresolved] compiling bug: "No space left on device"
|
|
|
|
|
|
|
|
|
|
The building process creates some `embed` files that use lots of
|
|
|
|
|
memory, trying to write them on /tmp.
|
2020-08-20 21:15:02 +08:00
|
|
|
|
|
2020-08-27 20:54:57 +08:00
|
|
|
|
Temporary solution: clean /tmp directory by `sudo rm -rf /tmp/*`.
|