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

[BUG]: CUB's c2h::gen(...) RNG utility only outputs positive non-zero floating point numbers. #617

Closed
1 task done
alliepiper opened this issue Oct 25, 2023 · 0 comments · Fixed by #623
Closed
1 task done
Assignees
Labels
bug Something isn't working right.

Comments

@alliepiper
Copy link
Collaborator

Is this a duplicate?

Type of Bug

Something else

Component

CUB

Describe the bug

The catch2 testing utilities provide a random number generator that, by default, produces random numbers in the range [numeric_limits<T>::min(), numeric_limits<T>::max()].

For floats, numeric_limits<T>::min() does not return the most negative value, but rather the smallest representable positive finite value. To cover the entire range, we should be using lowest().

However, the quick fix of changing the definition to use lowest() causes all output values to be inf, since computing random numbers with (max - lowest) * rand + lowest.

How to Reproduce

  1. Inspect data produced by c2h::gen for double types. No negative or zero values appear.
  2. Regenerate the data using lowest() instead of min(). All values are inf.

Expected behavior

The entire range of possible values should be sampled in the output.

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

@alliepiper alliepiper added the bug Something isn't working right. label Oct 25, 2023
@gevtushenko gevtushenko self-assigned this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants