Alpaka: Conversion warning in TinyMT

Created on 4 May 2020  Â·  6Comments  Â·  Source: alpaka-group/alpaka

With -Wconversion I get a warning:

../thirdparty/alpaka-0.4.1/include/alpaka/rand/TinyMT/tinymt32.h:216:33: warning: conversion to ‘float’ from ‘uint32_t {aka unsigned int}’ may alter its value [-Wconversion]
     return (tinymt32_temper(random) >> 8) * TINYMT32_MUL;
        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~

I fixed it by explicitly stating the conversion:
return float(tinymt32_temper(random) >> 8) * TINYMT32_MUL;

Boost.Fiber OpenMP TBB Backendthread Warning

Most helpful comment

TinyMT is our CPU-side RNG backend #579 that does not occupy all RAM with RNG states alone #575 in production scenarios.
We use it from
https://github.com/MersenneTwister-Lab/TinyMT
and I applied already quite a bunch of fixes to mitigate warnings. We cropped it together in a single header, which might cause the warning even when not called explicitly.

Your proposed fix looks valid, do you want to propose it as a PR? :)

Upstream refs.:

All 6 comments

I can not find a place where alpaka is ever calling the tinymt32_generate_float method which contains this code. Did you directly call this method or what am I mising?

Or did the compiler generate this error while parsing the code without ever calling it?

No, we don't call it. I don't know what TinyMT is for.
I guess the compiler generate this error while parsing the code, since there is no template involved.

TinyMT is our CPU-side RNG backend #579 that does not occupy all RAM with RNG states alone #575 in production scenarios.
We use it from
https://github.com/MersenneTwister-Lab/TinyMT
and I applied already quite a bunch of fixes to mitigate warnings. We cropped it together in a single header, which might cause the warning even when not called explicitly.

Your proposed fix looks valid, do you want to propose it as a PR? :)

Upstream refs.:

I merged a fix into the develop branch.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ax3l picture ax3l  Â·  4Comments

BenjaminW3 picture BenjaminW3  Â·  6Comments

SimeonEhrig picture SimeonEhrig  Â·  5Comments

ax3l picture ax3l  Â·  5Comments

BenjaminW3 picture BenjaminW3  Â·  5Comments