This version of Access Pattern Bench represents optimized accesses to memory tackling the problems that arise in the inefficient versions. Although readability and maintenance might slightly suffer, restructuring the design of data structures can significantly improve the performance. An example is changing Array of Structures (AoS) to Structure of Arrays (SoA) to align the design with the way data is accessed in the application.
In general, if possible avoiding strided or random accesses is recommended. That might however depend on the application and algorithm at hand.
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 optimized 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 strided access EXE_NAME="linear_access.exe" STRIDE=1 CUSTOM_COMPILE_FLAGS="-DUSE_RANDOM_ACCESS=0" make release # run the resulting executable ./linear_access.exe