Skip to content

Add missing <cstdint> and <cstddef> headers. #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

breyerml
Copy link

This PR fixes a bug introduced in #188 due to not adding the necessary <cstdint> headers when using inptr_t.

Additionally, as far as I understand the code, the current develop branch exhibits UB or, at best, implementation-defined behavior due to the new error checking introduced in #186. If I only enable, for example, the triad kernel, goldC is never written and, therefore, is equal to 0 (the value of startC in the Stream.h header). However, later, the error is calculate as

T eC = std::fabs(vC - goldC) / std::fabs(goldC);

, which results in a division by zero and sets eC to NaN. In the check function, eC is tested against NaN and reports a failing check, although vC is also zero, in which case the result should be marked as correct.
I added a (ugly) hotfix, but I'm currently unable to implement a better fix due to time constraints.

@breyerml
Copy link
Author

breyerml commented Mar 30, 2025

Also, if I run:

./omp-stream -s 10000000000 -n 2 --only Triad

all I get is a SegFault.
However, running it with

./omp-stream -s 1000000000 -n 2 --only Triad

gives to correct result.

(Note that our machine has enough RAM for the first call.)

@breyerml
Copy link
Author

Ok. The problem with this SegFault is that due to the read_arrays function, the STREAM data must be stored twice. Therefore, we actually have 6 * sizeof(T) * array_size instead of 3 * sizeof(T) * array_size, which is kind of unintuitive, to say the least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant