Skip to content

Commit

Permalink
Use posix_memalign version of STREAM
Browse files Browse the repository at this point in the history
Taken from https://www.cs.virginia.edu/stream/FTP/Code/Versions/stream_5-10_posix_memalign.c. This version avoids statically allocated arrays by using heap allocations. This avoids limitations of ELF/PE.
  • Loading branch information
bernhardmgruber committed Feb 25, 2023
1 parent 1d9a110 commit da10cd8
Show file tree
Hide file tree
Showing 3 changed files with 309 additions and 308 deletions.
2 changes: 1 addition & 1 deletion examples/stream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
cmake_minimum_required (VERSION 3.18.3)

find_package(OpenMP REQUIRED)
set(STREAM_ARRAY_SIZE 80000000) # if we make this too large, we will get linker errors due to ELF/PE limits
set(STREAM_ARRAY_SIZE 400000000 CACHE STRING "STREAM benchmark array size")

project(stream C)

Expand Down
6 changes: 6 additions & 0 deletions examples/stream/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is a compliant version of the [STREAM benchmark](https://www.cs.virginia.edu/stream/).
There are a few official such versions, which you can download [here](https://www.cs.virginia.edu/stream/FTP/Code/).
The [original version](https://www.cs.virginia.edu/stream/FTP/Code/stream.c) places the input and ouput arrays into the static program segment.
This causes the linker to complain because it breaks limits of ELF/PE (Linux/Windows executable file format) for big array sizes.
We therefore took the [version using `posix_memalign`](https://www.cs.virginia.edu/stream/FTP/Code/Versions/stream_5-10_posix_memalign.c) for allocation.
Some fixes were applied to make it compile with MSVC.

0 comments on commit da10cd8

Please sign in to comment.