Hi, I am Smit Gabani and in this blog I will introduce the Lab5.
For this lab we comparing the relative performance of various algorithms on the same computer on AArch64 and x86_64 systems.
Initial tasks:
- Get example programs using
cp /public/spo600-volume-examples.tgz ~
tar -xvzf spo600-volume-examples.tgz
- Change directory to where the Makefile stored. Using make to compile c-scripts.
- Define SAMPLES in the header file vol.h and the scale of volume was set to 50% in this header file.
- The memory used by these algorithm can be measured using free -m command in terminal.
- Simple measure of time using time command.
- Find a way to measure performance, using #include
What are inside the files:
vol.h
SAMPLES and VOLUME
In vol.h a large number of sample for the algorithms to process seems to be reasonable, because it will allow us to analyze the differences in terms of performance much easier.
vol0.c
In vol0.c, Audio samples are multiplied by the volume scaling factor, casting between signed 16-bit integers and floating-point values. This way takes up a lot of resources.
vol1.c
vol1.c utilizes a fixed-point calculation. This avoids the cost of repetitively casting between integer and floating point.
vol2.c
Unlike vol0.c and vol1.c, vol2.c pre-calculates all 65535 results, looking up answers for each input value afterward.
vol3.c
vol3.c returns an identical sample value, the purpose of this program seems to be a baseline to compare to the other scaling volume algorithm.
vol4.c
vol4.c uses the SIMD (Single Input, Multiple Data) instructions accessed through inline assembly. Which is only available on AArch64 architectures.
vol5.c
vol5.c like vol4.c also utilize SIMD instruction but with complier intrinsic built into the compiler. vol5.c is also specific to AArch64 due to usage of unique instructions of AArch64 architecture.
vol_createsample.c
vol_createsample.c contains the function vol_createsample(int16_t* sample, int32_t sample_count) that will be use to create dummy samples for the algorithms to run with.
My prediction:
Fastest: vol4, vol5
Average: vol2
Slowest: vol0, vol1
Running the programs with the time
command (SAMPLES 16 VOLUME 50):
Running the programs with the time
command (SAMPLES 500 VOLUME 50):
** Not all algorithms produce same result **
This is significant especially if the sample size increases.
Memory utilization:
Observation:
vol4 and vol5 are using much more memory that vol0, vol1, vol2, vol3.
Top comments (0)