This version of Access Pattern Bench represents inefficient strided accesses to memory. This can happen if the design of data structures in an application is different than the way data is accessed and processed. A common example is using lists of classes or structs, also called Array of Structures (AoS). Although maintainability and readability might improve using such constructs it might lead to performance degradation if data is not accessed in a linear fashion due to inefficient cache usage.
Another example are random or indirect accesses to memory. This additional indirection or unpredictability might also lead to strided accesses and can also prevent the compiler from vectorizing the code.
The repository provides a detailed README file with a description and instructions how to build, run and evaluate results. Further, each benchmark has a Makefile with different targets (realease, debug, likwid, extrae) and the option to change parameters like problem size, stride and number of iterations. For this version of Access Pattern Bench however, we focus on how to build and run examples for following inefficient access patterns.
# change to benchmark directory
cd src/AoS_SoA/
# only builds AoS
EXE_NAME="AoS_only.exe" CUSTOM_COMPILE_FLAGS="-DUSE_SOA=0" make release
# run the resulting executable
./AoS_only.exe
# change to benchmark directory
cd src/Random_Access/
# only builds random access
EXE_NAME="random_access.exe" CUSTOM_COMPILE_FLAGS="-DUSE_STRIDED_ACCESS=0" make release
# run the resulting executable
./random_access.exe
# change to benchmark directory
cd src/Random_Access/
# only builds strided access
EXE_NAME="strided_access.exe" STRIDE=8 CUSTOM_COMPILE_FLAGS="-DUSE_RANDOM_ACCESS=0" make release
# run the resulting executable
./strided_access.exe