Skip to content
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

Always use the correct numeric type for all kernels #134

Closed
tom91136 opened this issue Jul 27, 2022 · 1 comment
Closed

Always use the correct numeric type for all kernels #134

tom91136 opened this issue Jul 27, 2022 · 1 comment
Assignees
Milestone

Comments

@tom91136
Copy link
Member

There are several instances where the double constant 0.0 is used in a way that promotes everything it touches.
For example:

return std::transform_reduce(exe_policy, a.begin(), a.end(), b.begin(), 0.0);

In this case, the value is used on a templated function where the deducted type is based on that constant, so the kernel essentially gets fixed to double precision and not T.

There are several other models that does T sum = 0.0; which is probably OK.
But for consistency I think we should probably be using aggregate initialisation for everything:

std::transform_reduce(..., T{}); 
T sum{};  
@tom91136 tom91136 self-assigned this Jul 27, 2022
@tom91136 tom91136 added this to the v5.0 milestone Jun 14, 2023
@tomdeakin
Copy link
Contributor

LGTM, apply this (with a comment in the code)

pranav-sivaraman pushed a commit to hpcgroup/BabelStream that referenced this issue Dec 7, 2023
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

No branches or pull requests

2 participants